-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Allow duplicate identifiers across declarations. #8696
Conversation
} | ||
|
||
if (hasProperty(names, memberName)) { | ||
error(member, Diagnostics.Duplicate_identifier_0, memberName); |
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.
member.name
for the error range.
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 report the duplicate declaration errors on all declarations, as ppl complained they could not find the other one when we reported only on one declaration.
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.
I wonder if we need to keep doing that since now it's guaranteed to be in the same block
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.
i see. yeah you are probably right.
do not see the handling for optionality. |
|
||
if (hasProperty(names, memberName)) { | ||
error(member.symbol.valueDeclaration, Diagnostics.Duplicate_identifier_0, memberName); | ||
error(member, Diagnostics.Duplicate_identifier_0, memberName); |
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.
member.name to get a better error span.
also can you add a test for computed properties class C {
["a"]: 1,
["a"]: 2
} |
Last call |
Fixes #8675
Duplicate identifiers within the same block are still disallowed. Additionally, we retain the restriction that the types of the declared symbols must be identical.