mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Sema: Subscript default arguments
Fixes <https://bugs.swift.org/browse/SR-6118>.
This commit is contained in:
@@ -161,6 +161,16 @@ void constraints::simplifyLocator(Expr *&anchor,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (auto subscriptExpr = dyn_cast<SubscriptExpr>(anchor)) {
|
||||
// The target anchor is the subscript.
|
||||
targetAnchor = subscriptExpr;
|
||||
targetPath.clear();
|
||||
|
||||
anchor = subscriptExpr->getIndex();
|
||||
path = path.slice(1);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (auto objectLiteralExpr = dyn_cast<ObjectLiteralExpr>(anchor)) {
|
||||
targetAnchor = nullptr;
|
||||
targetPath.clear();
|
||||
@@ -196,6 +206,17 @@ void constraints::simplifyLocator(Expr *&anchor,
|
||||
continue;
|
||||
}
|
||||
|
||||
// The subscript itself is the function.
|
||||
if (auto subscriptExpr = dyn_cast<SubscriptExpr>(anchor)) {
|
||||
// No additional target locator information.
|
||||
targetAnchor = nullptr;
|
||||
targetPath.clear();
|
||||
|
||||
anchor = subscriptExpr;
|
||||
path = path.slice(1);
|
||||
continue;
|
||||
}
|
||||
|
||||
// The unresolved member itself is the function.
|
||||
if (auto unresolvedMember = dyn_cast<UnresolvedMemberExpr>(anchor)) {
|
||||
if (unresolvedMember->getArgument()) {
|
||||
|
||||
Reference in New Issue
Block a user