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

Should infix work on enum case? #22010

Open
KacperFKorban opened this issue Nov 22, 2024 · 2 comments
Open

Should infix work on enum case? #22010

KacperFKorban opened this issue Nov 22, 2024 · 2 comments

Comments

@KacperFKorban
Copy link
Member

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:

@KacperFKorban KacperFKorban added itype:question stat:needs triage Every issue needs to have an "area" and "itype" label labels Nov 22, 2024
@Gedochao Gedochao added area:enums and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Nov 22, 2024
@hamzaremmal
Copy link
Member

spree ?

@KacperFKorban
Copy link
Member Author

At first sight, it seems just right, but there might be some edge cases I don't see now. CC @mbovel
There is also a question of whether it should even be supported. I felt like the decision in #18933 was that it should. Is there a spec for infix things?

@KacperFKorban KacperFKorban self-assigned this Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants