[webkit-changes] [WebKit/WebKit] d552f3: [WGSL] Type checker crashes when calling a non-exi...

Tadeu Zagallo noreply at github.com
Mon Jun 19 18:33:53 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d552f3bf1512e47a070057df999049e537cd8350
      https://github.com/WebKit/WebKit/commit/d552f3bf1512e47a070057df999049e537cd8350
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-06-19 (Mon, 19 Jun 2023)

  Changed paths:
    M Source/WebGPU/WGSL/TypeCheck.cpp
    M Source/WebGPU/WGSL/tests/invalid/function-call.wgsl

  Log Message:
  -----------
  [WGSL] Type checker crashes when calling a non-existing function
https://bugs.webkit.org/show_bug.cgi?id=258280
rdar://111003956

Reviewed by Dan Glastonbury.

When type checking a call we try to identify what is the type bound to the target,
e.g. for `f()`, first we look up the typing context to see if there's a type or
value bound to `f`. If there is none, we try to look up overloaded declarations
for `f`. If `f` isn't overloaded either, we have to emit an error, but at this
point we were unconditionally using the binding to construct the error message
(the first lookup just mentioned), which will be null if `f` doesn't exist. To
fix that we check if the binding exists to decide which error message we should
emit: either that the target doesn't exist or that it's an invalid target for a
call (i.e. it exists, but isn't a function).

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
* Source/WebGPU/WGSL/tests/invalid/function-call.wgsl:

Canonical link: https://commits.webkit.org/265312@main




More information about the webkit-changes mailing list