diff --git a/Source/WebGPU/WGSL/TypeCheck.cpp b/Source/WebGPU/WGSL/TypeCheck.cpp index 9c19f8bf63e27..9e2838117239e 100644 --- a/Source/WebGPU/WGSL/TypeCheck.cpp +++ b/Source/WebGPU/WGSL/TypeCheck.cpp @@ -722,7 +722,7 @@ void TypeChecker::visit(AST::Function& function) ContextScope functionContext(this); for (unsigned i = 0; i < parameters.size(); ++i) introduceValue(function.parameters()[i].name(), parameters[i]); - Base::visit(function.body()); + AST::Visitor::visit(function.body()); auto behaviors = analyze(function.body()); if (behaviors.contains(Behavior::Next) && function.maybeReturnType()) diff --git a/Source/WebGPU/WGSL/tests/invalid/shadowing.wgsl b/Source/WebGPU/WGSL/tests/invalid/shadowing.wgsl new file mode 100644 index 0000000000000..54b5983837a60 --- /dev/null +++ b/Source/WebGPU/WGSL/tests/invalid/shadowing.wgsl @@ -0,0 +1,7 @@ +// RUN: %not %wgslc | %check + +fn testParameterScope(x: f32) -> i32 +{ + // CHECK-L: redeclaration of 'x' + let x: i32 = 1; +}