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

Disallow infix objects #17966

Merged
merged 1 commit into from
Jun 19, 2023
Merged

Disallow infix objects #17966

merged 1 commit into from
Jun 19, 2023

Conversation

arainko
Copy link
Contributor

@arainko arainko commented Jun 13, 2023

Disallow infix objects by checking for the infix modifier in Checking.scala.

I also have another version of this PR that does these checks during parsing (kind of mirroring how infix imports and infix exports are rejected) but doing this in Checking.scala yields much nicer error messages for the end user, eg. when a user tries to compile code with infix object Something they will now see this:

-- [E156] Syntax Error: /home/aleksander/Repos/dotty/issues/issue17738/issue17738.scala:1:0 
1 |infix object Something
  |^^^^^
  |Modifier infix is not allowed for this definition

Part of #17738

Disallow `infix` objects by checking for the `infix` modifier in
`Checking.scala`.

Part of scala#17738
@arainko
Copy link
Contributor Author

arainko commented Jun 13, 2023

I've signed the CLA.

@mbovel mbovel requested review from mbovel and Sporarum June 13, 2023 15:43
Copy link
Member

@mbovel mbovel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR! Looks fine to me!

Copy link
Contributor

@Sporarum Sporarum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, thank you !

@mbovel mbovel merged commit 2ddb6b9 into scala:main Jun 19, 2023
mbovel added a commit that referenced this pull request Jul 13, 2023
…7994)

Disallow infix toplevel definitions for anything that is not a `class`,
`typealias`, `match type`, `extension method` and a `trait` (and
`objects` as well but these are handled in their own PR).

Part of #17738
Continuation of #17966

---------

Co-authored-by: Matt Bovel <[email protected]>
@Kordyjan Kordyjan added this to the 3.4.0 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants