diff --git a/compiler/src/dotty/tools/dotc/parsing/Tokens.scala b/compiler/src/dotty/tools/dotc/parsing/Tokens.scala index c78a336ecdf5..689e6af486b1 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Tokens.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Tokens.scala @@ -257,7 +257,7 @@ object Tokens extends TokensCommon { final val modifierTokensOrCase: TokenSet = modifierTokens | BitSet(CASE) - final val modifierFollowers = modifierTokens | defIntroTokens + final val modifierFollowers = modifierTokensOrCase | defIntroTokens /** Is token only legal as start of statement (eof also included)? */ final val mustStartStatTokens: TokenSet = defIntroTokens | modifierTokens | BitSet(IMPORT, EXPORT, PACKAGE) diff --git a/tests/neg/i18933.check b/tests/neg/i18933.check deleted file mode 100644 index dc4db455c2de..000000000000 --- a/tests/neg/i18933.check +++ /dev/null @@ -1,10 +0,0 @@ --- Error: tests/neg/i18933.scala:3:8 ----------------------------------------------------------------------------------- -3 | infix case B(b: B) // error // error - | ^^^^ - | end of statement expected but 'case' found --- [E006] Not Found Error: tests/neg/i18933.scala:3:2 ------------------------------------------------------------------ -3 | infix case B(b: B) // error // error - | ^^^^^ - | Not found: infix - | - | longer explanation available when compiling with `-explain` diff --git a/tests/neg/i18933.scala b/tests/neg/i18933.scala deleted file mode 100644 index 7802c3961a25..000000000000 --- a/tests/neg/i18933.scala +++ /dev/null @@ -1,3 +0,0 @@ -enum Extends[A, B]: - case A(a: A) - infix case B(b: B) // error // error diff --git a/tests/neg/i5525.scala b/tests/neg/i5525.scala index 12ffb4704ba9..ceec2c90173f 100644 --- a/tests/neg/i5525.scala +++ b/tests/neg/i5525.scala @@ -29,6 +29,6 @@ enum Foo11 { protected case C9 // ok } -enum Foo12 { // error: Enumerations must contain at least one case +enum Foo12 { inline case C10() // error: only access modifiers allowed } \ No newline at end of file diff --git a/tests/neg/i5525b.scala b/tests/neg/i5525b.scala index d51564ad52c1..23fbba4d5409 100644 --- a/tests/neg/i5525b.scala +++ b/tests/neg/i5525b.scala @@ -2,10 +2,10 @@ erased enum Foo6 {} // error: only access modifiers allowed -enum Foo10 { // error: Enumerations must contain at least one case - erased case C6() // error // error +enum Foo10 { + erased case C6() // error } -enum Foo11 { // error: Enumerations must contain at least one case - erased case C6 // error // error +enum Foo11 { + erased case C6 // error } diff --git a/tests/pos/i22010.scala b/tests/pos/i22010.scala new file mode 100644 index 000000000000..6962f02a1e20 --- /dev/null +++ b/tests/pos/i22010.scala @@ -0,0 +1,7 @@ +//> using options -source:future + +enum Expr1: + infix case Add1[L, R](l: L, r: R) + +import Expr1.Add1 +val foo: 1 Add1 2 = ???