update tests

This commit is contained in:
SparkyPotato authored and Teodor Tanasoaia committed 2023-02-01 12:28:31 +01:00
1 parent dcfd5c6f4a
commit a5c2cf94b8
1 file changed
+46 -3
+46 -3
View File
@@ -1624,13 +1624,56 @@ fn assign_to_let() {
}
",
r###"error: invalid left-hand side of assignment
┌─ wgsl:4:10
┌─ wgsl:3:17
│
3 │ let a = 10;
│ ^ this is an immutable binding
4 │ a = 20;
│ ^ cannot assign to this expression
│
= note: 'a' is an immutable binding
= note: consider declaring it with `var` instead of `let`
= 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`
"###,
);