File tree 2 files changed +28
-7
lines changed
neg-custom-args/fatal-warnings
pos-special/fatal-warnings
2 files changed +28
-7
lines changed Original file line number Diff line number Diff line change @@ -25,24 +25,25 @@ object Main {
25
25
}
26
26
27
27
// has a guard, but since SI-5830 that's ok
28
- def succ_guard (c : Char ) = (c : @ switch) match {
29
- case 'A' | 'B' | 'C' => true
30
- case x if x == 'A' => true
31
- case _ => false
32
- }
28
+ // PENDING: #5070
29
+ // def succ_guard(c: Char) = (c: @switch) match {
30
+ // case 'A' | 'B' | 'C' => true
31
+ // case x if x == 'A' => true
32
+ // case _ => false
33
+ // }
33
34
34
35
// throwing in @unchecked on the next two to make sure
35
36
// multiple annotations are processed correctly
36
37
37
38
// thinks a val in an object is constant... so naive
38
- def fail2 (c : Char ) = (c : @ switch @ unchecked) match {
39
+ def fail1 (c : Char ) = (c : @ switch @ unchecked) match { // error: Could not emit switch for @switch annotated match
39
40
case 'A' => true
40
41
case Other .C1 => true
41
42
case _ => false
42
43
}
43
44
44
45
// more naivete
45
- def fail3 (c : Char ) = (c : @ unchecked @ switch) match {
46
+ def fail2 (c : Char ) = (c : @ unchecked @ switch) match { // error: Could not emit switch for @switch annotated match
46
47
case 'A' => true
47
48
case Other .C3 => true
48
49
case _ => false
@@ -63,4 +64,14 @@ object Main {
63
64
case 5 | 6 | 7 | 8 => 100
64
65
case _ => - 1
65
66
}
67
+
68
+ def fail3 (x : Any ) = (x : @ switch) match { // error: Could not emit switch for @switch annotated match
69
+ case 1 | 2 | 3 => true
70
+ case _ => false
71
+ }
72
+
73
+ def fail4 (x : AnyVal ) = (x : @ switch) match { // error: Could not emit switch for @switch annotated match
74
+ case 1 | 2 | 3 => true
75
+ case _ => false
76
+ }
66
77
}
Original file line number Diff line number Diff line change @@ -23,6 +23,16 @@ class Test {
23
23
case 14 => 4
24
24
case _ => 5
25
25
}
26
+
27
+ def test4 (x : Byte ): Boolean = (x : @ switch) match {
28
+ case 1 | 2 | 3 => true
29
+ case _ => false
30
+ }
31
+
32
+ def test5 (x : Short ): Boolean = (x : @ switch) match {
33
+ case 1 | 2 | 3 => true
34
+ case _ => false
35
+ }
26
36
}
27
37
28
38
object Test {
You can’t perform that action at this time.
0 commit comments