-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Constraint solver] Compute common apply result type in the solver. #22977
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
[Constraint solver] Compute common apply result type in the solver. #22977
Conversation
These functions appear to have been part of an implementation of constraint propagation that was removed or never committed; remove them. NFC
Constraint generation for function application expressions contains a simple hack to try to find the common result type for an overload set containing callable things. Instead, perform this “common result type” computation when simplifying an applicable function constraint, so it is more widely applicable.
Extend the computation of effective overload types, used in common result type and common type computations, to also handle subscripts and variables. This allows the optimization to also apply to subscripts, which did not previously have a peephole in constraint generation.
@swift-ci please smoke test |
@swift-ci please smoke test compiler performance |
Compilation-performance test failed |
Tests? |
… inits. There are multiple ways in which the Clang importer can produce an initializer, and we have existing name shadowing rules to decide on the best. Extend those rules to cover the case where a Clang-importer-synthesized initializer collides with a C function imported as an initializer. There's technically no reason to do the latter because the former already exists, but some frameworks currently depend on this. Prior to this, the constraint solver was preferring the synthesized initializer already (which is the right thing to do), for the wrong reasons.
@slavapestov added some targeted tests to make sure this is doing what we expect. |
@swift-ci please smoke test |
@swift-ci please test source compatibility |
@swift-ci please smoke test |
@swift-ci please test source compatibility |
@swift-ci please smoke test compiler performance |
1 similar comment
@swift-ci please smoke test compiler performance |
@swift-ci please smoke test Linux |
@slavapestov I'm going to merge this so I can build another PR on it, and address your remaining two comments separately. Thank you! |
Constraint generation for function application expressions contains a simple
hack to try to find the common result type for an overload set containing
callable things. Instead, perform this “common result type” computation
when simplifying an applicable function constraint, so it is more
widely applicable.