File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 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 =>
255255 tyconS.typeParams.lazyZip(argsS).lazyZip(argsP).forall { (param, argS, argP) =>
256256 val variance = param.paramVarianceSign
257257 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)
266258 else {
259+ val TypeBounds (loS, hiS) = argS.bounds
267260 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 )
270263 res
271264 }
272265 }
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