-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Fix #1589: Reworks with explanation error:modifiers(s) not allowed for 'item' #2747
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, and thank you for opening this PR! 🎉
All contributors have signed the CLA, thank you! ❤️
Commit Messages
We want to keep history, but for that to actually be useful we have
some rules on how to format our commit messages (relevant xkcd).
Please stick to these guidelines for commit messages:
- Separate subject from body with a blank line
- When fixing an issue, start your commit message with
Fix #<ISSUE-NBR>:
- Limit the subject line to 72 characters
- Capitalize the subject line
- Do not end the subject line with a period
- Use the imperative mood in the subject line ("Added" instead of "Add")
- Wrap the body at 80 characters
- Use the body to explain what and why vs. how
adapted from https://chris.beams.io/posts/git-commit
Have an awesome day! ☀️
@felixmulder can you take a look ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpicks, otherwise LGTM! Thanks for contributing! 🎉
@@ -89,8 +89,8 @@ | |||
OnlyCaseClassOrCaseObjectAllowedID, | |||
ExpectedClassOrObjectDefID, | |||
AnonymousFunctionMissingParamTypeID, | |||
SuperCallsNotAllowedInlineID | |||
; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea with having this on a separate line is that we won't get a -
diff when adding an ID
| | ||
|Consider the following example: | ||
|$code | ||
|In this instance, the modifier 'sealed' is not applicable to the item type 'def' (method) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also possibly try to identify which flags have been applied to what and make a suggestion. That would be cool 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@felixmulder not quite sure how to identify all modifiers for traits,methods,variables. Should this not be handled instead by the next error,
1693 syntaxError(s"illegal modifier combination: ${mods.flags} and $flag")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think these two should be harmonized. I.e. the same error message for both. You could make sort: Option[String]
to discern between the case _
and the rest of them.
Otherwise this LGTM now :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I can take that one next. Can we agree that it will be handled with the 1693 consolidation refactor and get this one through? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure - that's fine by me - assigning you in #1589
@@ -90,7 +90,8 @@ | |||
ExpectedClassOrObjectDefID, | |||
AnonymousFunctionMissingParamTypeID, | |||
SuperCallsNotAllowedInlineID, | |||
ModifiersNotAllowedID; | |||
ModifiersNotAllowedID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should leave the trailing ,
at the end so the next diff wont change this line
...
AnonymousFunctionMissingParamTypeID,
SuperCallsNotAllowedInlineID,
ModifiersNotAllowedID,
;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok thanks nicolass
Parsers-1685 : Sample compilation error
Explanation
You tried to use a modifier that is inapplicable for the type of item under modification
Consider the following example:
sealed def y: Int = 1
In this instance, the modifier 'sealed' is not applicable to the item type 'def' (method)