summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Symbols.scala5
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala1
-rw-r--r--test/files/neg/t0259.check7
-rw-r--r--test/files/neg/t0259.scala6
-rw-r--r--test/files/pos/t0273.scala4
-rw-r--r--test/pending/pos/t0288/Foo.scala9
-rw-r--r--test/pending/pos/t0288/Outer.java9
7 files changed, 40 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) &&
diff --git a/test/files/neg/t0259.check b/test/files/neg/t0259.check
new file mode 100644
index 0000000000..8c6ce1d269
--- /dev/null
+++ b/test/files/neg/t0259.check
@@ -0,0 +1,7 @@
+t0259.scala:4: error: double definition:
+constructor TestCase3:(String*)test.TestCase3 and
+constructor TestCase3:((String, Int)*)test.TestCase3 at line 3
+have same type after erasure: (Seq)test.TestCase3
+ def this( groups: String*) = this()
+ ^
+one error found
diff --git a/test/files/neg/t0259.scala b/test/files/neg/t0259.scala
new file mode 100644
index 0000000000..0975dec58e
--- /dev/null
+++ b/test/files/neg/t0259.scala
@@ -0,0 +1,6 @@
+package test;
+class TestCase3() {
+ def this( groups: (String, Int)*) = this()
+ def this( groups: String*) = this()
+}
+object Main extends TestCase3 with Application
diff --git a/test/files/pos/t0273.scala b/test/files/pos/t0273.scala
new file mode 100644
index 0000000000..de94829e8b
--- /dev/null
+++ b/test/files/pos/t0273.scala
@@ -0,0 +1,4 @@
+object Test {
+def a = () => ()
+def a[T] = (p:A) => ()
+}
diff --git a/test/pending/pos/t0288/Foo.scala b/test/pending/pos/t0288/Foo.scala
new file mode 100644
index 0000000000..778ba65f58
--- /dev/null
+++ b/test/pending/pos/t0288/Foo.scala
@@ -0,0 +1,9 @@
+package test2;
+
+import test.Outer;
+
+class Foo extends Outer{
+
+ val bar = new Inner(); // Shouldn't this work?
+
+}
diff --git a/test/pending/pos/t0288/Outer.java b/test/pending/pos/t0288/Outer.java
new file mode 100644
index 0000000000..bea3e3f8d0
--- /dev/null
+++ b/test/pending/pos/t0288/Outer.java
@@ -0,0 +1,9 @@
+package test;
+
+public class Outer{
+
+ public class Inner{
+
+ }
+
+}