Repository navigation
Fix union overload signature ordering instability - #64360
Adil Alperen Çiftci (adilalperenciftci) wants to merge 2 commits into
Conversation
|
@microsoft-github-policy-service agree |
|
This seems a bit too ad-hoc and out of place for the kind of thing we normally do. It is suspicious that nothing else changed, either, and that it's purely additive? |
|
Good point on the post-sorting. I dropped that approach and replaced it with a simpler change in |
|
Rebased cleanly on current main. Whenever you get a chance, let me know if this revised getUnionSignatures arity expansion looks better to you or if you'd prefer handling the union overload matching differently. |
8f83120 to
8619e9e
Compare
|
Hi Jake Bailey (@jakebailey), just following up on this PR. The branch is rebased cleanly on current main with no conflicts. Please let me know if the revised |
|
I don't think this PR is right but can't put my finger on why. Figuring out why it feels wrong probably means I have to figure out a fix myself, which defeats the purpose a bit. |
|
I removed the exact-arity signature expansion. Besides changing the signature set, it could panic on a tuple-rest signature when the effective parameter count exceeded the raw parameter slice length. The replacement keeps the existing union-signature matching and derives precedence from each constituent's existing reorderCandidates order. This preserves literal specialization and merged-interface behavior without generating artificial arity variants. The regression fixture covers optional/rest parameters, tuple-rest, generics, constructors, three constituents, and merged declarations. Validation: npm test completed with 163,505 test records, 2,152 skipped, and no failures; npm run build and npm run check:format also passed. |
Fixes #53614
Expands signatures with optional parameters into exact-arity variants during
getUnionSignaturesso candidate overloads resolve naturally infindMatchingSignatureswithout ad-hoc post-sorting.