-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Sema] Don’t allow unresolved type variables if LeaveBraceStmtBodyUnchecked
is true
#36943
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
[Sema] Don’t allow unresolved type variables if LeaveBraceStmtBodyUnchecked
is true
#36943
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.
Is a solution with holes applied to the AST because this particular completion kind is still using old logic that relies on type-checked AST? If so, I think this fix is okay for now since in the future we’ll just stop doing AST transforms as switch to use typeCheckForCodeCompletion
.
Yeah, AFAICT conforming method lists hasn’t been ported to |
2ed06a4
to
75c5ed4
Compare
…checked` is `true` According to Pavel, we want to eliminate allowing unresolved variables as much as possible. Removing this flag doesn’t break any test cases (at least not in a meaningful way) and fixes a crasher, so it seems reasonable to remove it. Fixes rdar://76686564
LeaveBraceStmtBodyUnchecked
is true
75c5ed4
to
74ff692
Compare
@xedin Thanks for your feedback. As discussed offline, removing the |
@swift-ci Please test |
Build failed |
Build failed |
…or completion When doing operator completion, we re-type-check the sequence expression. If we have an unresolve type already applied to `ParsedExpr`, which is the last element of the sequence, the type checker crashes in `validation-test/IDE/crashers_2_fixed/0008-must-conform-to-literal-protocol.swift`, because there are still inactive constraints in the constraint system when it finishes solving. Previously, we would ignore because we allowed free type variables, which we no longer do since the last commit.
@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.
Makes sense to me!
Build failed |
@swift-ci Please test macOS |
We should remove another usage of |
The issues have been fixed
[Stress Tester XFails] Remove SR-14494 and swiftlang/swift#36943
[Sema] Don’t allow unresolved type variables if
LeaveBraceStmtBodyUnchecked
istrue
According to Pavel, we want to eliminate allowing unresolved variables as much as possible. Removing this flag doesn’t break any test cases (at least not in a meaningful way) and fixes a crasher, so it seems reasonable to remove it.
When doing operator completion, we re-type-check the sequence expression. If we have an unresolve type already applied to
ParsedExpr
, which is the last element of the sequence, the type checker crashes invalidation-test/IDE/crashers_2_fixed/0008-must-conform-to-literal-protocol.swift
, because there are still inactive constraints in the constraint system when it finishes solving.Previously, we would ignore because we allowed free type variables, which we no longer do since the last commit.
Fixes rdar://76686564