[webkit-changes] [WebKit/WebKit] cd24b9: [WGSL] Record type errors while type checking

Tadeu Zagallo noreply at github.com
Mon Feb 6 07:35:28 PST 2023


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

  Changed paths:
    M Source/WebGPU/WGSL/AST/ASTBinaryExpression.cpp
    M Source/WebGPU/WGSL/AST/ASTBinaryExpression.h
    M Source/WebGPU/WGSL/CompilationMessage.cpp
    M Source/WebGPU/WGSL/TypeCheck.cpp
    M Source/WebGPU/WGSL/TypeStore.cpp
    M Source/WebGPU/WGSL/TypeStore.h
    M Source/WebGPU/WGSL/Types.cpp
    M Source/WebGPU/WGSL/Types.h

  Log Message:
  -----------
  [WGSL] Record type errors while type checking
https://bugs.webkit.org/show_bug.cgi?id=251686
rdar://105004579

Reviewed by Myles C. Maxfield.

Add a function to start reporting type errors. For now, the errors are only
logged, but they should be reported when we move the type checking phase to
the `staticCheck` stage. To ensure we can report multiple errors, once we
encounter a type error, we infer the type of that expression to be "bottom",
which is a special type that is a subtype of every other type. i.e. we stop
reporting other errors that would be a consequence of an error we already
discovered.

* Source/WebGPU/WGSL/CompilationMessage.cpp:
(WGSL::CompilationMessage::dump const):
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::TypeChecker):
(WGSL::TypeChecker::check):
(WGSL::TypeChecker::visit):
(WGSL::TypeChecker::unify):
(WGSL::TypeChecker::isBottom const):
(WGSL::TypeChecker::typeError):
* Source/WebGPU/WGSL/Types.cpp:
(WGSL::printInternal):
(WGSL::toString):
* Source/WebGPU/WGSL/Types.h:

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




More information about the webkit-changes mailing list