Skip to content

Commit 6972e06

Browse files
Fix #10867: Normalize after applyIfParameterized in superType
1 parent 72e746a commit 6972e06

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -4110,7 +4110,7 @@ object Types {
41104110
cachedSuper = tycon match {
41114111
case tycon: HKTypeLambda => defn.AnyType
41124112
case tycon: TypeRef if tycon.symbol.isClass => tycon
4113-
case tycon: TypeProxy => tycon.superType.applyIfParameterized(args)
4113+
case tycon: TypeProxy => tycon.superType.applyIfParameterized(args).normalized
41144114
case _ => defn.AnyType
41154115
}
41164116
validSuper = if (tycon.isProvisional) Nowhere else ctx.period

tests/pos/10867.scala

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
object Test {
2+
type inserts[a, as <: Tuple] <: Tuple =
3+
as match
4+
case EmptyTuple => (a *: EmptyTuple) *: EmptyTuple
5+
case y *: ys => (a *: y *: ys) *: Tuple.Map[inserts[a, ys], [t <: Tuple] =>> y *: t]
6+
7+
type inserts2[a] =
8+
[as <: Tuple] =>> inserts[a, as]
9+
10+
type A = inserts [1, EmptyTuple]
11+
type B = inserts2[1][EmptyTuple]
12+
13+
summon[A =:= ((1 *: EmptyTuple) *: EmptyTuple)]
14+
summon[B =:= ((1 *: EmptyTuple) *: EmptyTuple)]
15+
summon[A =:= B]
16+
17+
type H[t <: Tuple] = Tuple.Concat[t, EmptyTuple]
18+
19+
summon[H[A] =:= H[B]]
20+
21+
summon[Tuple.Concat[A, EmptyTuple] =:= Tuple.Concat[B, EmptyTuple]]
22+
}
23+
24+
object Minimized {
25+
type Concombre[X <: Tuple, +Y <: Tuple] <: Tuple = X match {
26+
case EmptyTuple => Y
27+
case x1 *: xs1 => X
28+
}
29+
30+
type inserts[a, as <: Tuple] <: Tuple =
31+
as match
32+
case EmptyTuple => a *: EmptyTuple
33+
34+
type inserts2[a] =
35+
[as <: Tuple] =>> inserts[a, as]
36+
37+
type A = inserts [1, EmptyTuple]
38+
type B = inserts2[1][EmptyTuple]
39+
type C = 1 *: EmptyTuple
40+
41+
summon[A =:= B]
42+
summon[A =:= C]
43+
summon[B =:= C]
44+
45+
type H[t <: Tuple] = Concombre[t, EmptyTuple]
46+
47+
summon[H[C] =:= H[A]]
48+
summon[H[C] =:= H[B]]
49+
}

0 commit comments

Comments
 (0)