Skip to content

Commit c3d23fe

Browse files
Only trust isSameType for fully instanciated types
1 parent b0c1e7b commit c3d23fe

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

compiler/src/dotty/tools/dotc/core/TypeComparer.scala

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1973,7 +1973,21 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] {
19731973
// instantiated to `Any` belongs to both types.
19741974
true
19751975
else
1976-
isSameType(arg1, arg2) // TODO: handle uninstanciated types
1976+
isSameType(arg1, arg2) || {
1977+
// We can only trust a "no" from `isSameType` when both
1978+
// `arg1` and `arg2` are fully instantiated.
1979+
val fullyInstantiated = new TypeAccumulator[Boolean] {
1980+
override def apply(x: Boolean, t: Type) =
1981+
x && {
1982+
t match {
1983+
case _: SkolemType | _: TypeVar | _: TypeParamRef => false
1984+
case _ => foldOver(x, t)
1985+
}
1986+
}
1987+
}
1988+
!(fullyInstantiated.apply(true, arg1) &&
1989+
fullyInstantiated.apply(true, arg2))
1990+
}
19771991
}
19781992
case (tp1: HKLambda, tp2: HKLambda) =>
19791993
intersecting(tp1.resType, tp2.resType)

0 commit comments

Comments
 (0)