File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -256,12 +256,7 @@ trait PatternTypeConstrainer { self: TypeComparer =>
256
256
val variance = param.paramVarianceSign
257
257
if variance != 0 && ! assumeInvariantRefinement then true
258
258
else if argS.isInstanceOf [TypeBounds ] || argP.isInstanceOf [TypeBounds ] then
259
- // Passing TypeBounds to isSubType on LHS or RHS does the
260
- // incorrect thing and infers unsound constraints, while simply
261
- // returning true is sound. However, I believe that it should
262
- // still be possible to extract useful constraints here.
263
- // TODO extract GADT information out of wildcard type arguments
264
- true
259
+ isSubType(SkolemType (patternTp), scrutineeTp)
265
260
else {
266
261
var res = true
267
262
if variance < 1 then res &&= isSubType(argS, argP)
Original file line number Diff line number Diff line change
1
+ case class Box [V ](value : V )
2
+ object Box :
3
+ def apply [A ](a : A ): Box [A ] = new Box [A ](a)
4
+ def unapply [U ](b : Box [U ]): Box [U ] = b
5
+
6
+ class Test :
7
+ def value : Box [_ <: String ] = Box (" text" )
8
+
9
+ def test : String = value match
10
+ case Box (text) => text : String
You can’t perform that action at this time.
0 commit comments