diff options
author | Miguel Garcia <miguelalfredo.garcia@epfl.ch> | 2012-07-07 21:08:24 +0200 |
---|---|---|
committer | Miguel Garcia <miguelalfredo.garcia@epfl.ch> | 2012-07-07 21:08:24 +0200 |
commit | 4cca17da5c5236c23e32c0a3298e4a097e335a0c (patch) | |
tree | 5d0dfdd936c71713e855d380b11e355fad2243c8 | |
parent | 11765f150885f7b143c5fb493a7385927034fe68 (diff) | |
download | scala-4cca17da5c5236c23e32c0a3298e4a097e335a0c.tar.gz scala-4cca17da5c5236c23e32c0a3298e4a097e335a0c.tar.bz2 scala-4cca17da5c5236c23e32c0a3298e4a097e335a0c.zip |
raise compile time error about impending VerifyError due to unsorted lookupswitch (SI-6011)
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala index 49a3a13247..32c100b026 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala @@ -1942,6 +1942,15 @@ abstract class GenASM extends SubComponent with BytecodeWriters { i += 1
}
+ // check for duplicate keys to avoid "VerifyError: unsorted lookupswitch" (SI-6011)
+ i = 1
+ while (i < keys.length) {
+ if(keys(i-1) == keys(i)) {
+ abort("duplicate keys in SWITCH, can't pick arbitrarily one of them to evict, see SI-6011.")
+ }
+ i += 1
+ }
+
val keyMin = keys(0)
val keyMax = keys(keys.length - 1)
|