Skip to content

Commit

Permalink
tests/wgsl-errors.rs: Add back two tests to assign_to_let. (#2538)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimblandy authored Oct 5, 2023
1 parent f44d645 commit 2c1c76b
Showing 1 changed file with 41 additions and 41 deletions.
82 changes: 41 additions & 41 deletions tests/wgsl-errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1743,47 +1743,47 @@ fn assign_to_let() {
"###,
);

// check(
// "
// fn f() {
// let a = array(1, 2);
// a[0] = 1;
// }
// ",
// r###"error: invalid left-hand side of assignment
// ┌─ wgsl:3:17
//
// 3 │ let a = array(1, 2);
// │ ^ this is an immutable binding
// 4 │ a[0] = 1;
// │ ^^^^ cannot assign to this expression
//
// = note: consider declaring 'a' with `var` instead of `let`

// "###,
// );

// check(
// "
// struct S { a: i32 }

// fn f() {
// let a = S(10);
// a.a = 20;
// }
// ",
// r###"error: invalid left-hand side of assignment
// ┌─ wgsl:5:17
//
// 5 │ let a = S(10);
// │ ^ this is an immutable binding
// 6 │ a.a = 20;
// │ ^^^ cannot assign to this expression
//
// = note: consider declaring 'a' with `var` instead of `let`

// "###,
// );
check(
"
fn f() {
let a = array(1, 2);
a[0] = 1;
}
",
r###"error: invalid left-hand side of assignment
┌─ wgsl:3:17
3 │ let a = array(1, 2);
│ ^ this is an immutable binding
4 │ a[0] = 1;
│ ^^^^ cannot assign to this expression
= note: consider declaring 'a' with `var` instead of `let`
"###,
);

check(
"
struct S { a: i32 }
fn f() {
let a = S(10);
a.a = 20;
}
",
r###"error: invalid left-hand side of assignment
┌─ wgsl:5:17
5 │ let a = S(10);
│ ^ this is an immutable binding
6 │ a.a = 20;
│ ^^^ cannot assign to this expression
= note: consider declaring 'a' with `var` instead of `let`
"###,
);
}

#[test]
Expand Down

0 comments on commit 2c1c76b

Please sign in to comment.