Skip to content

Commit 5b897f6

Browse files
authored
Merge pull request #37221 from apple/revert-36946-rdar-61749633
Revert "[TypeChecker] PreCheck: Don't strip away tuple/paren from subscripts …"
2 parents 7462a62 + b12d57a commit 5b897f6

File tree

3 files changed

+5
-31
lines changed

3 files changed

+5
-31
lines changed

lib/Sema/PreCheckExpr.cpp

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,24 +1061,10 @@ namespace {
10611061
}
10621062

10631063
std::pair<bool, Expr *> walkToExprPre(Expr *expr) override {
1064-
// If this is a call or subscript, record the argument expression.
1065-
{
1066-
if (auto call = dyn_cast<ApplyExpr>(expr)) {
1067-
if (!isa<SelfApplyExpr>(expr)) {
1068-
CallArgs.insert(call->getArg());
1069-
}
1070-
}
1071-
1072-
if (auto *subscript = dyn_cast<SubscriptExpr>(expr)) {
1073-
CallArgs.insert(subscript->getIndex());
1074-
}
1075-
1076-
if (auto *dynamicSubscript = dyn_cast<DynamicSubscriptExpr>(expr)) {
1077-
CallArgs.insert(dynamicSubscript->getIndex());
1078-
}
1079-
1080-
if (auto *OLE = dyn_cast<ObjectLiteralExpr>(expr)) {
1081-
CallArgs.insert(OLE->getArg());
1064+
// If this is a call, record the argument expression.
1065+
if (auto call = dyn_cast<ApplyExpr>(expr)) {
1066+
if (!isa<SelfApplyExpr>(expr)) {
1067+
CallArgs.insert(call->getArg());
10821068
}
10831069
}
10841070

validation-test/Sema/type_checker_crashers_fixed/rdar61749633.swift

Lines changed: 0 additions & 12 deletions
This file was deleted.

validation-test/compiler_crashers_2_fixed/sr12990.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class ContainerTransition {
55
func completeTransition() {
66
viewControllers?[Int//.max
77
// expected-error@-1 {{no exact matches in call to subscript}}
8-
// expected-note@-2 {{found candidate with type '(Int.Type) -> Dictionary<Int, String>.SubSequence' (aka '(Int.Type) -> Slice<Dictionary<Int, String>>')}}
8+
// expected-note@-2 {{found candidate with type '((Int).Type) -> Dictionary<Int, String>.SubSequence' (aka '((Int).Type) -> Slice<Dictionary<Int, String>>')}}
99
// expected-note@-3 {{to match this opening '['}}
1010
} // expected-error {{expected ']' in expression list}}
1111
}

0 commit comments

Comments
 (0)