diff options
-rwxr-xr-x | src/compiler/scala/tools/nsc/javac/JavaParsers.scala | 1 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/Erasure.scala | 12 | ||||
-rw-r--r-- | test/files/run/t0807.check | 1 | ||||
-rw-r--r-- | test/files/run/t0807.scala | 5 |
4 files changed, 15 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala index 501932e295..9bcaf4476a 100755 --- a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala +++ b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala @@ -167,7 +167,6 @@ trait JavaParsers extends JavaScanners { case _ => } } while (in.token != EOF && (nparens > 0 || nbraces > 0)) - println("Skipped: "+in) } def skipTo(tokens: Int*) { diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala index 3e738873a8..a2340da4b4 100644 --- a/src/compiler/scala/tools/nsc/transform/Erasure.scala +++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala @@ -171,8 +171,14 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer { MethodType(List(erasure(index), tvar), erasedTypeRef(UnitClass)) } else erasure(tp) - } else - transformMixinInfo(erasure(tp)); + } else { + val erased = + if (sym.isGetter && sym.tpe.isInstanceOf[MethodType]) + erasure mapOver sym.tpe // for getters, unlike for normal methods, always convert Unit to BoxedUnit. + else + erasure(tp) + transformMixinInfo(erased) + } val deconstMap = new TypeMap { def apply(tp: Type): Type = tp match { @@ -887,7 +893,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer { tree1 setType erasure(tree1.tpe) case DefDef(mods, name, tparams, vparamss, tpt, rhs) => val result = super.transform(tree1) setType null - tpt.tpe = erasure(tree.symbol.tpe).resultType + tpt.tpe = transformInfo(tree.symbol, tree.symbol.tpe).resultType result case _ => case class MyError(count : Int, ex : AssertionError) extends Error(ex.getMessage) diff --git a/test/files/run/t0807.check b/test/files/run/t0807.check new file mode 100644 index 0000000000..c862cba6b4 --- /dev/null +++ b/test/files/run/t0807.check @@ -0,0 +1 @@ +early diff --git a/test/files/run/t0807.scala b/test/files/run/t0807.scala new file mode 100644 index 0000000000..e69aa1c71c --- /dev/null +++ b/test/files/run/t0807.scala @@ -0,0 +1,5 @@ +trait A +trait B extends A { val x = println("early") } +object Test extends Application { + new B {} +} |