summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala3
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala5
-rw-r--r--test/files/pos/bug762.scala2
3 files changed, 8 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index c7a5654dc0..dcee294bb2 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -1897,6 +1897,9 @@ trait Types requires SymbolTable {
res1 <:< res2.substSym(tparams2, tparams1))
case Pair(TypeBounds(lo1, hi1), TypeBounds(lo2, hi2)) =>
lo2 <:< lo1 && hi1 <:< hi2
+ case Pair(_, TypeRef(pre2, sym2, args2))
+ if sym2.isAbstractType && !(tp2 =:= tp2.bounds.lo) && (tp1 <:< tp2.bounds.lo) =>
+ true
case Pair(BoundedWildcardType(bounds), _) =>
bounds.lo <:< tp2
case Pair(_, BoundedWildcardType(bounds)) =>
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index fe4beef15f..b2abba5934 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -192,8 +192,9 @@ abstract class RefChecks extends InfoTransform {
} else if (other.isAbstractType) {
if (!member.typeParams.isEmpty) // (1.7)
overrideError("may not be parameterized");
- if (!(self.memberInfo(other).bounds containsType self.memberType(member))) // (1.7)
- overrideTypeError();
+ if (!(self.memberInfo(other).bounds containsType self.memberType(member))) { // (1.7) {
+ overrideTypeError(); // todo: do an explaintypes with bounds here
+ }
} else if (other.isTerm) {
if (!overridesType(self.memberInfo(member), self.memberInfo(other))) { // 8
overrideTypeError();
diff --git a/test/files/pos/bug762.scala b/test/files/pos/bug762.scala
new file mode 100644
index 0000000000..76860272ea
--- /dev/null
+++ b/test/files/pos/bug762.scala
@@ -0,0 +1,2 @@
+trait Foo { type T }
+trait Bar extends Foo { val x : Foo { type T <: Bar.this.T } = this : this.type }