mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[CS] Re-order subscript constraint generation
Add the application constraint before the member constraint, which allows us to get rid of the special-cased delaying logic for dynamic member subscripts. The diagnostic change here is due to the fact that we no longer have a simplified type for the result in CSGen, which would also be the case if we had a disjunction for the member.
This commit is contained in:
@@ -11465,22 +11465,6 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyMemberConstraint(
|
||||
if (result.actualBaseType)
|
||||
baseTy = result.actualBaseType;
|
||||
|
||||
// If only possible choice to refer to member is via keypath
|
||||
// dynamic member dispatch, let's delay solving this constraint
|
||||
// until constraint generation phase is complete, because
|
||||
// subscript dispatch relies on presence of function application.
|
||||
if (result.ViableCandidates.size() == 1) {
|
||||
auto &choice = result.ViableCandidates.front();
|
||||
if (Phase == ConstraintSystemPhase::ConstraintGeneration &&
|
||||
choice.isKeyPathDynamicMemberLookup() &&
|
||||
member.getBaseName().isSubscript()) {
|
||||
// Let's move this constraint to the active
|
||||
// list so it could be picked up right after
|
||||
// constraint generation is done.
|
||||
return formUnsolved(/*activate=*/true);
|
||||
}
|
||||
}
|
||||
|
||||
generateOverloadConstraints(
|
||||
candidates, memberTy, result.ViableCandidates, useDC, locator,
|
||||
result.getFavoredIndex(), /*requiresFix=*/false,
|
||||
|
||||
Reference in New Issue
Block a user