Skip to content

Commit df3a482

Browse files
committed
Fix tests to avoid new switch warnings
The tests changed in this commit now caused switch warnings (which was correct). Remove the @switch annotation to avoid the warning.
1 parent 4867326 commit df3a482

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

tests/pos/typers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ object typers {
7777

7878
class C {
7979

80-
@tailrec final def factorial(acc: Int, n: Int): Int = (n: @switch) match {
80+
@tailrec final def factorial(acc: Int, n: Int): Int = n match {
8181
case 0 => acc
8282
case _ => factorial(acc * n, n - 1)
8383
}

tests/run/switches.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ object Test extends App {
1818
case _ => 4
1919
}
2020

21-
val x3 = (x: @switch) match {
21+
val x3 = x match {
2222
case '0' if x > 0 => 0
2323
case '1' => 1
2424
case '2' => 2

tests/run/t5830.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ object Test extends dotty.runtime.LegacyApp {
1010
case 'c' =>
1111
}
1212

13-
def ifThenElse(ch: Char, eof: Boolean) = (ch: @switch) match {
13+
def ifThenElse(ch: Char, eof: Boolean) = ch match {
1414
case 'a' if eof => println("a with oef") // then branch
1515
case 'a' if eof => println("a with oef2") // unreachable, but the analysis is not that sophisticated
1616
case 'a' => println("a") // else-branch
@@ -22,7 +22,7 @@ object Test extends dotty.runtime.LegacyApp {
2222
case _ => println("default")
2323
}
2424

25-
def defaults(ch: Char, eof: Boolean) = (ch: @switch) match {
25+
def defaults(ch: Char, eof: Boolean) = ch match {
2626
case _ if eof => println("def with oef") // then branch
2727
case _ if eof => println("def with oef2") // unreachable, but the analysis is not that sophisticated
2828
case _ => println("def") // else-branch

0 commit comments

Comments
 (0)