-
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
Match exhaustivity is broken when case class contains java enum field #15179
Comments
I think this should have been fixed by #15109, could you try with a nightly? |
I've also had a similar issue when compiling another project with 3.2.0-RC1 nightly, but it was not using java classes and I was not able to minimize it outside the project. Simplified snippet given a warning, but only in that project. def x: SqlDiscriminatedType = ???
val ctpe = Some(x) match {
case Some(discriminator) => ???
case _ => ???
}
Output:
[info] compiling 9 Scala sources to /home/wmazur/projects/virtuslab/dotty-community/gsp-graphql/modules/sql/target/scala-3.1.2/classes ...
[error] -- [E030] Match case Unreachable Error: /home/wmazur/projects/virtuslab/dotty-community/gsp-graphql/modules/sql/src/main/scala/SqlMapping.scala:1803:19
[error] 1803 | case Some(discriminator) => ???
[error] | ^^^^^^^^^^^^^^^^^^^
[error] | Unreachable case
[error] one error found |
@bishabosha I've run it now with 3.2.0-RC1-bin-SNAPSHOT-git-9dbe2d3 and it seems to work. The snippet from the previous comment was not tested yet. |
Am I reading it correctly?
|
@Kordyjan yes, this is correct, it seems to be broken in 3.1.2 and 3.1.3-RC3 |
Just for context, the "breakage" in [3.1.2,3.2.0) comes from my fix to the warning emission (which wasn't stable before: unrelated changes would cause untouched warnings from be emitted). |
Compiler version
3.1.3-RC3
When testing in the source project (link below) if fails with 3.1.2 also, works correctly with 3.1.1
Minimized code
Based on https://github.com/kirill5k/mongo4cats/blob/ed6a5c112c16e71af2557efa9f4e5f45f9a63551/core/src/main/scala/mongo4cats/collection/queries/WatchQueryBuilder.scala#L125-L137
FullDocument.java
QueryCommand.scala
test.scala
javac -d . FullDocument.java ./bin/scalac QueryCommand.scala test.scala
Reproducing with scala-cli for different Scala version is not determistic - might or might not give a warning
Output
Expectation
Compiler should know give an incorrect exhaustivity warning
The text was updated successfully, but these errors were encountered: