-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Do not report errors when inference is partially blocked #52728
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
Do not report errors when inference is partially blocked #52728
Conversation
src/compiler/checker.ts
Outdated
@@ -32601,7 +32604,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { | |||
const isTaggedTemplate = node.kind === SyntaxKind.TaggedTemplateExpression; | |||
const isDecorator = node.kind === SyntaxKind.Decorator; | |||
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node); | |||
const reportErrors = !candidatesOutArray; | |||
const reportErrors = !isInferencePartiallyBlocked && !candidatesOutArray; |
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.
alternatively, we could check checkMode
but ContextFlags.Completions
isn't currently passed down as any kind of checkMode
(whereas CheckMode.IsForStringLiteralArgumentCompletions
already exists). So this would require some additional plumbing and I'm not sure if that's desired
goTo.marker("1"); | ||
verify.completions({ exact: undefined }); | ||
verify.noErrors(); |
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.
this was reporting excess property check - I still think that perhaps it shouldn't cause applicability error in this case when requesting completions but that's a separate problem
goTo.marker("1"); | ||
const markerPosition = test.markers()[0].position; | ||
edit.paste(`bar: { fn: (a: string, b) => {}, thing: "asd" },`) | ||
edit.replace(markerPosition + 4, 1, 'z') | ||
verify.completions({ isNewIdentifierLocation: true }); | ||
verify.noErrors(); |
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.
This was an interesting case because the whole argument got blocked and thus A
and B
were replaced with their constraints and thus typing the argument Funcs<unknown, Record<string, unknown>>
. And then the argument became not assignable to this target type - see the playground here
src/compiler/checker.ts
Outdated
const result = fn(); | ||
isInferencePartiallyBlocked = false; |
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.
Is this reentrant such that you should save the value and restore it, rather than unconditionally setting false?
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.
I intentionally ignored this to keep the implementation simpler as I dont think it is
@typescript-bot pack this |
Heya @DanielRosenwasser, I've started to run the diff-based top-repos suite (tsserver) on this PR at dbd8664. You can monitor the build here. |
Heya @DanielRosenwasser, I've started to run the diff-based user code test suite (tsserver) on this PR at dbd8664. You can monitor the build here. |
Heya @DanielRosenwasser, I've started to run the tarball bundle task on this PR at dbd8664. You can monitor the build here. |
This looks good to me, but will wait until our extended tests work again to approve 🥲 |
Hey @DanielRosenwasser, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running |
The test stuff is working again, but this PR has a conflict now so I don't know if they'd actually give the right results. |
…sts-with-blocked-inference # Conflicts: # src/compiler/checker.ts
@jakebailey conflicts resolved |
@typescript-bot test this |
Heya @jakebailey, I've started to run the perf test suite on this PR at 92ec29e. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the extended test suite on this PR at 92ec29e. You can monitor the build here. |
Heya @jakebailey, I've started to run the tarball bundle task on this PR at 92ec29e. You can monitor the build here. |
Heya @jakebailey, I've started to run the diff-based top-repos suite on this PR at 92ec29e. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the parallelized Definitely Typed test suite on this PR at 92ec29e. You can monitor the build here. |
Heya @jakebailey, I've started to run the diff-based user code test suite (tsserver) on this PR at 92ec29e. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the diff-based user code test suite on this PR at 92ec29e. You can monitor the build here. Update: The results are in! |
Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build and an npm module you can use via |
@jakebailey Here are the results of running the user test suite comparing Everything looks good! |
Heya @jakebailey, I've run the RWC suite on this PR - assuming you're on the TS core team, you can view the resulting diff here. |
@jakebailey Here are the results of running the user test suite comparing Everything looks good! |
Just to check my understanding, this silences the errors, but is it possible that information related to those errors persists in some cache? |
This silences error reporting but before |
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.
I think I thought that we'd leave stuff around in relation checking, but, I guess that's not actually a problem.
Ye, if I understand correctly the relationship cache is stable~ since it just caches the results of comparing A and B but that's totally unrelated to where those A and B are coming from. |
@jakebailey Here are the results of running the top-repos suite comparing Everything looks good! |
@jakebailey Here are the results of running the top-repos suite comparing Something interesting changed - please have a look. Detailsangular/angular-cli
|
@jakebailey Here are some more interesting changes from running the top-repos suite Detailsionic-team/ionic-framework
|
@jakebailey Here are some more interesting changes from running the top-repos suite Detailspnpm/pnpm
|
@jakebailey Here are some more interesting changes from running the top-repos suite Detailstrpc/trpc
|
@jakebailey Here they are:
CompilerComparison Report - main..52728
System
Hosts
Scenarios
TSServerComparison Report - main..52728
System
Hosts
Scenarios
StartupComparison Report - main..52728
System
Hosts
Scenarios
Developer Information: |
fixes #50818
sort of supersedes #52393
cc @andrewbranch @weswigham