summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-01-04 23:47:41 -0800
committerPaul Phillips <paulp@improving.org>2012-01-04 23:55:51 -0800
commitbe46e487134305edae065de00582928c120bcfbb (patch)
treef20679fe453ade9e72e9220dabcc574e0e5246fc /src
parentbedb33fd7cb3439a129dff15e1ea1341c5c8fe7d (diff)
downloadscala-be46e487134305edae065de00582928c120bcfbb.tar.gz
scala-be46e487134305edae065de00582928c120bcfbb.tar.bz2
scala-be46e487134305edae065de00582928c120bcfbb.zip
Fix for NoSuchMethod in cleanup.
Don't assume that just because someone is calling x.toInt and x <: java.lang.Number, that it's a boxed primitive. Closes SI-5356.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/transform/CleanUp.scala12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala
index 575fe8f295..f04867b889 100644
--- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala
+++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala
@@ -275,7 +275,17 @@ abstract class CleanUp extends Transform with ast.TreeDSL {
/* ### HANDLING METHODS NORMALLY COMPILED TO OPERATORS ### */
val testForNumber: Tree => Tree = {
- qual1 => (qual1 IS_OBJ BoxedNumberClass.tpe) OR (qual1 IS_OBJ BoxedCharacterClass.tpe)
+ // Can't shortcut on BoxedNumber because BoxesRunTime
+ // is unforgiving of other Numbers showing up.
+ qual1 => (
+ (qual1 IS_OBJ BoxedIntClass.tpe)
+ OR (qual1 IS_OBJ BoxedLongClass.tpe)
+ OR (qual1 IS_OBJ BoxedDoubleClass.tpe)
+ OR (qual1 IS_OBJ BoxedFloatClass.tpe)
+ OR (qual1 IS_OBJ BoxedByteClass.tpe)
+ OR (qual1 IS_OBJ BoxedShortClass.tpe)
+ OR (qual1 IS_OBJ BoxedCharacterClass.tpe)
+ )
}
val testForBoolean: Tree => Tree = {
qual1 => (qual1 IS_OBJ BoxedBooleanClass.tpe)