GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||
GeezerVison is showing github.com — Filter signatures by matching constraints when instantiating them for instantiation signatures by Andarist · Pull Request #51695 · microsoft/TypeScript Conversation
|
| const applicableSignatures = mapDefined(sameTypeAritySignatures, sig => { | ||
| const typeArgumentTypes = checkTypeArguments(sig, typeArguments!, /*reportErrors*/ false); | ||
| return typeArgumentTypes && getSignatureInstantiation(sig, typeArgumentTypes, isInJSFile(sig.declaration)); | ||
| }); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Note that this still doesn't exactly work like regular overload selection done by chooseOverload. I simply reject signatures that have non-matching constraints on their type params. When overloads are chosen for call expressions etc the first matching overload "wins".
I think that this is actually desirable - since here we still output an intersection of signatures (overloads) and we leave the final overload selection for the time the output type is being used as a call expression.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if (applicableSignatures.length) { | ||
| return applicableSignatures; | ||
| } | ||
| return sameMap(sameTypeAritySignatures, sig => { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I've preserved the old behavior here~. If there are some signatures for the given type argument arity but when none of them match... I still gonna report the same error. Perpahs this can be improved further.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The TypeScript team hasn't accepted the linked issue #51694. If you can get it accepted, this PR will have a better chance of being reviewed. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The TypeScript team hasn't accepted the linked issue #51694. If you can get it accepted, this PR will have a better chance of being reviewed. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The TypeScript team hasn't accepted the linked issue #51694. If you can get it accepted, this PR will have a better chance of being reviewed. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…ntiation-expressions-by-matching-constraints
ff7f0c6 to
ba3e829
Compare
…ntiation-expressions-by-matching-constraints
|
With 6.0 out as the final release vehicle for this codebase, we're closing all PRs that don't fit the merge criteria for post-6.0 patches. If you think this was a mistake and this PR fits the post-6.0 patch criteria, please post to the 6.0 iteration issue with details (specifically, which PR and which patch criteria it satisfies). Next steps for PRs:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Instantiation expressions should filter overloads by type parameter constraints Instantiation expressions don't filter signatures with non-matching constraints
There was an error while loading. Please reload this page.