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
inlinedefaToB[T,A,B](t:T,b:B):T|B= t match {
case _:A=> b
case _:T=> t
}
@main defmain() = aToB[Int, Double, String](1,"x")
Output
❌ this case is unreachable since type Int is not a subclass of class Double
Expectation
A warning? User of the inlined method would be hardly able to do anything about it if it came from a library.
Moreover, is a dead branch of match statement really worth a compile error? Non-exhaustive matches, which seem more serious to me, are just warnings now.
The text was updated successfully, but these errors were encountered:
I've just encountered it again. I want to check wheteher V is of SSHMsg and this feature prevents me from doing that.
inlinegivenproductWriter[V:ClassTag](usingm: Mirror.ProductOf[V]) as SSHWriter[V] = (ls:V, os:OutputStream) => {
ls match {
case msg:SSHMsg[_] => os.write(msg.magic)
case _ =>
}
writeProduct[m.MirroredElemTypes](ls.asInstanceOf)(os)(0)
}
Rewriting using if-statement as a workaround
if (ls.isInstanceOf[SSHMsg[_]])
os.write(ls.asInstanceOf[SSHMsg[_]].magic)
Uh oh!
There was an error while loading. Please reload this page.
Minimized code
Output
❌ this case is unreachable since type
Int
is not a subclass ofclass Double
Expectation
A warning? User of the inlined method would be hardly able to do anything about it if it came from a library.
Moreover, is a dead branch of match statement really worth a compile error? Non-exhaustive matches, which seem more serious to me, are just warnings now.
The text was updated successfully, but these errors were encountered: