Skip to content

[4.0] Fold ConstraintSolver::coerceToRValue() into TypeChecker::coerceToRValue() #10288

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
merged 1 commit into from
Jun 15, 2017

Conversation

DougGregor
Copy link
Member

@DougGregor DougGregor commented Jun 15, 2017

Explanation: The type checker failed to handle tuples containing lvalues (e.g., references to "var" properties in a class) along some paths, causing crashes in SILGen and (for asserts builds) AST verifier errors.
Scope: It's not clear that this ever worked, but seems fairly common. I think we've just made users suffer needlessly by getting this wrong.
Radar: rdar://problem/32700180
Risk: Low; re-use an established code path to fix the problems here rather than a poor duplication of it.
Testing: Tested example from radar, plus normal compiler qualification.

…lue()

ConstraintSolver::coerceToRValue() missed a bunch of cases where we
should be dealing with lvalues, e.g., tuples, "try" expressions, and
so on. Extend TypeChecker::coerceToRValue() to deal with the
expression type side-tables and ConstraintSolver::coerceToRValue() to
it.

Fixes rdar://problem/32700180, a crash-on-valid.
@DougGregor DougGregor added this to the Swift 4.0 milestone Jun 15, 2017
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor DougGregor requested review from slavapestov and rudkx June 15, 2017 19:47
Copy link
Contributor

@rudkx rudkx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@ematejska
Copy link
Contributor

@swift-ci test source-compatibility

@ematejska
Copy link
Contributor

@swift-ci Please test source compatibility

@DougGregor
Copy link
Member Author

Source compatibility suite has yet to recover from the SDK update, so it's not providing signal here.

@DougGregor DougGregor merged commit 94aeacc into swiftlang:swift-4.0-branch Jun 15, 2017
@DougGregor DougGregor deleted the coerce-to-rvalue branch June 15, 2017 23:06
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.

4 participants