Skip to content

Simplify call resolution logic #26481

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 5 commits into from
Aug 17, 2018
Merged

Simplify call resolution logic #26481

merged 5 commits into from
Aug 17, 2018

Conversation

ahejlsberg
Copy link
Member

@ahejlsberg ahejlsberg commented Aug 15, 2018

This PR simplifies our call resolution logic. Over time the resolveCall function had gotten quite unwieldy, particularly in the getEffectiveArgumentXXX functions that abstracted over access to the argument list. We now always construct an argument list and use SyntheticExpression nodes to represent synthetic arguments. Also, for reasons not entirely clear, we would include context sensitive arguments one at a time, with intervening full rounds of inference and applicability checking, instead of just including all of them in one go. The code is now easier to follow and about 250 lines shorter.

@sheetalkamat
Copy link
Member

Will this fix #26426 which @Andy-MS had investigated to be in same area.

@ahejlsberg
Copy link
Member Author

@sheetalkamat No, this has no effect on #26426.

@RyanCavanaugh
Copy link
Member

@typescript-bot test this por favor

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 16, 2018

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

@RyanCavanaugh
Copy link
Member

Running RWC locally to get diffs

@RyanCavanaugh
Copy link
Member

@weswigham running the tests locally doesn't yield any diffs. Ideas?

@weswigham
Copy link
Member

weswigham commented Aug 17, 2018

@RyanCavanaugh the test fails if rwc on master isn't clean. The bot should open a PR on our RWC repo with the diff if there is one.

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 like the code change.

I'm a bit surprised no more of our baselines relied on the progressive retry of unexcluding arguments.

Also I assume performance improves noticeably for some code bases? Might be interesting to know if that's true.

return getLiteralType(name.text);
case SyntaxKind.ComputedPropertyName:
const nameType = checkComputedPropertyName(name);
return isTypeAssignableToKind(nameType, TypeFlags.ESSymbolLike) ? nameType : stringType;
Copy link
Member

Choose a reason for hiding this comment

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

This should probably be handling late bound names.
eg,

const methodName = "method";
class Foo {
  @dec [methodName] {}
}

Unless I'm mistaken and for some reason checking with the more specific name is undesirable.

@ahejlsberg ahejlsberg merged commit b746da2 into master Aug 17, 2018
@ahejlsberg ahejlsberg deleted the simplifyResolveCall branch August 17, 2018 17:52
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.

6 participants