Skip to content

[5.5][Sema] Don’t allow unresolved type variables if LeaveBraceStmtBodyUnchecked is true #37309

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

Merged

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented May 7, 2021

Cherry-picking #36943 to 5.5


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 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.

Fixes rdar://76686564

ahoppen added 2 commits May 7, 2021 14:09
…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
…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.
@ahoppen ahoppen requested a review from akyrtzi May 7, 2021 12:10
@ahoppen ahoppen requested a review from a team as a code owner May 7, 2021 12:10
@ahoppen
Copy link
Member Author

ahoppen commented May 7, 2021

@swift-ci Please test

@akyrtzi akyrtzi merged commit d0c9b6b into swiftlang:release/5.5 May 7, 2021
@ahoppen ahoppen deleted the pr-5.5/conforming-methods-in-closure branch May 7, 2021 17:46
ahoppen added a commit to ahoppen/swift that referenced this pull request May 10, 2021
Remove the `TypeCheckExprFlags::AllowUnresolvedTypeVariables` flag, fixing another occurance of rdar://76686564 (swiftlang#37309)

This does not break anything in the test suite, so I think the removal of the flag is fine.

Resolves rdar://76686564 and rdar://77659417
ahoppen added a commit to ahoppen/swift that referenced this pull request May 11, 2021
Remove the `TypeCheckExprFlags::AllowUnresolvedTypeVariables` flag, fixing another occurance of rdar://76686564 (swiftlang#37309)

This does not break anything in the test suite, so I think the removal of the flag is fine.

Resolves rdar://76686564 and rdar://77659417
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants