Skip to content

Conversation

@xedin
Copy link
Contributor

@xedin xedin commented Aug 14, 2025

Check whether it would be possible to match a parameter type
by opening an existential type of the candidate argument.

Resolves: rdar://158159462

…enExistentialCallArgument` into a separate function

Some of the logic of `canOpenExistentialCallArgument` has to be
shared with constraint optimizer which does it's own validation
and most importantly - doesn't open overload choice type.

In order to share the logic between the solver and the optimizer,
let's extract checking that determines whether it's possible to
open existential argument into `canOpenExistentialAt`.
@xedin
Copy link
Contributor Author

xedin commented Aug 14, 2025

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Aug 14, 2025

@swift-ci please test source compatibility

Copy link
Contributor

Choose a reason for hiding this comment

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

Is the guard let essential to the test case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it needs to be unwrapped before passing it to test to make sure that the argument is non-optional and known in advance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I should note that today existential opening doesn't work for stuff like env ?? <<default>> because it currently happens in simplifyApplicableFnConstraint and at that point the argument won't be resolved. This is a bug we need to fix.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, the issue is that test() is overloaded, I see!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep!

@xedin
Copy link
Contributor Author

xedin commented Aug 14, 2025

@swift-ci please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented Aug 14, 2025

@swift-ci please test

Check whether it would be possible to match a parameter type
by opening an existential type of the candidate argument.

Resolves: rdar://158159462
@xedin
Copy link
Contributor Author

xedin commented Aug 15, 2025

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Aug 15, 2025

@swift-ci please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented Aug 15, 2025

@swift-ci please test Windows platform

1 similar comment
@xedin
Copy link
Contributor Author

xedin commented Aug 16, 2025

@swift-ci please test Windows platform

@xedin
Copy link
Contributor Author

xedin commented Aug 16, 2025

@swift-ci please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented Aug 17, 2025

@swift-ci please smoke test macOS platform

@xedin xedin merged commit a5649a1 into swiftlang:main Aug 18, 2025
7 checks passed
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