Skip to content

Inherit construct signature from extended interface#5934

Merged
sandersn merged 5 commits into
masterfrom
inherit-construct-signature-from-extended-interface
Dec 4, 2015
Merged

Inherit construct signature from extended interface#5934
sandersn merged 5 commits into
masterfrom
inherit-construct-signature-from-extended-interface

Conversation

@sandersn
Copy link
Copy Markdown
Member

@sandersn sandersn commented Dec 4, 2015

Fixes #5864. Previously, when a class had no constructors, getDefaultConstructSignature only checked class base types for constructors. Now it checks all types that the class extends.

The performance should be about the same -- the original guard called getBaseTypes which calls getBaseConstructorTypeOfClass. The new code calls getBaseConstructorTypeOfClass up-front and then guards on the number of signatures.

This change improves the error message of an existing test which previously was not the desired message according to the comment in the text of the test.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it feels like a cascading error

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'll see if I can avoid emitting it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I can get back to the old behaviour without too much trouble. I'll see if I can also get rid of the "Property 'foo' does not exist on type 'xyz'" as well.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Actually, I think I'll merge this the way it is. All the things I've tried so far to prevent cascading errors happen way before resolveNewExpression even gets to calling getDefaultConstructSignatures. So that change is going to be unrelated to and quite a bit more complicated than this fix.

sandersn added a commit that referenced this pull request Dec 4, 2015
…rom-extended-interface

Inherit construct signature from extended interface
@sandersn sandersn merged commit b1fac59 into master Dec 4, 2015
@sandersn sandersn deleted the inherit-construct-signature-from-extended-interface branch December 4, 2015 22:23
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
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.

3 participants