[webkit-changes] [WebKit/WebKit] 1b28a1: [WGSL] Type checking should allow concretization o...

Tadeu Zagallo noreply at github.com
Mon Apr 10 16:16:29 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1b28a1f2ba87296bc224a26c2ab271e5fe0eb4b2
      https://github.com/WebKit/WebKit/commit/1b28a1f2ba87296bc224a26c2ab271e5fe0eb4b2
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-04-10 (Mon, 10 Apr 2023)

  Changed paths:
    M Source/WebGPU/WGSL/Overload.cpp
    M Source/WebGPU/WGSL/TypeCheck.cpp
    M Source/WebGPU/WGSL/Types.cpp
    M Source/WebGPU/WGSL/Types.h
    A Source/WebGPU/WGSL/tests/valid/concretization.wgsl

  Log Message:
  -----------
  [WGSL] Type checking should allow concretization of variable initializers
https://bugs.webkit.org/show_bug.cgi?id=255020
rdar://107647275

Reviewed by Myles C. Maxfield.

Prior to this patch we only supported initializing variables that had an explicit
type annotation with values of the same type, but it should also be possible to
initialize it with an abstract value that can be concretized to the target type,
such as initializing a u32 variable with an AbstractInt. To achieve that we reuse
the conversion rank function as per the spec, which was previously implemented for
resolving function overloads.

* Source/WebGPU/WGSL/Overload.cpp:
(WGSL::OverloadResolver::considerCandidate):
(WGSL::OverloadResolver::calculateRank):
(WGSL::OverloadResolver::unify):
(WGSL::OverloadResolver::conversionRank const):
(WGSL::primitivePair): Deleted.
(WGSL::OverloadResolver::conversionRankImpl const): Deleted.
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::unify):
* Source/WebGPU/WGSL/Types.cpp:
(WGSL::primitivePair):
(WGSL::conversionRank):
* Source/WebGPU/WGSL/Types.h:
* Source/WebGPU/WGSL/tests/valid/concretization.wgsl: Added.

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




More information about the webkit-changes mailing list