Skip to content

Fix subtyping of types without symbols #180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 6, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,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
Expand Down
2 changes: 1 addition & 1 deletion test/dotc/tests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class tests extends CompilerTest {
@Test def neg_t1843 = compileFile(negDir, "t1843", xerrors = 1)
@Test def neg_t1843_variances = compileFile(negDir, "t1843-variances", xerrors = 1)
@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 dotc = compileDir(dotcDir + "tools/dotc", twice)
Expand Down
9 changes: 5 additions & 4 deletions tests/neg/subtyping.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
}