summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala2
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala7
-rw-r--r--test/files/neg/bug588.check8
-rwxr-xr-xtest/files/pos/bug439.scala4
4 files changed, 13 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index da135674a1..c6569088d0 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -341,7 +341,7 @@ class Global(val settings: Settings, val reporter: Reporter) extends SymbolTable
inliner,
closser,
genJVM,
- sampleTransform);
+ sampleTransform)
protected def insertBefore(c: SubComponent, cs: List[SubComponent], before: SubComponent): List[SubComponent] = cs match {
case List() => List(c)
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index 0b3c16e56d..18b6cd0a01 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -1671,6 +1671,7 @@ trait Types requires SymbolTable {
/** Does member `sym1' of `tp1' have a stronger type than member `sym2' of `tp2'? */
private def specializesSym(tp1: Type, sym1: Symbol, tp2: Type, sym2: Symbol): boolean = {
+// System.out.println("specializes " + tp1 + " " + tp2)//DEBUG
val info1 = tp1.memberInfo(sym1);
val info2 = tp2.memberInfo(sym2).substThis(tp2.symbol, tp1);
(sym2.isTerm &&
@@ -1886,9 +1887,9 @@ trait Types requires SymbolTable {
((t, sym) => t.memberInfo(sym).substThis(t.symbol, lubThisType)));
if (settings.debug.value) log("common symbols: " + syms + ":" + symtypes);//debug
if (proto.isTerm)
- proto.cloneSymbol.setInfo(lub(symtypes))
+ proto.cloneSymbol(lubType.symbol).setInfo(lub(symtypes))
else if (symtypes.tail forall (symtypes.head =:=))
- proto.cloneSymbol.setInfo(symtypes.head)
+ proto.cloneSymbol(lubType.symbol).setInfo(symtypes.head)
else {
def lubBounds(bnds: List[TypeBounds]): TypeBounds =
TypeBounds(glb(bnds map (.lo)), lub(bnds map (.hi)));
@@ -1955,7 +1956,7 @@ trait Types requires SymbolTable {
glbThisType.memberInfo(alt) matches prototp) yield alt;
val symtypes = syms map glbThisType.memberInfo;
assert(!symtypes.isEmpty);
- proto.cloneSymbol.setInfo(
+ proto.cloneSymbol(glbType.symbol).setInfo(
if (proto.isTerm) glb(symtypes)
else {
def isTypeBound(tp: Type) = tp match {
diff --git a/test/files/neg/bug588.check b/test/files/neg/bug588.check
index 02a9b9c482..2529c23772 100644
--- a/test/files/neg/bug588.check
+++ b/test/files/neg/bug588.check
@@ -1,13 +1,13 @@
-/home/odersky/scala/test/files/pos/bug588.scala:3 error: double definition:
+bug588.scala:3 error: double definition:
method visit:((scala.Int) => java.lang.String)scala.Boolean and
method visit:((scala.Int) => scala.Unit)scala.Boolean at line 2
have same type after erasure: (scala.Function1)scala.Boolean
- def visit(f: int => String): boolean
+ def visit(f: int => String): boolean
^
-/home/odersky/scala/test/files/pos/bug588.scala:10 error: double definition:
+bug588.scala:10 error: double definition:
method f:(Test.this.TypeB)scala.Unit and
method f:(Test.this.TypeA)scala.Unit at line 9
have same type after erasure: (Test#TraitA)scala.Unit
- def f(brac : TypeB) : Unit;
+ def f(brac : TypeB) : Unit;
^
two errors found
diff --git a/test/files/pos/bug439.scala b/test/files/pos/bug439.scala
new file mode 100755
index 0000000000..f3191c72fa
--- /dev/null
+++ b/test/files/pos/bug439.scala
@@ -0,0 +1,4 @@
+object test {
+ abstract class Foo;
+ object o extends Foo
+}