Skip to content

[ConstraintSystem] Adjust contextual locators to support updated Double/CGFloat conversion #60784

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 3 commits into from
Aug 26, 2022

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Aug 25, 2022

  • Adjust contextual locator of single expression closure before coercion

Contextual conversion constraint is placed on result of closure body
and solution application logic should match that.

  • Don't use special locator for value-to-value conversions related to contextual type

Previously locator for value-to-value conversion would just drop
all the contextual information if the conversion occurred while
converting expression to a contextual type. This is incorrect for
i.e. return statements and other targets because because they
are solved separately and using the same locator would result in
a clash when solutions are merged.

Resolves: rdar://99059525

xedin added 3 commits August 25, 2022 12:38
…re coercion

Contextual conversion constraint is placed on `result of closure body`
and solution application logic should match that.
…rsions related to contextual type

Previously locator for value-to-value conversion would just drop
all the contextual information if the conversion occurred while
converting expression to a contextual type. This is incorrect for
i.e. `return` statements and other targets because because they
are solved separately and using the same locator would result in
a clash when solutions are merged.
@xedin xedin requested a review from hborla August 25, 2022 21:33
@xedin
Copy link
Contributor Author

xedin commented Aug 25, 2022

Note for posterity - I think we can remove ClosureBody locator element and use ContextualType(CTP_ClosureResult), just need to figure out what it means for diagnostics and where to store hasReturn bit that it currently uses (one possibility - a separate element in the path).

@xedin
Copy link
Contributor Author

xedin commented Aug 25, 2022

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Aug 25, 2022

@swift-ci please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented Aug 26, 2022

@swift-ci please test macOS platform

@xedin xedin merged commit 599afbf into swiftlang:main Aug 26, 2022
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