File tree Expand file tree Collapse file tree 2 files changed +28
-7
lines changed
neg-custom-args/fatal-warnings
pos-special/fatal-warnings Expand file tree Collapse file tree 2 files changed +28
-7
lines changed Original file line number Diff line number Diff line change @@ -25,24 +25,25 @@ object Main {
2525 }
2626
2727 // 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+ // }
3334
3435 // throwing in @unchecked on the next two to make sure
3536 // multiple annotations are processed correctly
3637
3738 // 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
3940 case 'A' => true
4041 case Other .C1 => true
4142 case _ => false
4243 }
4344
4445 // 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
4647 case 'A' => true
4748 case Other .C3 => true
4849 case _ => false
@@ -63,4 +64,14 @@ object Main {
6364 case 5 | 6 | 7 | 8 => 100
6465 case _ => - 1
6566 }
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+ }
6677}
Original file line number Diff line number Diff line change @@ -23,6 +23,16 @@ class Test {
2323 case 14 => 4
2424 case _ => 5
2525 }
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+ }
2636}
2737
2838object Test {
You can’t perform that action at this time.
0 commit comments