-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WGSL] Variable redeclaration should not assert
https://bugs.webkit.org/show_bug.cgi?id=259727 rdar://113257297 Reviewed by Dan Glastonbury. Currently, when inserting a new value or type into the type checker context we assert that the context doesn't already have another entry with the same name. Instead, we should report an error informing that it's invalid to redeclare that value/type. * Source/WebGPU/WGSL/ContextProvider.h: * Source/WebGPU/WGSL/ContextProviderInlines.h: (WGSL::ContextProvider<Value>::Context::add): (WGSL::ContextProvider<Value>::introduceVariable const): * Source/WebGPU/WGSL/MangleNames.cpp: (WGSL::NameManglerVisitor::introduceVariable): * Source/WebGPU/WGSL/TypeCheck.cpp: (WGSL::TypeChecker::TypeChecker): (WGSL::TypeChecker::introduceType): (WGSL::TypeChecker::introduceValue): * Source/WebGPU/WGSL/tests/invalid/redeclaration.wgsl: Added. Canonical link: https://commits.webkit.org/266635@main
- Loading branch information
1 parent
e7b9bd2
commit 0db7d09
Showing
5 changed files
with
40 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// RUN: %not %wgslc | %check | ||
|
||
struct f { | ||
} | ||
|
||
// CHECK-L: redeclaration of 'f' | ||
override f = 1; | ||
|
||
// CHECK-L: redeclaration of 'f' | ||
fn f() { | ||
let x = 1; | ||
// CHECK-L: redeclaration of 'x' | ||
var x = 2; | ||
// CHECK-L: redeclaration of 'x' | ||
const x = 2; | ||
} |