-
Notifications
You must be signed in to change notification settings - Fork 764
Handle blockedStringType
#1266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle blockedStringType
#1266
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for returning blockedStringType for certain string literals and re-enables previously skipped string-completion tests by removing their skips and cleaning up the failing-tests list.
- Implement
isSkipDirectInferenceNodecheck to returnblockedStringTypeincheckExpressionWorker - Un-skip four legacy fourslash tests and remove them from
failingTests.txt - Remove the
NodeFlagsSkipDirectInferenceconstant
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| internal/fourslash/tests/gen/stringLiteralCompletionsInPositionTypedUsingRest_test.go | Removed t.Skip() to enable the test |
| internal/fourslash/tests/gen/stringLiteralCompletionsForGenericConditionalTypesUsingTemplateLiteralTypes_test.go | Removed t.Skip() to enable the test |
| internal/fourslash/tests/gen/stringCompletionsFromGenericConditionalTypesUsingTemplateLiteralTypes_test.go | Removed t.Skip() to enable the test |
| internal/fourslash/tests/gen/completionsLiteralMatchingGenericSignature_test.go | Removed t.Skip() to enable the test |
| internal/fourslash/_scripts/failingTests.txt | Cleaned up entries for the now-passing tests |
| internal/checker/checker.go | Added if c.isSkipDirectInferenceNode(node) { return c.blockedStringType } |
| internal/ast/nodeflags.go | Removed NodeFlagsSkipDirectInference constant |
Comments suppressed due to low confidence (2)
internal/ast/nodeflags.go:43
- The
NodeFlagsSkipDirectInferenceconstant was removed but is still referenced byc.isSkipDirectInferenceNode. Re-add this flag or update the inference logic to use the correct mechanism.
NodeFlagsJsonFile NodeFlags = 1 << 25 // If node was parsed in a Json
internal/checker/checker.go:7354
- [nitpick] The comment
!!! Handle blockedStringTypeis informal and may confuse future readers; consider replacing it with a clear description, e.g.,// Skip direct inference for blocked string literals.
case ast.KindStringLiteral, ast.KindNoSubstitutionTemplateLiteral:
|
Seems like there might be some nondeterministic behavior based on the test failures? |
Yep, which is really surprising to me... @Andarist if you want, I can investigate this when I'm done with my current batch of completions/fourslash fixes. |
|
@jakebailey pointed me to the cause of non-determinism (thanks!) so it's fixed now |
No description provided.