-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[TypeChecker] Clear param specifiers before re-typechecking expression for completion #36992
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
Conversation
@swift-ci Please test |
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 situation would have to be fixed in the solver to prevent bindings inferring a l-value for T10.
struct BottomMenu: MyView { | ||
var body: some MyView { | ||
let a = MyZStack(alignment: .#^COMPLETE^#center, content: {}) | ||
.my_updating(body: { state in |
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.
So here is the interesting thing about this example - original type-check of this expression succeeds and produces a well-formed call. But then typeCheckForCodeCompletion
called on type-checked AST and it seems not all of the information is erased. Why does that expression get re-typechecked that's probably where the investigation should start...
…n for completion Because we are completing inside a result builder, we are never calling into `typeCheckExpression` and thus never call into `typeCheckForCodeCompletion` before `fallbackTypeCheck` (SR-14601). This works fine in most cases, but in the added test case, we are hitting an assertion because the specifiers are not correctly erased from the `ClosureExpr` before re-typechecking for completion. Erasing them before fixes the test case until the underlying issue described above is fixed. Fixes rdar://76710904 [SR-14494]
aebab69
to
b1a4708
Compare
@xedin Thanks for your feedback. I adjusted the PR to clear the specifiers of closure expression parameters, which fixes the test case in a more principled way. There seems to be a general issue with result builders that causes all expressions in there to be re-typechecked, because we are never calling into |
@swift-ci Please test |
Because we are completing inside a result builder, we are never calling into
typeCheckExpression
and thus never call intotypeCheckForCodeCompletion
beforefallbackTypeCheck
(I filed SR-14601 to track that issue).This works fine in most cases, but in the added test case, we are hitting an assertion because the specifiers are not correctly erased from the
ClosureExpr
before re-typechecking for completion. Erasing them before fixes the test case until the underlying issue described above is fixed.Fixes rdar://76710904 [SR-14494]