From 57ac948b1bb9240e26b7d4419ef0433a7eaa1c86 Mon Sep 17 00:00:00 2001 From: Iulian Dragos Date: Thu, 18 Jun 2009 16:03:47 +0000 Subject: Small fixes in code generation for interface ca... Small fixes in code generation for interface calls. --- src/compiler/scala/tools/nsc/backend/icode/GenICode.scala | 4 ++-- src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index 564d4ea36b..134c0e3999 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -610,7 +610,7 @@ abstract class GenICode extends SubComponent { ctx1.bb.emit(CONSTANT(Constant(false))) } else if (r.isValueType && cast) { - assert(false) /* Erasure should have added an unboxing operation to prevent that. */ + assert(false, tree) /* Erasure should have added an unboxing operation to prevent that. */ } else if (r.isValueType) ctx.bb.emit(IS_INSTANCE(REFERENCE(definitions.boxedClass(r.toType.typeSymbol)))) @@ -651,7 +651,7 @@ abstract class GenICode extends SubComponent { assert(ctor.isClassConstructor, "'new' call to non-constructor: " + ctor.name) - generatedType = toTypeKind(fun.tpe.resultType) + generatedType = toTypeKind(tpt.tpe) if (settings.debug.value) assert(generatedType.isReferenceType || generatedType.isArrayType, "Non reference type cannot be instantiated: " + generatedType) diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala index ef2d98a053..9d33585ff2 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala @@ -1700,7 +1700,12 @@ abstract class GenJVM extends SubComponent { /** Calls to methods in 'sym' need invokeinterface? */ def needsInterfaceCall(sym: Symbol): Boolean = { - sym.info // needed so that the type is up to date (erasure may add lateINTERFACE to traits) + log("checking for interface call: " + sym.fullNameString) + // the following call to 'info' may cause certain symbols to fail loading because we're + // too late in the compilation chain (aliases to overloaded symbols will not be properly + // resolved, see scala.Range, method super$++ that fails in UnPickler at LazyTypeRefAndAlias.complete + if (sym.isTrait) sym.info // needed so that the type is up to date (erasure may add lateINTERFACE to traits) + sym.hasFlag(Flags.INTERFACE) || (sym.hasFlag(Flags.JAVA) && sym.isNonBottomSubClass(definitions.ClassfileAnnotationClass)) -- cgit v1.2.3