We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
abstract sealed trait AST abstract sealed trait AExpr extends AST case class AAssign(name: String, v: AExpr) extends AExpr case class AConstBool(v: Boolean) extends AExpr trait Ty {} case class TInt() extends Ty case class TBool() extends Ty object Foo { def checkExpr(ast: AExpr): Ty = { var astTy:Ty = ast match { case AAssign(nm: String, v:AExpr) => TBool() case AConstBool(v: Boolean) => TBool() case _ => throw new Exception(s"Unhandled case check(ast: ${ast.getClass})") } astTy } }
I get the following warning:
Foo.scala:15: warning: unreachable code case AConstBool(v: Boolean) => TBool() ^
However if I remove just one type annotation, there's no problem:
case AAssign(nm: String, v) => TBool()
The text was updated successfully, but these errors were encountered:
Imported From: https://issues.scala-lang.org/browse/SI-6210?orig=1 Reporter: Sriram Srinivasan (sriram.srinivasan) Affected Versions: 2.9.0, 2.10.0-M6
Sorry, something went wrong.
@retronym said: Marking as a duplicate of #6022. I have submitted this example as an additional test case: scala/scala#2293
retronym
No branches or pull requests
I get the following warning:
However if I remove just one type annotation, there's no problem:
The text was updated successfully, but these errors were encountered: