Skip to content
Browse files

SI-7233 Account for aliased imports in Erasure

When we discard the fiction of `scala.Any`.
  • Loading branch information...
1 parent 33b499c commit 41e3b89c6d636164f48a2c2d8e8867201075cdae @retronym retronym committed Mar 10, 2013
Showing with 9 additions and 1 deletion.
  1. +1 −1 src/compiler/scala/tools/nsc/transform/Erasure.scala
  2. +8 −0 test/files/pos/t7233b.scala
View
2 src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -781,7 +781,7 @@ abstract class Erasure extends AddInterfaces
else if (tree.symbol == Any_isInstanceOf)
adaptMember(atPos(tree.pos)(Select(qual, Object_isInstanceOf)))
else if (tree.symbol.owner == AnyClass)
- adaptMember(atPos(tree.pos)(Select(qual, getMember(ObjectClass, name))))
+ adaptMember(atPos(tree.pos)(Select(qual, getMember(ObjectClass, tree.symbol.name))))
else {
var qual1 = typedQualifier(qual)
if ((isPrimitiveValueType(qual1.tpe) && !isPrimitiveValueMember(tree.symbol)) ||
View
8 test/files/pos/t7233b.scala
@@ -0,0 +1,8 @@
+object Test {
+ // crash
+ def foo(a: Any) = { import a.{toString => toS}; toS }
+
+ // okay
+ def ok1(a: String) = { import a.{isInstanceOf => iio}; iio[String] }
+ def ok2(a: Int) = { import a.{toInt => ti}; ti }
+}

0 comments on commit 41e3b89

Please sign in to comment.
Something went wrong with that request. Please try again.