Skip to content
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

Align implementation with spec of soft modifiers #15961

Merged
merged 1 commit into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/parsing/Tokens.scala
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ object Tokens extends TokensCommon {

final val modifierTokensOrCase: TokenSet = modifierTokens | BitSet(CASE)

final val modifierFollowers = modifierTokensOrCase | defIntroTokens
final val modifierFollowers = modifierTokens | defIntroTokens

/** Is token only legal as start of statement (eof also included)? */
final val mustStartStatTokens: TokenSet = defIntroTokens | modifierTokens | BitSet(IMPORT, EXPORT, PACKAGE)
Expand Down
9 changes: 4 additions & 5 deletions tests/neg-custom-args/erased/i5525.scala
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
}
2 changes: 1 addition & 1 deletion tests/neg/i5525.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ enum Foo11 {
protected case C9 // ok
}

enum Foo12 {
enum Foo12 { // error: Enumerations must contain at least one case
inline case C10() // error: only access modifiers allowed
}
9 changes: 9 additions & 0 deletions tests/pos/i15960.scala
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
}