Navigation Menu

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

Allow duplicate identifiers across declarations. #8696

Merged
merged 1 commit into from May 24, 2016

Conversation

RyanCavanaugh
Copy link
Member

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.

}

if (hasProperty(names, memberName)) {
error(member, Diagnostics.Duplicate_identifier_0, memberName);
Copy link
Contributor

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.

Copy link
Contributor

@mhegazy mhegazy May 19, 2016

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.

Copy link
Member Author

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

Copy link
Contributor

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.

@mhegazy
Copy link
Contributor

mhegazy commented May 19, 2016

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);
Copy link
Contributor

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.

@mhegazy
Copy link
Contributor

mhegazy commented May 23, 2016

also can you add a test for computed properties

class C {
    ["a"]: 1,
    ["a"]: 2
}

@RyanCavanaugh
Copy link
Member Author

Last call

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants