From cbd0205999d19e378f9f7ac8ca685a134862cf47 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Sat, 19 Jan 2013 11:57:52 +0100 Subject: SI-6902 Check unreachability under @unchecked Only exhaustiveness checking should be disabled if the scrutinee of a match as annotated as `: @unchecked`. This was the pre-2.10.x behaviour. This also fixes a variation of the closed ticket, SI-6011. The exhaustiveness check is needed to safely fallback from emitting a table switch if duplicate cases are detected. --- test/files/run/t6011c.scala | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 test/files/run/t6011c.scala (limited to 'test/files/run') diff --git a/test/files/run/t6011c.scala b/test/files/run/t6011c.scala new file mode 100644 index 0000000000..0647e3f81a --- /dev/null +++ b/test/files/run/t6011c.scala @@ -0,0 +1,13 @@ +object Test extends App { + // A variation of SI-6011, which eluded the fix + // in 2.10.0. + // + // duplicate keys in SWITCH, can't pick arbitrarily one of them to evict, see SI-6011. + // at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:50) + // at scala.tools.nsc.Global.abort(Global.scala:249) + // at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder$jcode$.emitSWITCH(GenASM.scala:1850) + ((1: Byte): @unchecked @annotation.switch) match { + case 1 => 2 + case 1 => 3 // crash + } +} -- cgit v1.2.3