From 28a1d779aa8e720c051890efeb711bef72528573 Mon Sep 17 00:00:00 2001 From: Iulian Dragos Date: Tue, 1 May 2007 12:14:47 +0000 Subject: Fixed #1077 by not mangling private constructor... Fixed #1077 by not mangling private constructor names. --- src/compiler/scala/tools/nsc/backend/icode/GenICode.scala | 6 ++++-- src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala | 4 +++- src/compiler/scala/tools/nsc/symtab/Symbols.scala | 7 +++---- 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'src/compiler') diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index a33a820e05..85ebce3d1a 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -622,7 +622,7 @@ abstract class GenICode extends SubComponent { case Apply(fun @ Select(New(tpt), nme.CONSTRUCTOR), args) => val ctor = fun.symbol assert(ctor.isClassConstructor, - "'new' call to non-constructor: " + tree) + "'new' call to non-constructor: " + ctor.name) generatedType = toTypeKind(tpt.tpe) assert(generatedType.isReferenceType || generatedType.isArrayType, @@ -951,7 +951,9 @@ abstract class GenICode extends SubComponent { ctx1.bb.close afterCtx - case EmptyTree => ctx + case EmptyTree => + ctx.bb.emit(getZeroOf(expectedType)) + ctx case _ => abort("Unexpected tree in genLoad: " + tree + " at: " + diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala index 41b7db1e18..14ba2de049 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala @@ -1326,7 +1326,9 @@ abstract class GenJVM extends SubComponent { jf = jf | (if ((sym hasFlag Flags.ABSTRACT) || (sym hasFlag Flags.DEFERRED)) ACC_ABSTRACT else 0) jf = jf | (if (sym hasFlag Flags.INTERFACE) ACC_INTERFACE else 0) - jf = jf | (if ((sym hasFlag Flags.FINAL) && !sym.enclClass.hasFlag(Flags.INTERFACE)) ACC_FINAL else 0) + jf = jf | (if ((sym hasFlag Flags.FINAL) + && !sym.enclClass.hasFlag(Flags.INTERFACE) + && !sym.isClassConstructor) ACC_FINAL else 0) jf = jf | (if (isStaticSymbol(sym)) ACC_STATIC else 0) jf = jf | (if (sym hasFlag Flags.SYNTHETIC) ACC_SYNTHETIC else 0) jf diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala index 19f8773853..8b01a58feb 100644 --- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala +++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala @@ -357,7 +357,7 @@ trait Symbols { */ def originalName = nme.originalName(name) - final def flags = { + final def flags: long = { val fs = rawflags & phase.flagMask (fs | ((fs & LateFlags) >>> LateShift)) & ~(fs >>> AntiShift) } @@ -858,7 +858,7 @@ trait Symbols { if (this hasFlag PRIVATE) { setFlag(notPRIVATE) if (!hasFlag(DEFERRED) && isTerm) setFlag(lateFINAL) - if (!isStaticModule) { + if (!isStaticModule && !isClassConstructor) { expandName(base) if (isModule) moduleClass.makeNotPrivate(base) } @@ -883,8 +883,7 @@ trait Symbols { /** The expanded name of `name' relative to this class as base */ def expandedName(name: Name): Name = { - - newTermName(fullNameString('$') + nme.EXPAND_SEPARATOR_STRING + name) + newTermName(fullNameString('$') + nme.EXPAND_SEPARATOR_STRING + name) } def sourceFile: AbstractFile = -- cgit v1.2.3