blob: fc67f99f82407860e96d0672f287cf7cd66e2137 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
comptime {
const a = "foo";
if (a != "foo") unreachable;
}
comptime {
const a = "foo";
if (a == "foo") {} else unreachable;
}
comptime {
const a = "foo";
if (a != ("foo")) {} // intentionally allow
if (a == ("foo")) {} // intentionally allow
}
comptime {
const a = "foo";
switch (a) {
"foo" => {},
else => unreachable,
}
}
comptime {
const a = "foo";
switch (a) {
("foo") => {}, // intentionally allow
else => {},
}
}
// error
//
// :3:11: error: cannot compare strings with !=
// :7:11: error: cannot compare strings with ==
// :17:9: error: cannot switch on strings
|