for some failure cases, the linker does not have to check them and can rely on the output code being invalid. But some are more sneaky and could actually generate valid but unpredictable WGSL code. Examples:
import/declaration name conflict.
import foo::bar;
import util::bar;
fn bar() {}
fn main() {
bar(); // which one is picked? They are all mangled differently
}
shadowing built-ins webgpu-tools/wesl-spec#70 since the last consensus was to not shadow root module declarations, shadowing builtins in the root module has action at a distance. Probably we should change that behavior though.
// module root.wgsl
fn f32() {}
// module util.wgsl
const x: f32 = 0; // invalid: f32 was overriden in the root module and is not mangled
for some failure cases, the linker does not have to check them and can rely on the output code being invalid. But some are more sneaky and could actually generate valid but unpredictable WGSL code. Examples:
import/declaration name conflict.
shadowing built-ins webgpu-tools/wesl-spec#70 since the last consensus was to not shadow root module declarations, shadowing builtins in the root module has action at a distance. Probably we should change that behavior though.