Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/Sema/CSSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9866,7 +9866,9 @@ static Type getOpenedResultBuilderTypeFor(ConstraintSystem &cs,
auto *calleeLocator = cs.getCalleeLocator(cs.getConstraintLocator(locator));
auto selectedOverload = cs.findSelectedOverloadFor(calleeLocator);
if (!(selectedOverload &&
selectedOverload->choice.getKind() == OverloadChoiceKind::Decl))
(selectedOverload->choice.getKind() == OverloadChoiceKind::Decl ||
selectedOverload->choice.getKind() ==
OverloadChoiceKind::DeclViaUnwrappedOptional)))
return Type();

auto *choice = selectedOverload->choice.getDecl();
Expand Down
16 changes: 16 additions & 0 deletions test/Constraints/result_builder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1198,3 +1198,19 @@ func test_callAsFunction_with_resultBuilder() {
test_callAsFunction_with_resultBuilder()
// CHECK: (0, "with parens", true)
// CHECK: (1, "without parens", true)

do {
struct S {
static func test<T>(@TupleBuilder _ body: (Bool) -> T) -> S {
print(body(true))
return .init()
}
}

let _: S? = .test {
42
""
[$0]
}
// CHECK: (42, "", [true])
}