Skip to content

Should infix work on enum case? #22010

Open
@KacperFKorban

Description

@KacperFKorban

Compiler version

7ba88ad

Minimized code

enum Expr1:
  infix case Add1[L, R](l: L, r: R)

Output

-- Error: /home/kpi/wiadro/infix_things.scala:2:8 ------------------------------
2 |  infix case Add1[L, R](l: L, r: R)
  |        ^^^^
  |        end of statement expected but 'case' found
-- [E145] Syntax Error: /home/kpi/wiadro/infix_things.scala:1:5 ----------------
1 |enum Expr1:
  |     ^^^^^
  |     Enumerations must contain at least one case
  |
  | longer explanation available when compiling with `-explain`
-- [E006] Not Found Error: /home/kpi/wiadro/infix_things.scala:2:2 -------------
2 |  infix case Add1[L, R](l: L, r: R)
  |  ^^^^^
  |  Not found: infix
  |
  | longer explanation available when compiling with `-explain`

Expectation

infix should be allowed on enum cases (that declare class types)

Other info

Other similar issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions