Skip to content

Commit 4d96068

Browse files
committed
add shadowing_predeclared_types test
1 parent 0586f7b commit 4d96068

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

naga/src/front/wgsl/tests.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,36 @@ fn parse_alias() {
631631
.unwrap();
632632
}
633633

634+
#[test]
635+
fn shadowing_predeclared_types() {
636+
parse_str(
637+
"
638+
fn test(f32: vec2f) -> vec2f { return f32; }
639+
",
640+
)
641+
.unwrap();
642+
parse_str(
643+
"
644+
fn test(vec2: vec2f) -> vec2f { return vec2; }
645+
",
646+
)
647+
.unwrap();
648+
parse_str(
649+
"
650+
alias vec2f = vec2u;
651+
fn test(v: vec2f) -> vec2u { return v; }
652+
",
653+
)
654+
.unwrap();
655+
parse_str(
656+
"
657+
struct vec2f { inner: vec2<f32> };
658+
fn test(v: vec2f) -> vec2<f32> { return v.inner; }
659+
",
660+
)
661+
.unwrap();
662+
}
663+
634664
#[test]
635665
fn parse_texture_load_store_expecting_four_args() {
636666
for (func, texture) in [

0 commit comments

Comments
 (0)