-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #12729: Don't encode <init> and <clinit> only. #12901
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
Conversation
@@ -0,0 +1,3 @@ | |||
class Test(i: Int): | |||
val `<init>` = "init" // error: Illegal backquoted identifier: `<init>` and `<clinit>` are forbidden |
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 also test that class `<init>`
and def `<init>`
are rejected
1dd1d24
to
ef27b1e
Compare
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.
Otherwise LGTM, but this PR also adds an empty .scalafmt.conf file, is that intentional?
length >= 6 && | ||
head == '<' && (this == StdNames.nme.CONSTRUCTOR || this == StdNames.nme.STATIC_CONSTRUCTOR) |
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.
This can be simplified to just checking if this is CONSTRUCTOR or STATIC_CONSTRUCTOR, the checks for length and head aren't needed anymore.
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're right! thanks
Very minor point but when fixing up a mistake in a previous commit, don't hesitate to squash these commits together and push-force, this makes the git history more readable. |
1492159
to
58ff556
Compare
In addition, reject `<init>` and `<clinit>` in the parser, so that users don't write them in source code.
58ff556
to
30191db
Compare
In addition, reject
<init>
and<clinit>
in the parser, so thatusers don't write them in source code.
fixes #12729