Skip to content

[CSApply] A couple of locator adjustments to support updated Double<->CGFloat conversion #59902

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 5 commits into from
Jul 7, 2022

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Jul 6, 2022

#59762 made it possible to use Double<->CGFloat conversions in different
arguments positions of the same call, but it didn't account for the fact that
some locators are constructed incorrectly by ExprRewriter during solution
application.

This PR adjusts locators for the following situations:

  • Array/dictionary element coercions adjusted to use <collection> -> tuple element # locator;
  • Assignment source -> destination type coercion is adjusted to use assignment expression
    itself since this is where the conversion constraint is placed (which is also very helpful for diagnostics).

Resolves: rdar://96469597
Resolves: rdar://96477064
Resolves: rdar://96477058
Resolves: #59932

@xedin xedin requested a review from hborla July 6, 2022 04:11
@xedin
Copy link
Contributor Author

xedin commented Jul 6, 2022

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Jul 6, 2022

@swift-ci please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented Jul 7, 2022

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Jul 7, 2022

@swift-ci please test source compatibility

Copy link
Collaborator

@AnthonyLatsis AnthonyLatsis left a comment

Choose a reason for hiding this comment

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

NFC remarks only (not worth relaunching already triggered tests).

xedin added 5 commits July 7, 2022 09:14
Double/CGFloat implicit conversion expects a full locator
(array-expr + tuple-element <idx>) to find selected overload.
…onary key/value

Original locator carries information about key and value types which
is necessary for diagnostics but cannot be retrieved in its original
state during solution application, so it could be dropped from Double<->CGFloat
constructor locator.
Just like in case of array elements, the locator needs to much what
was produced by constraint generator otherwise Double<->CGFloat implicit
coercion wouldn't be able to find the overload choice.
…nation type

Constraint generator records conversion between source and destination
types as anchored on an assignment, which means that coercion has to do
the same in case restrictions (like Double<->CGFloat conversion) depend
on locators to retrieve information for the solution.
The locator needs to much what was produced by constraint generator
otherwise Double<->CGFloat implicit coercion wouldn't be able to
find the overload choice.
@xedin
Copy link
Contributor Author

xedin commented Jul 7, 2022

@swift-ci please smoke test

@xedin xedin merged commit b353723 into swiftlang:main Jul 7, 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.

Assert when typechecking with CALayer
3 participants