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

Contextually type parameters in super calls using type arguments on the base class. #1816

Merged
merged 6 commits into from
Jan 28, 2015

Conversation

DanielRosenwasser
Copy link
Member

Seems like we might not even have been performing overload resolution correctly here.

Fixes #1480.


constructor() {

super("hi"); // Should error, base constructor has type T for first arg, which is fixed as number in the extends clause
Copy link
Contributor

Choose a reason for hiding this comment

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

Technically, the word you want is "instantiated" rather than "fixed"

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't write it, but I'll consider fixing it.

@JsonFreeman
Copy link
Contributor

👍

// Instead, they must be fetched from the class declaration's base type node.
function getEffectiveTypeArguments(callExpression: CallExpression): TypeNode[] {
if (callExpression.expression.kind === SyntaxKind.SuperKeyword) {
// TODO (drosen): 1) Discuss if checking needs to be done at this point.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think #2 and #3 todo would be good to added in

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@yuit
Copy link
Contributor

yuit commented Jan 28, 2015

lgtm

DanielRosenwasser added a commit that referenced this pull request Jan 28, 2015
Contextually type parameters in super calls using type arguments on the base class.
@DanielRosenwasser DanielRosenwasser merged commit 26929ee into master Jan 28, 2015
@DanielRosenwasser DanielRosenwasser deleted the typeArgsInSuperCall branch January 28, 2015 01:29
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 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.

Overload resolution fails to use type arguments from base type in 'super' constructor calls
4 participants