diff options
author | Hubert Plociniczak <hubert.plociniczak@epfl.ch> | 2011-02-08 12:12:42 +0000 |
---|---|---|
committer | Hubert Plociniczak <hubert.plociniczak@epfl.ch> | 2011-02-08 12:12:42 +0000 |
commit | 496dc761189182e04c424750ba63077d62dcf78b (patch) | |
tree | fe4779705256de274120dce0da66f5b2dcfb20e6 /src | |
parent | 75fe0c8bd628df9abbc6a90b5046757b48538294 (diff) | |
download | scala-496dc761189182e04c424750ba63077d62dcf78b.tar.gz scala-496dc761189182e04c424750ba63077d62dcf78b.tar.bz2 scala-496dc761189182e04c424750ba63077d62dcf78b.zip |
Closes #3986 plus some cleanup. no review
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/Constructors.scala | 4 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/util/SourceFile.scala | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala index e7325c4f18..e106ee04be 100644 --- a/src/compiler/scala/tools/nsc/transform/Constructors.scala +++ b/src/compiler/scala/tools/nsc/transform/Constructors.scala @@ -170,7 +170,9 @@ abstract class Constructors extends Transform with ast.TreeDSL { val fields = presupers filter ( vdef => nme.localToGetter(vdef.name) == name) assert(fields.length == 1) - constrStatBuf += mkAssign(fields.head.symbol, Ident(stat.symbol)) + val to = fields.head.symbol + if (!to.tpe.isInstanceOf[ConstantType]) + constrStatBuf += mkAssign(to, Ident(stat.symbol)) case _ => } } diff --git a/src/compiler/scala/tools/nsc/util/SourceFile.scala b/src/compiler/scala/tools/nsc/util/SourceFile.scala index ca4559d717..90a9057f01 100644 --- a/src/compiler/scala/tools/nsc/util/SourceFile.scala +++ b/src/compiler/scala/tools/nsc/util/SourceFile.scala @@ -46,7 +46,7 @@ abstract class SourceFile { final def skipWhitespace(offset: Int): Int = if (content(offset).isWhitespace) skipWhitespace(offset + 1) else offset - def identifier(pos: Position, compiler: Global): Option[String] = None + def identifier(pos: Position): Option[String] = None } object ScriptSourceFile { @@ -101,12 +101,12 @@ class BatchSourceFile(val file : AbstractFile, val content: Array[Char]) extends def start = 0 def isSelfContained = true - override def identifier(pos: Position, compiler: Global) = + override def identifier(pos: Position) = if (pos.isDefined && pos.source == this && pos.point != -1) { def isOK(c: Char) = isIdentifierPart(c) || isOperatorPart(c) Some(new String(content drop pos.point takeWhile isOK)) } else { - super.identifier(pos, compiler) + super.identifier(pos) } def isLineBreak(idx: Int) = |