You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeNumeric=Double|Intvalv1=100valv2=100.0defcheck1(i: Double|Int|String):Unit= {
i match {
case a:(Double|Int) => println(s"numeric = $a")
case _ => println("categorical")
}
}
/* [warn] 25 | case a:Numeric => println(s"numeric = $a") [warn] | ^^^^^^^^^ [warn] | the type test for gg.SlidingIssue.Numeric cannot be checked at runtime [warn] one warning found*/defcheck2(i: Double|Int|String):Unit= {
i match {
case a:Numeric=> println(s"numeric = $a")
case _ => println("categorical")
}
}
Output
[warn] 25 | case a:Numeric => println(s"numeric = $a")
[warn] | ^^^^^^^^^
[warn] | the type test for gg.SlidingIssue.Numeric cannot be checked at runtime
[warn] one warning found
Expectation
I expected that using union types directly or using a type alias should produce the same result. However when using a type alias in a match (in check1) I get the warning when using a type but not when using the unon type directly (check2).
This does not seem to happen consistently all the time.
Tested with 0.24.0-RC1
The text was updated successfully, but these errors were encountered:
Minimized code
Output
Expectation
I expected that using union types directly or using a type alias should produce the same result. However when using a type alias in a match (in
check1
) I get the warning when using a type but not when using the unon type directly (check2
).This does not seem to happen consistently all the time.
Tested with
0.24.0-RC1
The text was updated successfully, but these errors were encountered: