Fixed signature caching issue caused by reentrant signature checking - #64077
Fixed signature caching issue caused by reentrant signature checking#64077Mateusz Burzyński (Andarist) wants to merge 3 commits into
Conversation
…inapplicable reentrant calls.
| return executeFetch("x", /*argument*/data); | ||
| }, []); | ||
| export const check: Promise<string> = cb({ v: 1 });` | ||
| for _, first := range []string{"callback", "argument", "diagnostics"} { |
There was a problem hiding this comment.
In here, I just make sure the cached signatures stay the same regardless of the order of the LSP requests
There was a problem hiding this comment.
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; } | |||
There was a problem hiding this comment.
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)
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:
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