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
classAclassBclassCobjectTest {
deffoo(x: A) = x match {
casex: B=> x // as expected, error: this case is unreachable since class A is not a subclass of class Bcase _ =>
}
defbar(x: A|B) = x match {
casex: C=> x // no error!case _ =>
}
}
The logic handling this is in TypeTestCast#interceptTypeApply#interceptWith#transformIsInstanceOf which computes a class symbol for the scrutinee:
def foundCls = effectiveClass(expr.tpe.widen)
So when the pattern has type A | B, testCls will be Any. This logic needs to be adapted to handle union types where there's more than one possible class symbol.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
The logic handling this is in
TypeTestCast#interceptTypeApply#interceptWith#transformIsInstanceOf
which computes a class symbol for the scrutinee:So when the pattern has type
A | B
,testCls
will beAny
. This logic needs to be adapted to handle union types where there's more than one possible class symbol.The text was updated successfully, but these errors were encountered: