summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala5
-rw-r--r--test/files/pos/bug780.scala2
2 files changed, 6 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index 1f3743c310..8357a4cb80 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -322,7 +322,10 @@ trait Contexts requires Analyzer {
(sym hasFlag PROTECTED) &&
(superAccess ||
(pre.widen.symbol.isNonBottomSubClass(sym.owner) &&
- isSubClassOfEnclosing(pre.widen.symbol))))
+ (isSubClassOfEnclosing(pre.widen.symbol) || phase.erasedTypes))))
+ // note: phase.erasedTypes disables last test, because fater addinterfaces
+ // implementation classes are not in the superclass chain. If we enable the
+ // test, bug780 fails.
}
}
diff --git a/test/files/pos/bug780.scala b/test/files/pos/bug780.scala
new file mode 100644
index 0000000000..0b4601c219
--- /dev/null
+++ b/test/files/pos/bug780.scala
@@ -0,0 +1,2 @@
+class B extends A { protected val x = false }
+trait A requires B { x }