File tree Expand file tree Collapse file tree 3 files changed +57
-9
lines changed
compiler/src/dotty/tools/dotc/core
neg-custom-args/allow-deep-subtypes Expand file tree Collapse file tree 3 files changed +57
-9
lines changed Original file line number Diff line number Diff line change @@ -4109,18 +4109,17 @@ object Types {
41094109
41104110 override def underlying (using Context ): Type = tycon
41114111
4112- override def superType (using Context ): Type = {
4113- if (ctx.period != validSuper) {
4114- cachedSuper = tycon match {
4112+ override def superType (using Context ): Type =
4113+ if ctx.period != validSuper then
4114+ validSuper = if (tycon.isProvisional) Nowhere else ctx.period
4115+ cachedSuper = tycon match
41154116 case tycon : HKTypeLambda => defn.AnyType
41164117 case tycon : TypeRef if tycon.symbol.isClass => tycon
4117- case tycon : TypeProxy => tycon.superType.applyIfParameterized(args)
4118+ case tycon : TypeProxy =>
4119+ if isMatchAlias then validSuper = Nowhere
4120+ tycon.superType.applyIfParameterized(args).normalized
41184121 case _ => defn.AnyType
4119- }
4120- validSuper = if (tycon.isProvisional) Nowhere else ctx.period
4121- }
41224122 cachedSuper
4123- }
41244123
41254124 override def translucentSuperType (using Context ): Type = tycon match {
41264125 case tycon : TypeRef if tycon.symbol.isOpaqueAlias =>
Original file line number Diff line number Diff line change 1- type *: [A , B ] = A match
1+ type *: [A , B ] = A match // error: Recursion limit exceeded.
22 case (B *: x) => A
33 case (x *: y) => x *: (B *: y)
44 case _ => A *: B
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments