Skip to content

Commit ea5a31d

Browse files
committed
[NFC] Add a test for constraint generation failures in a pattern binding
decl inside of a function builder.
1 parent ebf01c9 commit ea5a31d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/Constraints/function_builder_diags.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,11 +418,14 @@ func testNonExhaustiveSwitch(e: E) {
418418
// rdar://problem/59856491
419419
struct TestConstraintGenerationErrors {
420420
@TupleBuilder var buildTupleFnBody: String {
421+
let a = nil // expected-error {{'nil' requires a contextual type}}
421422
String(nothing) // expected-error {{cannot find 'nothing' in scope}}
422423
}
423424

424425
func buildTupleClosure() {
425-
tuplify(true) { _ in
426+
// FIXME: suppress the ambiguity error
427+
tuplify(true) { _ in // expected-error {{type of expression is ambiguous without more context}}
428+
let a = nothing // expected-error {{cannot find 'nothing' in scope}}
426429
String(nothing) // expected-error {{cannot find 'nothing' in scope}}
427430
}
428431
}

0 commit comments

Comments
 (0)