Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1b28a1f2ba87296bc224a26c2ab271e5fe0eb4b2
https://github.com/WebKit/WebKit/commit/1b28a1f2ba87296bc224a26c2ab271e5fe0eb4b2
Author: Tadeu Zagallo <[email protected]>
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
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes