mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[NFC] Correct constraint system assumption
We currently assume that, if a subscript is declared within a value type’s decl, it must need `self` to be passed inout. This isn’t true for static subscripts, because even though the DeclContext is a value type, the metatype is actually a reference type. Skip this check for non-instance members. NFC until static subscripts are added.
This commit is contained in:
@@ -1287,7 +1287,8 @@ ConstraintSystem::getTypeOfMemberReference(
|
||||
// If self is a value type and the base type is an lvalue, wrap it in an
|
||||
// inout type.
|
||||
auto selfFlags = ParameterTypeFlags();
|
||||
if (!outerDC->getDeclaredInterfaceType()->hasReferenceSemantics() &&
|
||||
if (isInstance &&
|
||||
!outerDC->getDeclaredInterfaceType()->hasReferenceSemantics() &&
|
||||
baseTy->is<LValueType>() &&
|
||||
!selfTy->hasError())
|
||||
selfFlags = selfFlags.withInOut(true);
|
||||
|
||||
Reference in New Issue
Block a user