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

Fix crash when checking function call #30758

Merged
merged 3 commits into from
Apr 8, 2019

Conversation

andrewbranch
Copy link
Member

Fixes #30647

Crash occurred while getting diagnostic for a function call with

  • at least one non-spread argument, AND
  • at least one spread argument, AND
  • overall, possibly too few arguments to satisfy the signature.

Under these circumstances, the node we were trying to put the error onto was incorrectly being calculated as an argument beyond the bounds of the arguments that actually exist.

tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(34,8): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(34,8): error TS2556: Expected 1-3 arguments, but got 0 or more.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(35,8): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(36,14): error TS2556: Expected 2-4 arguments, but got 1 or more.
Copy link
Member Author

Choose a reason for hiding this comment

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

These diffs because I added a line before the test cases are painful. Should I be doing something to avoid this or nah?

Copy link
Member

Choose a reason for hiding this comment

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

That's fine I think. The errors are also shown later in the source code so its easier to see the diff that matters anyway

@jkillian
Copy link

jkillian commented Apr 8, 2019

I believe this should also fix #30747

@andrewbranch andrewbranch merged commit bafa4c9 into microsoft:master Apr 8, 2019
@andrewbranch andrewbranch deleted the bug/30647 branch April 8, 2019 16:22
@RyanCavanaugh RyanCavanaugh modified the milestone: TypeScript 3.4.4 Apr 12, 2019
RyanCavanaugh pushed a commit that referenced this pull request Apr 12, 2019
<!--
Thank you for submitting a pull request!

Here's a checklist you might find useful.
* [ ] There is an associated issue that is labeled 'Bug' or 'help wanted'
* [ ] Code is up-to-date with the `master` branch
* [ ] You've successfully run `gulp runtests` locally
* [ ] There are new or updated unit tests validating the change

Refer to CONTRIBUTING.MD for more details.
  https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md
-->

Fixes #30647

Upstream bugfix cherry-picked for patch release on version 3.4.

See original bug for discussion: #30647 (comment)
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.

Debug failure with dereferenced functions of different arities
5 participants