File tree 3 files changed +56
-12
lines changed
compiler/src/dotty/tools/dotc/core
3 files changed +56
-12
lines changed Original file line number Diff line number Diff line change @@ -4105,18 +4105,17 @@ object Types {
4105
4105
4106
4106
override def underlying (using Context ): Type = tycon
4107
4107
4108
- override def superType (using Context ): Type = {
4109
- if (ctx.period != validSuper) {
4110
- cachedSuper = tycon match {
4108
+ override def superType (using Context ): Type =
4109
+ if ctx.period != validSuper then
4110
+ validSuper = if (tycon.isProvisional) Nowhere else ctx.period
4111
+ cachedSuper = tycon match
4111
4112
case tycon : HKTypeLambda => defn.AnyType
4112
4113
case tycon : TypeRef if tycon.symbol.isClass => tycon
4113
- case tycon : TypeProxy => tycon.superType.applyIfParameterized(args)
4114
+ case tycon : TypeProxy =>
4115
+ if isMatchAlias then validSuper = Nowhere
4116
+ tycon.superType.applyIfParameterized(args).normalized
4114
4117
case _ => defn.AnyType
4115
- }
4116
- validSuper = if (tycon.isProvisional) Nowhere else ctx.period
4117
- }
4118
4118
cachedSuper
4119
- }
4120
4119
4121
4120
override def translucentSuperType (using Context ): Type = tycon match {
4122
4121
case tycon : TypeRef if tycon.symbol.isOpaqueAlias =>
Load Diff This file was deleted.
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