From 0c25979244877b4431066700a6e945f145771c3c Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Mon, 29 Sep 2014 17:52:40 +0200 Subject: SI-8731 warning if @switch is ignored For matches with two or fewer cases, @switch is ignored. This should not happen silently. --- test/files/neg/t8731.check | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 test/files/neg/t8731.check (limited to 'test/files/neg/t8731.check') diff --git a/test/files/neg/t8731.check b/test/files/neg/t8731.check new file mode 100644 index 0000000000..2a9af475fc --- /dev/null +++ b/test/files/neg/t8731.check @@ -0,0 +1,9 @@ +t8731.scala:5: warning: matches with two cases or fewer are emitted using if-then-else instead of switch + def f(x: Int) = (x: @annotation.switch) match { + ^ +t8731.scala:10: warning: could not emit switch for @switch annotated match + def g(x: Int) = (x: @annotation.switch) match { + ^ +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found -- cgit v1.2.3