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