File tree 2 files changed +38
-0
lines changed
2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -12,5 +12,11 @@ switch_expressions_syntax.pwn(49 -- 51) : error 040: duplicate "case" label (val
12
12
switch_expressions_syntax.pwn(58 -- 59) : error 050: invalid range
13
13
switch_expressions_syntax.pwn(66 -- 68) : error 040: duplicate "case" label (value 1)
14
14
switch_expressions_syntax.pwn(66 -- 69) : error 040: duplicate "case" label (value 3)
15
+ switch_expressions_syntax.pwn(77 -- 78) : warning 213: tag mismatch: expected tag "Tag", but found none ("_")
16
+ switch_expressions_syntax.pwn(77 -- 80) : warning 213: tag mismatch: expected tag "Tag", but found none ("_")
17
+ switch_expressions_syntax.pwn(77 -- 81) : warning 213: tag mismatch: expected tag "Tag", but found none ("_")
18
+ switch_expressions_syntax.pwn(89 -- 91) : warning 213: tag mismatch: expected tag "Tag", but found none ("_")
19
+ switch_expressions_syntax.pwn(89 -- 93) : warning 213: tag mismatch: expected tag "Tag", but found none ("_")
20
+ switch_expressions_syntax.pwn(98 -- 100) : error 095: switch expression must contain a "default" case
15
21
" " "
16
22
}
Original file line number Diff line number Diff line change @@ -71,6 +71,35 @@ test_OverlayingRanges(value)
71
71
);
72
72
}
73
73
74
+ test_TagMismatchCase (value)
75
+ {
76
+ const Tag: TaggedConst = Tag: 1 ;
77
+ return switch (Tag: value;
78
+ 0 : 0 ; // warning 213: tag mismatch: expected tag "Tag", but found none ("_")
79
+ TaggedConst: 1 ;
80
+ (Tag: 2 )..3 : 2 ; // warning 213: tag mismatch: expected tag "Tag", but found none ("_")
81
+ 4 ..(Tag: 5 ): 3 ; // warning 213: tag mismatch: expected tag "Tag", but found none ("_")
82
+ (Tag: 6 )..(Tag: 7 ): 4 ;
83
+ _: 5
84
+ );
85
+ }
86
+
87
+ Tag: test_TagMismatchExpr (value)
88
+ {
89
+ return switch (value;
90
+ 0 : Tag: 0 ;
91
+ 1 : 1 ; // warning 213: tag mismatch: expected tag "Tag", but found none ("_")
92
+ _: 2 // warning 213: tag mismatch: expected tag "Tag", but found none ("_")
93
+ );
94
+ }
95
+
96
+ test_MissingDefault (value)
97
+ {
98
+ return switch (value;
99
+ 0 : 0
100
+ ); // error 095: switch expression must contain a "default" case
101
+ }
102
+
74
103
main ()
75
104
{
76
105
test_NonConstCaseValue (0 );
@@ -81,4 +110,7 @@ main()
81
110
test_DuplicateCases (0 );
82
111
test_InvalidRange (0 );
83
112
test_OverlayingRanges (0 );
113
+ test_TagMismatchCase (0 );
114
+ test_TagMismatchExpr (0 );
115
+ test_MissingDefault (0 );
84
116
}
You can’t perform that action at this time.
0 commit comments