File tree 2 files changed +19
-1
lines changed
compiler/src/dotty/tools/dotc/core
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -3095,7 +3095,7 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
3095
3095
def paramInstances (canApprox : Boolean ) = new TypeAccumulator [Array [Type ]]:
3096
3096
def apply (insts : Array [Type ], t : Type ) = t match
3097
3097
case param @ TypeParamRef (b, n) if b eq caseLambda =>
3098
- def range1 (tp : Type ) = Range (tp, tp)
3098
+ def range1 (tp : Type ) = if variance == 0 then tp else Range (tp, tp)
3099
3099
insts(n) =
3100
3100
if canApprox then
3101
3101
approximation(param, fromBelow = variance >= 0 , Int .MaxValue ).simplified
Original file line number Diff line number Diff line change
1
+ type Ext1 [S ] = S match {
2
+ case Seq [t] => t
3
+ }
4
+ type Ext2 [S ] = S match {
5
+ case Seq [_] => Int
6
+ }
7
+ type Ext3 [S ] = S match {
8
+ case Array [t] => t
9
+ }
10
+ type Ext4 [S ] = S match {
11
+ case Array [_] => Int
12
+ }
13
+ def foo [T <: Seq [Any ], A <: Array [B ], B ] =
14
+ summon[Ext1 [T ] =:= T ] // error
15
+ summon[Ext2 [T ] =:= Int ] // ok
16
+ summon[Ext3 [A ] =:= B ] // ok
17
+ summon[Ext4 [A ] =:= Int ] // ok
18
+
You can’t perform that action at this time.
0 commit comments