diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2005-10-18 10:04:27 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2005-10-18 10:04:27 +0000 |
commit | 0b87051d35bbf9ca3e75fdab4c13819b6a09493b (patch) | |
tree | 846bc4b7d9d187d348431a5d5e231bd611b0c4ea | |
parent | 15956fc33e4bdc8eb760fdaeaf88744065177387 (diff) | |
download | scala-0b87051d35bbf9ca3e75fdab4c13819b6a09493b.tar.gz scala-0b87051d35bbf9ca3e75fdab4c13819b6a09493b.tar.bz2 scala-0b87051d35bbf9ca3e75fdab4c13819b6a09493b.zip |
Fixed constructor calls.
-rw-r--r-- | sources/scala/tools/nsc/backend/icode/GenICode.scala | 4 | ||||
-rw-r--r-- | sources/scala/tools/nsc/backend/jvm/GenJVM.scala | 15 |
2 files changed, 16 insertions, 3 deletions
diff --git a/sources/scala/tools/nsc/backend/icode/GenICode.scala b/sources/scala/tools/nsc/backend/icode/GenICode.scala index 1b84f0250c..dd1bfa4189 100644 --- a/sources/scala/tools/nsc/backend/icode/GenICode.scala +++ b/sources/scala/tools/nsc/backend/icode/GenICode.scala @@ -604,7 +604,7 @@ abstract class GenICode extends SubComponent { var invokeStyle = if (isStaticSymbol(sym)) Static(false) - else if (sym hasFlag Flags.PRIVATE) + else if (sym.hasFlag(Flags.PRIVATE) || sym.isClassConstructor) Static(true) else Dynamic; @@ -617,7 +617,7 @@ abstract class GenICode extends SubComponent { ctx1 = genLoadArguments(args, fun.symbol.info.paramTypes, ctx1); ctx1.bb.emit(CALL_METHOD(sym, invokeStyle), tree.pos); - generatedType = toTypeKind(sym.info.resultType); + generatedType = if (sym.isClassConstructor) UNIT else toTypeKind(sym.info.resultType); ctx1 } diff --git a/sources/scala/tools/nsc/backend/jvm/GenJVM.scala b/sources/scala/tools/nsc/backend/jvm/GenJVM.scala index 971fff3eda..5416e42abd 100644 --- a/sources/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/sources/scala/tools/nsc/backend/jvm/GenJVM.scala @@ -695,12 +695,25 @@ abstract class GenJVM extends SubComponent { /** Return the a name of this symbol that can be used on the Java * platform. It removes spaces from names. + * + * Special handling: scala.All and scala.AllRef are 'erased' to + * scala.All$ and scala.AllRef$. This is needed because they are + * not real classes, and they mean 'abrupt termination upon evaluation + * of that expression' or 'null' respectively. This handling is + * done already in GenICode, but here we need to remove references + * from method signatures to these types, because such classes can + * not exist in the classpath: the type checker will be very confused. */ - def javaName(sym: Symbol) = { + def javaName(sym: Symbol): String = { val suffix = if (sym.hasFlag(Flags.MODULE) && !sym.isMethod && !sym.isImplClass && !sym.hasFlag(Flags.JAVA)) "$" else ""; + if (sym == definitions.AllClass) + return "scala.All$" + else if (sym == definitions.AllRefClass) + return "scala.AllRef$"; + (if (sym.isClass || (sym.isModule && !sym.isMethod)) sym.fullNameString('/') else |