-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Merge inherits interface members #5359
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
Conversation
Previously it assumed that if a class was present in the merge, only the class base types needed to be used. This became false when classes and interfaces could be merged.
Both interfaces and classes have base classes/interfaces; all members are available on an instance of the merged child.
A couple of tests were previously updated to give an incorrect error message.
I forgot to update the baselines in the last commit. I'll update them shortly to fix the build. |
I found that merging a class that has no base with an interface that has a base class causes a crash because `getDefaultConstructSignatures` assumes that any base must be a class base. Which was true in the previously buggy state.
Covers the case when the merged interface extends an interface, but the merged class does not extend a class, then trying to extend that class.
} | ||
return type.resolvedBaseTypes; | ||
} | ||
|
||
function resolveBaseTypesOfClass(type: InterfaceType): void { | ||
type.resolvedBaseTypes = emptyArray; | ||
type.resolvedBaseTypes = type.resolvedBaseTypes || []; |
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 would move this to the bottom where it is used. this way we are not creating an empty array literal for every class. so that classes with no base types can share the sentinel empty array value.
👍 |
Merge inherits interface members
We will need to cherrypick this into release-1.7 |
Fixes #5347
This bug has been around since July but we didn't notice it until recently.
getBaseTypes
assumed that if a class was present in the merge, only the class base types needed to be used -- it skipped the interface base types entirely. This became false when [ambient] classes and interfaces could be merged.