Skip to content

A merged interface with an inherited member should satisfy an abstract base class member #32539

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

Merged
merged 2 commits into from
Aug 1, 2019

Conversation

andrewbranch
Copy link
Member

Fixes #31905

I kind of expected this to be fixed by a single insertion of getMergedSymbol somewhere, but it seems that resolveObjectTypeMembers (which is called by getPropertyOfType), when copying members from base types, just skips over any member with the same name as one that has already been resolved. In the linked issue / test case, the abstract BaseClass is closer than IGetters, so its members get copied to the type, and then when IGetters’ members get copied, it’s a no-op because bar already exists. So—is there an existing function that says “get me all the symbols that represent this property,” rather than just the closest?

@andrewbranch andrewbranch requested a review from sandersn July 24, 2019 21:56
if (baseDeclarationFlags & ModifierFlags.Private || derivedDeclarationFlags & ModifierFlags.Private) {
// either base or derived property is private - not override, skip it
continue;
}

Copy link
Member Author

Choose a reason for hiding this comment

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

This diff is really wonky if you don’t have “Hide whitespace changes” turned on.

@andrewbranch
Copy link
Member Author

@typescript-bot test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 24, 2019

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

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.

I ... guess? It's weird that the implementing property needs to be identical to the abstract one instead of a subtype. That is, a normal subtype can say bar: 12 = 12 but the property from the merged interface has to be exactly the same type.

abstract is not a principled concept anyway, so a squishy gut check is about the best we can do.

@andrewbranch andrewbranch merged commit 73bef22 into microsoft:master Aug 1, 2019
@andrewbranch andrewbranch deleted the bug/31905 branch August 1, 2019 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Declaration merging of ancestor abstract types broken
4 participants