summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-02-04 22:15:04 -0800
committerPaul Phillips <paulp@improving.org>2012-02-04 22:15:04 -0800
commit1af71c9191d6b8d73a21e5a4bd86a7e8c2511810 (patch)
treeb91312b3327344f905f05b25ee6131ac36c7febd /src/compiler
parent732a080fcb84abf35b599b518849ec421cc9cbd1 (diff)
downloadscala-1af71c9191d6b8d73a21e5a4bd86a7e8c2511810.tar.gz
scala-1af71c9191d6b8d73a21e5a4bd86a7e8c2511810.tar.bz2
scala-1af71c9191d6b8d73a21e5a4bd86a7e8c2511810.zip
Hardened/documented AnyVal constructor switcheroo.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/AddInterfaces.scala1
2 files changed, 3 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index 97c264fa4b..c2b4dc32b6 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -2754,6 +2754,8 @@ self =>
val tstart0 = if (body.isEmpty && in.lastOffset < tstart) in.lastOffset else tstart
atPos(tstart0) {
if (inScalaPackage && name == tpnme.AnyVal) {
+ // Not a well-formed constructor, has to be finished later - see note
+ // regarding AnyVal constructor in AddInterfaces.
val constructor = DefDef(NoMods, nme.CONSTRUCTOR, Nil, List(Nil), TypeTree(), Block(Nil, Literal(Constant())))
Template(parents0, self, constructor :: body)
}
diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
index 971a0c9aab..e7759f1d7e 100644
--- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
+++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
@@ -309,6 +309,7 @@ abstract class AddInterfaces extends InfoTransform {
stats span (t => t.hasSymbolWhich(_ hasFlag PRESUPER))
treeCopy.Block(tree, presuper ::: (supercall :: mixinConstructorCalls ::: rest), expr)
case (Nil, Nil) =>
+ assert(clazz eq AnyValClass, clazz)
// AnyVal constructor - have to provide a real body so the
// jvm doesn't throw a VerifyError. But we can't add the
// body until now, because the typer knows that Any has no