diff options
author | Paul Phillips <paulp@improving.org> | 2009-02-22 20:33:43 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-02-22 20:33:43 +0000 |
commit | a187f432f712734d00504e8250955272220eb418 (patch) | |
tree | b05903a93383f858d945f7493abbcb8da487bf5f /src | |
parent | 9c0ac8b712db643f83c73b0bfbb1543a5a61f984 (diff) | |
download | scala-a187f432f712734d00504e8250955272220eb418.tar.gz scala-a187f432f712734d00504e8250955272220eb418.tar.bz2 scala-a187f432f712734d00504e8250955272220eb418.zip |
When inferring a type is scala.Whatever, have t...
When inferring a type is scala.Whatever, have to take care to _root_
qualify it so a package named scala doesn't subvert it. Fixes #430.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 10 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala | 3 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index e4a042325c..12af98f91d 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -892,7 +892,7 @@ trait Parsers extends NewScanners with MarkupParsers { if (inToken == ARROW) atPos(inSkipToken) { AppliedTypeTree( - scalaDot(nme.BYNAME_PARAM_CLASS_NAME.toTypeName), List(typ())) + rootScalaDot(nme.BYNAME_PARAM_CLASS_NAME.toTypeName), List(typ())) } else { val t = typ() @@ -900,7 +900,7 @@ trait Parsers extends NewScanners with MarkupParsers { inNextToken atPos(t.pos) { AppliedTypeTree( - scalaDot(nme.REPEATED_PARAM_CLASS_NAME.toTypeName), List(t)) + rootScalaDot(nme.REPEATED_PARAM_CLASS_NAME.toTypeName), List(t)) } } else t } @@ -1762,7 +1762,7 @@ trait Parsers extends NewScanners with MarkupParsers { if (inToken == ARROW) atPos(inSkipToken) { AppliedTypeTree( - scalaDot(nme.BYNAME_PARAM_CLASS_NAME.toTypeName), List(typ())) + rootScalaDot(nme.BYNAME_PARAM_CLASS_NAME.toTypeName), List(typ())) } else { val t = typ() @@ -1770,7 +1770,7 @@ trait Parsers extends NewScanners with MarkupParsers { inNextToken atPos(t.pos) { AppliedTypeTree( - scalaDot(nme.REPEATED_PARAM_CLASS_NAME.toTypeName), List(t)) + rootScalaDot(nme.REPEATED_PARAM_CLASS_NAME.toTypeName), List(t)) } } else t } @@ -1832,7 +1832,7 @@ trait Parsers extends NewScanners with MarkupParsers { def bound(tok: Int, default: Name): Tree = if (inToken == tok) { inNextToken; typ() } - else scalaDot(default.toTypeName) + else rootScalaDot(default.toTypeName) /* -------- DEFS ------------------------------------------- */ diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala index c52e514119..8e8875121c 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala @@ -18,6 +18,9 @@ abstract class TreeBuilder { def freshName(pos : Position, prefix: String): Name def freshName(pos : Position): Name = freshName(pos, "x$") + def rootId(name: Name) = Select(Ident(nme.ROOTPKG), name) + def rootScalaDot(name: Name): Tree = Select(rootId(nme.scala_) setSymbol definitions.ScalaPackage, name) + def scalaDot(name: Name): Tree = Select(Ident(nme.scala_) setSymbol definitions.ScalaPackage, name) def scalaAnyRefConstr: Tree = |