aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/core/TypeComparer.scala2
-rw-r--r--test/dotc/tests.scala2
-rw-r--r--tests/neg/subtyping.scala9
3 files changed, 7 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala
index dcd8af3b6..5261f7dcf 100644
--- a/src/dotty/tools/dotc/core/TypeComparer.scala
+++ b/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -450,7 +450,7 @@ class TypeComparer(initctx: Context) extends DotClass {
tp1 match {
case tp1: NamedType =>
val sym1 = tp1.symbol
- (if (sym1 eq tp2.symbol) (
+ (if ((sym1 ne NoSymbol) && (sym1 eq tp2.symbol)) (
ctx.erasedTypes
|| sym1.isStaticOwner
|| { // Implements: A # X <: B # X
diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala
index 519fa35ce..71a1600bb 100644
--- a/test/dotc/tests.scala
+++ b/test/dotc/tests.scala
@@ -95,7 +95,7 @@ class tests extends CompilerTest {
@Test def neg_t1843_variances = compileFile(negDir, "t1843-variances", xerrors = 1)
@Test def neg_t2660_ambi = compileFile(negDir, "t2660", xerrors = 2)
@Test def neg_t2994 = compileFile(negDir, "t2994", xerrors = 2)
- @Test def neg_subtyping = compileFile(negDir, "subtyping", xerrors = 1)
+ @Test def neg_subtyping = compileFile(negDir, "subtyping", xerrors = 2)
@Test def neg_variances = compileFile(negDir, "variances", xerrors = 2)
@Test def neg_badAuxConstr = compileFile(negDir, "badAuxConstr", xerrors = 2)
@Test def neg_typetest = compileFile(negDir, "typetest", xerrors = 1)
diff --git a/tests/neg/subtyping.scala b/tests/neg/subtyping.scala
index d7f849ddc..a4a5a3d19 100644
--- a/tests/neg/subtyping.scala
+++ b/tests/neg/subtyping.scala
@@ -4,10 +4,11 @@ class B {
class A extends B
object Test {
- def foo(a: A#X): Unit = {
- return;
+ def test1(): Unit = {
+ implicitly[B#X <:< A#X]
}
- def test(): Unit = {
- foo(??? : B#X);
+ def test2(): Unit = {
+ val a : { type T; type U } = ???
+ implicitly[a.T <:< a.U]
}
}