File tree 2 files changed +10
-10
lines changed
compiler/src/dotty/tools/dotc/core
2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -255,18 +255,11 @@ trait PatternTypeConstrainer { self: TypeComparer =>
255
255
tyconS.typeParams.lazyZip(argsS).lazyZip(argsP).forall { (param, argS, argP) =>
256
256
val variance = param.paramVarianceSign
257
257
if variance != 0 && ! assumeInvariantRefinement then true
258
- else if argS.isInstanceOf [TypeBounds ] || argP.isInstanceOf [TypeBounds ] then
259
- // This line was added here as a quick fix for issue #13998,
260
- // to extract GADT constraints from wildcard type arguments.
261
- // The proper fix would involve inspecting the bounds right here and performing the
262
- // correct subtyping checks, the ones that are already performed by `isSubType` below,
263
- // for the same reasons for which we stopped using `SkolemType` here to begin with
264
- // (commit 10fe5374dc2d).
265
- isSubType(SkolemType (patternTp), scrutineeTp)
266
258
else {
259
+ val TypeBounds (loS, hiS) = argS.bounds
267
260
var res = true
268
- if variance < 1 then res &&= isSubType(argS , argP)
269
- if variance > - 1 then res &&= isSubType(argP, argS )
261
+ if variance < 1 then res &&= isSubType(loS , argP)
262
+ if variance > - 1 then res &&= isSubType(argP, hiS )
270
263
res
271
264
}
272
265
}
Original file line number Diff line number Diff line change
1
+ class Box [V ](val value : V )
2
+
3
+ class Test :
4
+ def value : Box [" text" ] = Box (" text" )
5
+
6
+ def test : String = value match
7
+ case b : Box [_ <: String ] => b.value
You can’t perform that action at this time.
0 commit comments