Skip to content
This repository was archived by the owner on Sep 1, 2026. It is now read-only.

Fix conditional instantiation cache key mismatch for unresolved conditional types - #3501

Merged
Anders Hejlsberg (ahejlsberg) merged 1 commit into
microsoft:mainfrom
Andarist:fix/deferred-conditional-cache-key
Apr 22, 2026
Merged

Anders Hejlsberg (ahejlsberg) merged 1 commit into
microsoft:mainfrom
Andarist:fix/deferred-conditional-cache-key

Conversation

@Andarist

Copy link
Copy Markdown
Contributor

fix #3488

@@ -23815,7 +23816,7 @@ func (c *Checker) getTypeFromConditionalTypeNode(node *ast.Node) *Type {
links.resolvedType = c.getConditionalType(root, nil /*mapper*/, false /*forConstraint*/, nil)
if outerTypeParameters != nil {
root.instantiations = make(map[CacheHashKey]*Type)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In Strada this key:

root.instantiations.set(getTypeListId(outerTypeParameters), links.resolvedType)

would match the key computed here:

const id = (forConstraint ? "C" : "") + getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);

for undefined alias and forConstraint === false.

But Corsa uses a dedicated getConditionalTypeKey that produces a different result in this case than getTypeListKey(outerTypeParameters).

@ahejlsberg
Anders Hejlsberg (ahejlsberg) added this pull request to the merge queue Apr 22, 2026
Merged via the queue into microsoft:main with commit 5f57ade Apr 22, 2026
21 checks passed
Jake Bailey (jakebailey) pushed a commit to jakebailey/TypeScript that referenced this pull request Aug 13, 2026
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.

Repeated identical conditional return type triggers TS2719 ("Two different types with this name exist") under tsgo

2 participants