Skip to content

Commit 27ae379

Browse files
committed
Par back to only widening skolems and inline proxies
1 parent 7825d77 commit 27ae379

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,10 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
10071007
case tp1: MatchType =>
10081008
def compareMatch = tp2 match {
10091009
case tp2: MatchType =>
1010-
isSubType(tp1.scrutinee, tp2.scrutinee) &&
1010+
val scrutinee1 = tp1.scrutinee match
1011+
case tp: TermRef if tp.symbol.is(InlineProxy) => tp.info
1012+
case tp => tp.widenSkolem
1013+
isSameType(scrutinee1, tp2.scrutinee) &&
10111014
tp1.cases.corresponds(tp2.cases)(isSubType)
10121015
case _ => false
10131016
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
final class A
2+
final class B
3+
4+
type MT[X] = X match
5+
case A => String
6+
case B => Int
7+
8+
def test: MT[A | B] = ??? : MT[A] // error
9+
// testing that
10+
// MT[A] !<: MT[A | B]
11+
// otherwise
12+
// String <: MT[A] <: MT[A | B]
13+
// but
14+
// String !<: MT[A | B]

0 commit comments

Comments
 (0)