File tree Expand file tree Collapse file tree 4 files changed +20
-1
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 4 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -3922,7 +3922,9 @@ object Parsers {
39223922 }
39233923
39243924 private def checkAccessOnly (mods : Modifiers , where : String ): Modifiers =
3925- val mods1 = mods & (AccessFlags | Enum )
3925+ // We allow `infix to mark the `enum`s type as infix.
3926+ // Syntax rules disallow the soft infix modifier on `case`s.
3927+ val mods1 = mods & (AccessFlags | Enum | Infix )
39263928 if mods1 ne mods then
39273929 syntaxError(em " Only access modifiers are allowed on enum $where" )
39283930 mods1
Original file line number Diff line number Diff line change 1+ -- Error: tests/neg/i18933.scala:3:8 -----------------------------------------------------------------------------------
2+ 3 | infix case B(b: B) // error // error
3+ | ^^^^
4+ | end of statement expected but 'case' found
5+ -- [E006] Not Found Error: tests/neg/i18933.scala:3:2 ------------------------------------------------------------------
6+ 3 | infix case B(b: B) // error // error
7+ | ^^^^^
8+ | Not found: infix
9+ |
10+ | longer explanation available when compiling with `-explain`
Original file line number Diff line number Diff line change 1+ enum Extends [A , B ]:
2+ case A (a : A )
3+ infix case B (b : B ) // error // error
Original file line number Diff line number Diff line change 1+ //> using options -Werror
2+
3+ infix enum Extends [A , B ]:
4+ case Ev [B , A <: B ]() extends (A Extends B )
You can’t perform that action at this time.
0 commit comments