forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Align implementation with spec of soft modifiers
The spec in https://dotty.epfl.ch/docs/reference/soft-modifier.html says: > A soft modifier is treated as potential modifier of a definition if it is followed by a hard modifier or a keyword combination starting a definition (def, val, var, type, given, class, trait, object, enum, case class, case object). Between the two words there may be a sequence of newline tokens and soft modifiers. But the implementation recognized also soft modifiers in front of just `case`, not followed by `class` or `object`. The change caused some breakage for enum cases, where we have `case` alone, but that one cannot be preceded by any soft modifiers anyway. So only neg tests were affected. Fixes scala#15960
- Loading branch information
Showing
4 changed files
with
15 additions
and
7 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 |
---|---|---|
@@ -1,10 +1,9 @@ | ||
|
||
erased enum Foo6 {} // error: only access modifiers allowed | ||
|
||
enum Foo10 { | ||
erased case C6() // error: only access modifiers allowed | ||
enum Foo10 { // error: Enumerations must contain at least one case | ||
erased case C6() // error // error | ||
} | ||
|
||
enum Foo11 { | ||
erased case C6 // error: only access modifiers allowed | ||
enum Foo11 { // error: Enumerations must contain at least one case | ||
erased case C6 // error // 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
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,9 @@ | ||
class Foo(open: String) { | ||
def bar(n: Int) = n match { | ||
case 0 => open | ||
case _ => throw new IndexOutOfBoundsException() | ||
} | ||
def baz() = open | ||
} | ||
|
||
|