Skip to content

Fix local and exported type alias merging - #36237

Merged
Andrew Branch (andrewbranch) merged 2 commits into
microsoft:masterfrom
andrewbranch:bug/36196
Jan 22, 2020
Merged

Andrew Branch (andrewbranch) merged 2 commits into
microsoft:masterfrom
andrewbranch:bug/36196

Conversation

@andrewbranch

Copy link
Copy Markdown
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
Copy Markdown
Member

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
Copy Markdown
Member Author

@typescript-bot

TypeScript Bot (typescript-bot) commented Jan 22, 2020 •

Copy link
Copy Markdown
Contributor

Heya Andrew Branch (@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

TypeScript Bot (typescript-bot) commented Jan 22, 2020 •

Copy link
Copy Markdown
Contributor

Heya Andrew Branch (@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
Copy Markdown
Contributor

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
Copy Markdown
Member Author

User test changes look all unrelated

@andrewbranch

Copy link
Copy Markdown
Member Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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