Skip to content

Commit

Permalink
Adjust tests to match WGSL spec on number literals
Browse files Browse the repository at this point in the history
Suffixes are not type names and currently only a plain `u` is supported
for uints. More specifically, `i` and `f` suffixes or suffixes with
widths in bits like `u32` are not supported at the moment.
  • Loading branch information
Hans Christian Schmitz committed Aug 11, 2021
1 parent 0a0f0f9 commit 9ff29df
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/front/wgsl/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,12 @@ fn test_tokens() {
Token::Number {
value: "2",
ty: 'u',
width: "3",
width: "",
},
Token::Number {
value: "3",
ty: 'i',
width: "",
},
Token::Word("o"),
],
Expand All @@ -688,9 +693,9 @@ fn test_tokens() {
Token::Number {
value: "2.4",
ty: 'f',
width: "44",
width: "",
},
Token::Word("po"),
Token::Word("f44po"),
],
);
sub_test(
Expand Down
2 changes: 1 addition & 1 deletion src/front/wgsl/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ fn parse_type_inference() {
fn foo() {
let a = 2u;
let b: u32 = a;
var x = 3f32;
var x = 3.;
var y = vec2<f32>(1, 2);
}",
)
Expand Down

0 comments on commit 9ff29df

Please sign in to comment.