-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
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
Pattern Match Exhaustiveness Check Misses a Case #20128
Labels
area:pattern-matching
area:reporting
Error reporting including formatting, implicit suggestions, etc
itype:bug
Milestone
Comments
CyrilFMoser
added
itype:bug
stat:needs triage
Every issue needs to have an "area" and "itype" label
labels
Apr 8, 2024
I wasn't able to reproduce the crash. |
Gedochao
added
area:reporting
Error reporting including formatting, implicit suggestions, etc
area:pattern-matching
and removed
stat:needs triage
Every issue needs to have an "area" and "itype" label
labels
Jun 4, 2024
Ah, right. There's no crash, but the code fails by throwing an exception at runtime when run as a script. // repro-script.sc
sealed trait T_A[A]
case class CC_B[A](a: T_A[A]) extends T_A[Byte]
case class CC_E[A](b: T_A[A]) extends T_A[Byte]
val v_a: T_A[Byte] = CC_E(CC_B(null))
val v_b: Int = v_a match {
case CC_E(CC_E(_)) => 0
case CC_B(_) => 1
} scala-cli run repro-script.sc
Compiling project (Scala 3.4.2, JVM (17))
Compiled project (Scala 3.4.2, JVM (17))
Exception in thread "main" scala.MatchError: CC_E(CC_B(null)) (of class repro$minusscript$_$CC_E)
at repro$minusscript$_.<init>(repro-script.sc:8)
at repro$minusscript_sc$.script$lzyINIT1(repro-script.sc:24)
at repro$minusscript_sc$.script(repro-script.sc:24)
at repro$minusscript_sc$.main(repro-script.sc:28)
at repro$minusscript_sc.main(repro-script.sc) |
Very similar issues which were reported together with this, potentially duplicates: |
This was referenced Jun 4, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area:pattern-matching
area:reporting
Error reporting including formatting, implicit suggestions, etc
itype:bug
Compiler version
3.4.1
Minimized code
Output
Crashes
Expectation
Should give a warning at compile time that the pattern match is not exhaustive.
The text was updated successfully, but these errors were encountered: