mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Resolve failing constraint for subscripts returning Self
This commit is contained in:
committed by
Slava Pestov
parent
c1c1801448
commit
b799304fca
@@ -1460,6 +1460,13 @@ Type ConstraintSystem::getEffectiveOverloadType(const OverloadChoice &overload,
|
||||
|
||||
if (doesStorageProduceLValue(subscript, overload.getBaseType(), useDC))
|
||||
elementTy = LValueType::get(elementTy);
|
||||
else {
|
||||
Type selfType = overload.getBaseType()->getRValueType()
|
||||
->getMetatypeInstanceType()
|
||||
->lookThroughAllOptionalTypes();
|
||||
if (elementTy->hasDynamicSelfType())
|
||||
elementTy = elementTy->replaceCovariantResultType(selfType, 0);
|
||||
}
|
||||
|
||||
// See ConstraintSystem::resolveOverload() -- optional and dynamic
|
||||
// subscripts are a special case, because the optionality is
|
||||
|
||||
Reference in New Issue
Block a user