Skip to content

Commit 4b6b510

Browse files
authored
Merge pull request swiftlang#63694 from apple/revert-63140-two-way-args-in-result-builders
Revert "[CSSimplify] Don't enable `OneWayBindParam` for result builder transf…"
2 parents bba6436 + d464ac3 commit 4b6b510

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10879,7 +10879,8 @@ bool ConstraintSystem::resolveClosure(TypeVariableType *typeVar,
1087910879
// type as seen in the body of the closure and the external parameter
1088010880
// type.
1088110881
bool oneWayConstraints =
10882-
getASTContext().LangOpts.hasFeature(Feature::OneWayClosureParameters);
10882+
getASTContext().LangOpts.hasFeature(Feature::OneWayClosureParameters) ||
10883+
resultBuilderType;
1088310884

1088410885
auto *paramList = closure->getParameters();
1088510886
SmallVector<AnyFunctionType::Param, 4> parameters;

test/Constraints/result_builder_diags.swift

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ func wrapperifyInfer<T, U>(_ cond: Bool, @WrapperBuilder body: (U) -> T) -> T {
622622
}
623623

624624
let intValue = 17
625-
_ = wrapperifyInfer(true) { x in // Ok
625+
wrapperifyInfer(true) { x in // expected-error{{unable to infer type of a closure parameter 'x' in the current context}}
626626
intValue + x
627627
}
628628

@@ -1000,17 +1000,3 @@ func test_requirement_failure_in_buildBlock() {
10001000
}
10011001
}
10021002
}
1003-
1004-
func test_partially_resolved_closure_params() {
1005-
struct S<T> {
1006-
var a: String = ""
1007-
}
1008-
1009-
func test<T>(@TupleBuilder _: (S<T>) -> T) { // expected-note {{in call to function 'test'}}
1010-
}
1011-
1012-
test { // expected-error {{generic parameter 'T' could not be inferred}}
1013-
$0.a
1014-
42
1015-
}
1016-
}

0 commit comments

Comments
 (0)