mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Sema: Fix synthesis of materializeForSet for subscripts in protocol extensions
Since each override of a subscript protocol requirement provides its own materializeForSet, there is no need to do dynamic dispatch, a peer call to the setter suffices. However, since CodeSynthesis runs at the AST level, it would create a SubscriptExpr which overload resolution would later bind to the protocol requirement subscript rather than the static witness in the extension. This triggered an assertion. Solve the problem by binding the actual ConcreteDeclRef of the SubscriptExpr at synthesis time, and modifying CSGen to special-case SubscriptExprs that already have a ConcreteDeclRef set. Fixes <rdar://problem/21370629>. Swift SVN r29906
This commit is contained in:
@@ -580,7 +580,7 @@ static Expr *buildStorageReference(
|
||||
|
||||
if (auto subscript = dyn_cast<SubscriptDecl>(storage)) {
|
||||
Expr *indices = referenceContext.getIndexRefExpr(ctx, subscript);
|
||||
return new (ctx) SubscriptExpr(selfDRE, indices, ConcreteDeclRef(),
|
||||
return new (ctx) SubscriptExpr(selfDRE, indices, storage,
|
||||
IsImplicit, semantics);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user