summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-12-21 17:52:05 +0000
committerMartin Odersky <odersky@gmail.com>2007-12-21 17:52:05 +0000
commit4e45e9e07b15c77bf9091574fd4c80f751e9e407 (patch)
tree24ff461f07348456f0bd6dc2e30ea9a3ba94dbf6 /src
parent5fbcd57e9651bc9ad8cf28bef4c299b597ca03b6 (diff)
downloadscala-4e45e9e07b15c77bf9091574fd4c80f751e9e407.tar.gz
scala-4e45e9e07b15c77bf9091574fd4c80f751e9e407.tar.bz2
scala-4e45e9e07b15c77bf9091574fd4c80f751e9e407.zip
fixed #283 #289
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Symbols.scala5
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala1
2 files changed, 5 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
index 7ab287383a..1d469a9f6d 100644
--- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
@@ -85,6 +85,8 @@ trait Symbols {
var attributes: List[AnnotationInfo] = List()
+ def setAttributes(attrs: List[AnnotationInfo]): this.type = { this.attributes = attrs; this }
+
/** Does this symbol have an attribute of the given class? */
def hasAttribute(cls: Symbol): Boolean =
attributes.exists {
@@ -709,7 +711,8 @@ trait Symbols {
/** A clone of this symbol, but with given owner */
final def cloneSymbol(owner: Symbol): Symbol =
- cloneSymbolImpl(owner).setInfo(info.cloneInfo(this)).setFlag(this.rawflags)
+ cloneSymbolImpl(owner).setInfo(info.cloneInfo(this))
+ .setFlag(this.rawflags).setAttributes(this.attributes)
/** Internal method to clone a symbol's implementation without flags or type
*/
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 1ae4eced0e..b945f48d98 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -796,6 +796,7 @@ trait Namers { self: Analyzer =>
val expr1 = typer.typedQualifier(expr)
val base = expr1.tpe
typer.checkStable(expr1)
+ if (expr1.symbol.isRootPackage) context.error(tree.pos, "_root_ cannot be imported")
def checkNotRedundant(pos: Position, from: Name, to: Name): Boolean = {
if (!tree.symbol.hasFlag(SYNTHETIC) &&
!((expr1.symbol ne null) && expr1.symbol.isInterpreterWrapper) &&