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

Fix local and exported type alias merging #36237

Merged
merged 2 commits into from
Jan 22, 2020

Conversation

andrewbranch
Copy link
Member

Fixes #36196

The error is weird, but it’s consistent with what you get for every other kind of declaration, including other non-merging declarations like constants. The way the binder works is a little strange; an exported declaration does have a local symbol but it doesn’t get any symbol flags, so anything can merge into it. On the other hand, it runs through declareSymbol with a normal, full set of excludes flags, so it will not merge into something else—a strange asymmetry that means if you reverse the order of declarations such that the local-only comes first:

type A = 0;
export type A = 1;

you get the more expected “Duplicate identifier” error. It seems like there’s a potential to do some general work around making these collisions symmetrical in the binder, but it would be a much bigger and more dangerous change that can’t happen for 3.8 at this point.

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

Can you run this on RWC and user tests before merging? DT seems unlikely to have this error.

@andrewbranch
Copy link
Member Author

@typescript-bot test this
@typescript-bot user test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jan 22, 2020

Heya @andrewbranch, I've started to run the extended test suite on this PR at 36e7c34. You can monitor the build here. It should now contribute to this PR's status checks.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jan 22, 2020

Heya @andrewbranch, I've started to run the parallelized community code test suite on this PR at 36e7c34. You can monitor the build here. It should now contribute to this PR's status checks.

@typescript-bot
Copy link
Collaborator

The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master.

@andrewbranch
Copy link
Member Author

User test changes look all unrelated

@andrewbranch
Copy link
Member Author

There is one new error in RWC (Skype), but it looks expected and easily fixable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team Breaking Change Would introduce errors in existing code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate types are allowed (and ignored) if the first type is exported
4 participants