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
3.4.1
sealed trait T_A[A, B] sealed trait T_B[C] case class CC_D[A, C]() extends T_A[A, C] case class CC_E() extends T_B case class CC_G[A, C](c: C) extends T_A[A, C] val v_a: T_A[Boolean, T_B[Boolean]] = CC_G(null) val v_b = v_a match { case CC_D() => 0 case CC_G(_) => 1 }
The value of v_b is 1
The compiler gives an unreachable warning for case CC_G(_) , so it should not be able to reach that case.
The text was updated successfully, but these errors were encountered:
The unreachable case indeed is reached when this similar repro is run:
sealed trait T_A[A, B] sealed trait T_B[C] case class CC_D[A, C]() extends T_A[A, C] case class CC_E() extends T_B case class CC_G[A, C](c: C) extends T_A[A, C] @main def main = { val v_a: T_A[Boolean, T_B[Boolean]] = CC_G(null) val v_b = v_a match { case CC_D() => 0 case CC_G(_) => 1 } println(s"the unreachable case v_b: $v_b") }
scala-cli run repro.scala # Compiling project (Scala 3.4.2, JVM (17)) # [warn] ./repro.scala:10:10 # [warn] Unreachable case # [warn] case CC_G(_) => 1 # [warn] ^^^^^^^ # Compiled project (Scala 3.4.2, JVM (17)) # the unreachable case v_b: 1
Sorry, something went wrong.
Very similar issues which were reported together with this, potentially duplicates:
dwijnand
Successfully merging a pull request may close this issue.
Compiler version
3.4.1
Minimized code
Output
The value of v_b is 1
Expectation
The compiler gives an unreachable warning for case CC_G(_) , so it should not be able to reach that case.
The text was updated successfully, but these errors were encountered: