forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix pattern generation in "ordinal" mirror method (scala#17570)
The "ordinal" method generated non-sensical patterns if the cases of a sealed trait were found in the trait itself. In that case the ordinal method would be placed in the companion object, but still tried to access the cases via the `this` of the companion class. We are now more careful and fall back to type projections in comparisons. Fixes scala#17556
- Loading branch information
Showing
4 changed files
with
38 additions
and
9 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
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,8 @@ | ||
sealed trait A { | ||
// must be `object` or `case class` | ||
object X extends A | ||
case class Y() extends A | ||
} | ||
|
||
// companion object must exist | ||
object A |