Skip to content

Fix #3422: Add missing case to TypeComparer #3428

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 1 commit into from
Dec 11, 2017
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
18 changes: 11 additions & 7 deletions compiler/src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -369,14 +369,18 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
case _ =>
val cls2 = tp2.symbol
if (cls2.isClass) {
val base = tp1.baseType(cls2)
if (base.exists) {
if (cls2.is(JavaDefined))
// If `cls2` is parameterized, we are seeing a raw type, so we need to compare only the symbol
return base.typeSymbol == cls2
if (base ne tp1) return isSubType(base, tp2)
if (cls2.typeParams.nonEmpty && tp1.isHK)
isSubType(tp1, EtaExpansion(cls2.typeRef))
else {
val base = tp1.baseType(cls2)
if (base.exists) {
if (cls2.is(JavaDefined))
// If `cls2` is parameterized, we are seeing a raw type, so we need to compare only the symbol
return base.typeSymbol == cls2
if (base ne tp1) return isSubType(base, tp2)
}
if (cls2 == defn.SingletonClass && tp1.isStable) return true
}
if (cls2 == defn.SingletonClass && tp1.isStable) return true
}
fourthTry(tp1, tp2)
}
Expand Down
9 changes: 9 additions & 0 deletions tests/pos/i3422/a_1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
trait Fun[L[_]]

object O1 {
trait N[X]
}

object O2 {
def bar: Fun[O1.N] = ???
}
3 changes: 3 additions & 0 deletions tests/pos/i3422/b_2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
object Test {
def c: Fun[O1.N] = O2.bar
}