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
and then try compiling Bar.scala while passing Foo.java to scalac (without compiling it first). No warning will be printed, even though the pattern match isn't exhaustive.
$ scalac Foo.java Bar.scala
If, however, the enum is compiled first and then excluded from scalac run, the warning is printed as expected:
$ javac Foo.java
$ scalac Bar.scala
Bar.scala:2: warning: match may not be exhaustive.
It would fail on the following input: B
def baz(foo: Foo) = foo match {
^
one warning found
The text was updated successfully, but these errors were encountered:
@retronym said:
Thanks for the report. Indeed it looks like the functionality to treat Java enums as sealed was added only when reading them from class files.
To reproduce, create two source files:
and then try compiling
Bar.scala
while passingFoo.java
toscalac
(without compiling it first). No warning will be printed, even though the pattern match isn't exhaustive.If, however, the enum is compiled first and then excluded from scalac run, the warning is printed as expected:
The text was updated successfully, but these errors were encountered: