diff --git a/lib/Sema/CSSimplify.cpp b/lib/Sema/CSSimplify.cpp index 662e146f3129b..8d5dc905c51d4 100644 --- a/lib/Sema/CSSimplify.cpp +++ b/lib/Sema/CSSimplify.cpp @@ -10926,24 +10926,6 @@ bool ConstraintSystem::simplifyAppliedOverloadsImpl( auto *argList = getArgumentList(getConstraintLocator(locator)); - // If argument list has trailing closures and this is `init` call to - // a callable type, let's not filter anything since there is a possibility - // that it needs an implicit `.callAsFunction` to work. - if (argList && argList->hasAnyTrailingClosures()) { - if (disjunction->getLocator() - ->isLastElement()) { - auto choice = disjunction->getNestedConstraints()[0]->getOverloadChoice(); - if (auto *decl = choice.getDeclOrNull()) { - auto *dc = decl->getDeclContext(); - if (auto *parent = dc->getSelfNominalTypeDecl()) { - auto type = parent->getDeclaredInterfaceType(); - if (type->isCallableNominalType(DC)) - return false; - } - } - } - } - // Consider each of the constraints in the disjunction. retry_after_fail: bool hasUnhandledConstraints = false; diff --git a/test/Constraints/callAsFunction.swift b/test/Constraints/callAsFunction.swift index 948630d65ffd5..e66e5b1a31098 100644 --- a/test/Constraints/callAsFunction.swift +++ b/test/Constraints/callAsFunction.swift @@ -29,25 +29,3 @@ struct Test { } } } - -// rdar://92912878 - filtering prevents disambiguation of `.callAsFunction` -func test_no_filtering_of_overloads() { - struct S { - init() {} - init(_: String) {} - - func callAsFunction(_ fn: () -> T) -> T { - fn() - } - } - - func test(_: () -> Void) { - } - - test { - _ = S() { // Ok - _ = 42 - print("Hello") - } - } -} diff --git a/test/Constraints/result_builder.swift b/test/Constraints/result_builder.swift index 17906dfe2906b..b08c64a2db321 100644 --- a/test/Constraints/result_builder.swift +++ b/test/Constraints/result_builder.swift @@ -1174,27 +1174,3 @@ let list3 = list { } print(list3) // CHECK: (cons "4" (cons (cons "3" (cons 2.0 nil)) (cons 1 nil))) - -func test_callAsFunction_with_resultBuilder() { - struct CallableTest { - func callAsFunction(@TupleBuilder _ body: (Bool) -> T) { - print(body(true)) - } - } - - CallableTest() { - 0 - "with parens" - $0 - } - - CallableTest { - 1 - "without parens" - $0 - } -} - -test_callAsFunction_with_resultBuilder() -// CHECK: (0, "with parens", true) -// CHECK: (1, "without parens", true)