Skip to content

Commit 81ba817

Browse files
committed
[Test adjustments][Sema] Type check multi-statement closures inside result builders
1 parent 7444a2f commit 81ba817

File tree

6 files changed

+17
-12
lines changed

6 files changed

+17
-12
lines changed

test/Constraints/result_builder_diags.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct TupleBuilderWithoutIf { // expected-note 3{{struct 'TupleBuilderWithoutIf
7878
static func buildDo<T>(_ value: T) -> T { return value }
7979
}
8080

81-
func tuplify<T>(_ cond: Bool, @TupleBuilder body: (Bool) -> T) {
81+
func tuplify<T>(_ cond: Bool, @TupleBuilder body: (Bool) -> T) { // expected-note 3 {{in call to function 'tuplify(_:body:)'}}
8282
print(body(cond))
8383
}
8484

@@ -88,7 +88,7 @@ func tuplifyWithoutIf<T>(_ cond: Bool, @TupleBuilderWithoutIf body: (Bool) -> T)
8888

8989
func testDiags() {
9090
// For loop
91-
tuplify(true) { _ in
91+
tuplify(true) { _ in // expected-error {{generic parameter 'T' could not be inferred}}
9292
17
9393
for c in name {
9494
// expected-error@-1 {{cannot find 'name' in scope}}
@@ -466,7 +466,7 @@ struct TestConstraintGenerationErrors {
466466
}
467467

468468
func buildTupleClosure() {
469-
tuplify(true) { _ in
469+
tuplify(true) { _ in // expected-error {{generic parameter 'T' could not be inferred}}
470470
let a = nothing // expected-error {{cannot find 'nothing' in scope}}
471471
String(nothing) // expected-error {{cannot find 'nothing' in scope}}
472472
}
@@ -733,7 +733,7 @@ struct TuplifiedStructWithInvalidClosure {
733733
}
734734

735735
@TupleBuilder var nestedErrorsDiagnosedByParser: some Any {
736-
tuplify(true) { _ in
736+
tuplify(true) { _ in // expected-error {{generic parameter 'T' could not be inferred}}
737737
tuplify { _ in
738738
self. // expected-error {{expected member name following '.'}}
739739
}
@@ -893,7 +893,7 @@ func test_associated_values_dont_block_solver_when_unresolved() {
893893
// expected-note@-1 {{chain the optional using '?' to access member 'kind' only for non-'nil' base values}}
894894
// expected-note@-2 {{force-unwrap using '!' to abort execution if the optional value contains 'nil'}}
895895

896-
switch v.kind { // expected-error {{value of type 'Value.Kind' has no member 'kind'}}
896+
switch v.kind {
897897
case .a(_): "a"
898898
case .b: "b"
899899
}

test/Parse/recovery.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ class r22240342 {
773773
lazy var xx: Int = {
774774
foo { // expected-error {{cannot find 'foo' in scope}}
775775
let issueView = 42
776-
issueView.delegate = 12
776+
issueView.delegate = 12 // expected-error {{value of type 'Int' has no member 'delegate'}}
777777

778778
}
779779
return 42

test/StringProcessing/Sema/regex_builder_fix_import_top_level.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@ Regex { // expected-error {{regex builder requires the 'RegexBuilder' module be
1919
/g(h)(i)/
2020
}
2121

22-
// FIXME: Unfortunately we bail from CSGen if we end up with an ErrorExpr, so
23-
// don't get a chance to diagnose. We ought to try solving with holes.
24-
// For now at least, this error should at least hopefully nudge users into
25-
// realizing they have a missing import.
26-
Regex {
22+
Regex { // expected-error {{regex builder requires the 'RegexBuilder' module be imported'}}
2723
Capture { // expected-error {{cannot find 'Capture' in scope}}
2824
/abc/
2925
}

test/stmt/statements.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ func matching_pattern_recursion(zs: [Int]) { // expected-note {{'zs' declared he
409409
}
410410

411411
switch 42 {
412-
case {
412+
case { // expected-error {{expression pattern of type '() -> ()' cannot match values of type 'Int'}}
413413
for i in ws { // expected-error {{cannot find 'ws' in scope; did you mean 'zs'?}}
414414
}
415415
}: break

validation-test/IDE/crashers_2_fixed/rdar85609548.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// RUN: %swift-ide-test --code-completion --code-completion-token COMPLETE --source-filename %s
22

3+
// Started failing again when type checking multi-statement closures in result builders.
4+
// Will be fixed when postfix parent completion is migrated to solver-based.
5+
// XFAIL: *
6+
37
protocol View2 {}
48

59
struct Foo {

validation-test/IDE/crashers_2_fixed/sr15502.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
// RUN: %swift-ide-test --code-completion --code-completion-token COMPLETE --source-filename %s
22
// Should not crash
33

4+
// Started failing again when type checking multi-statement closures in result builders.
5+
// Will be fixed when postfix parent completion is migrated to solver-based.
6+
// XFAIL: *
7+
8+
49
protocol View2 {}
510

611
struct Foo {

0 commit comments

Comments
 (0)