File tree 2 files changed +15
-1
lines changed
compiler/src/dotty/tools/dotc/transform
2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -256,7 +256,8 @@ object TypeTestsCasts {
256
256
else foundClasses.exists(check)
257
257
end checkSensical
258
258
259
- if (expr.tpe <:< testType) && inMatch then
259
+ val tp = if expr.tpe.isPrimitiveValueType then defn.boxedType(expr.tpe) else expr.tpe
260
+ if tp <:< testType && inMatch then
260
261
if expr.tpe.isNotNull then constant(expr, Literal (Constant (true )))
261
262
else expr.testNotNull
262
263
else {
Original file line number Diff line number Diff line change
1
+ class Test ():
2
+ def m1 (xs : List [Boolean ]) = for (x : Any ) <- xs yield x
3
+ def m2 (xs : List [Boolean ]) = for (x : AnyVal ) <- xs yield x
4
+ def m3 (xs : List [Boolean ]) = for (x : Matchable ) <- xs yield x
5
+
6
+ def v1 (xs : List [AnyVal ]) = for (x : Any ) <- xs yield x
7
+ def v2 (xs : List [AnyVal ]) = for (x : AnyVal ) <- xs yield x
8
+ def v3 (xs : List [AnyVal ]) = for (x : Matchable ) <- xs yield x
9
+
10
+ def t1 (xs : List [Matchable ]) = for (x : Any ) <- xs yield x
11
+ def t2 (xs : List [Matchable ]) = for (x : Matchable ) <- xs yield x
12
+
13
+ def a1 (xs : List [Any ]) = for (x : Any ) <- xs yield x
You can’t perform that action at this time.
0 commit comments