Skip to content

Fixed signature caching issue caused by reentrant signature checking - #64077

Open
Mateusz Burzyński (Andarist) wants to merge 3 commits into
microsoft:mainfrom
Andarist:fix-63949-reentrant-signature-cache
Open

Fixed signature caching issue caused by reentrant signature checking#64077
Mateusz Burzyński (Andarist) wants to merge 3 commits into
microsoft:mainfrom
Andarist:fix-63949-reentrant-signature-cache

Conversation

@Andarist

Copy link
Copy Markdown
Contributor

fixes #63949 by porting #60208 (that's basically put in the first commit in this PR).

This is basically the same as #64014 but it comes with an extra commit that doesn't regress this case:

declare const example: (f: (a: string) => number) => string;

const f = (a: string) => g();

const g = () => {
    return example(f);
};

The above should error but by porting #60208 alone, it stops doing that.

In fact, the second commit is enough to fix #63949 , the porting commit is not strictly needed for this - but I decided to keep it here as part of the Corsa-Strada alignment efforts

Copilot AI balanced review requested due to automatic review settings August 28, 2026 16:43
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Aug 28, 2026
return executeFetch("x", /*argument*/data);
}, []);
export const check: Promise<string> = cb({ v: 1 });`
for _, first := range []string{"callback", "argument", "diagnostics"} {

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 here, I just make sure the cached signatures stay the same regardless of the order of the LSP requests

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Prevents reentrant signature resolution from using a function’s inferred return type as contextual evidence for its own body.

Changes:

  • Adds the self-signature guard in contextual return-type resolution.
  • Adds compiler and Fourslash regression coverage.
  • Updates affected type, symbol, and diagnostic baselines.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tsc/internal/checker/checker.go Excludes a function’s own signature from contextual return typing.
tsc/internal/fourslash/tests/quickInfoGenericDefaultInReentrantCallResolution_test.go Tests stable diagnostics and quick info across request orders.
tsc/testdata/tests/cases/compiler/genericDefaultInReentrantCallResolution.ts Reproduces issue #63949.
tsc/testdata/tests/cases/compiler/reentrantCallDoesNotReuseInapplicableCachedSignature.ts Covers the related invalid-call regression.
tsc/testdata/baselines/reference/compiler/genericDefaultInReentrantCallResolution.types Records corrected inferred types.
tsc/testdata/baselines/reference/compiler/genericDefaultInReentrantCallResolution.symbols Records symbols for the regression case.
tsc/testdata/baselines/reference/compiler/reentrantCallDoesNotReuseInapplicableCachedSignature.types Records expected types for the error case.
tsc/testdata/baselines/reference/compiler/reentrantCallDoesNotReuseInapplicableCachedSignature.symbols Records expected symbols for the error case.
tsc/testdata/baselines/reference/compiler/reentrantCallDoesNotReuseInapplicableCachedSignature.errors.txt Verifies the expected assignability diagnostic.
tsc/testdata/baselines/reference/conformance/neverReturningFunctions1.types Updates affected literal widening.
tsc/testdata/baselines/reference/conformance/intraExpressionInferencesJsx.types Updates affected JSX inference baselines.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@@ -143,10 +143,10 @@ const Component = <T extends Animations>({
>func : () => { a: true; }

return {
>{ a: true, } : { a: true; }

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.

I think those are correct, the inferred signature here includes boolean and then that object became checked with that as its contextual part so a true literal became here contextually-typed by a boolean and that makes it to retain the true type (instead of widening to boolean)

注册 for free to join this conversation on GitHub. Already have an account? 登录 to comment

标签

None yet

项目

Status: Not started

Development

Successfully merging this pull request may close these issues.

[7.0 regression] Type parameter default is ignored when the call sits inside a callback passed to a generic function

2 participants