-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Discover inner classes for sealed hierarchy
- Loading branch information
Showing
4 changed files
with
36 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
t.scala:4: warning: match may not be exhaustive. | ||
It would fail on the following inputs: Oz(), Z() | ||
def n(a: X) = a match { case _: Y => 42 } | ||
^ | ||
error: No warnings can be incurred under -Werror. | ||
1 warning | ||
1 error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
|
||
package p; | ||
public sealed interface X { | ||
public default int x() { return 1; } | ||
public default int x() { return 27; } | ||
} | ||
final class Y implements X { } | ||
final class O { | ||
final static class Z implements X { } | ||
final static class Inner { | ||
final static class Oz implements X { } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
// scalac: -Werror -Xlint | ||
package p | ||
class T { | ||
def n(a: X) = a match { case _: Y => 0 } | ||
def n(a: X) = a match { case _: Y => 42 } | ||
} |