You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/expr/closure/closures_swift6.swift
+4-10
Original file line number
Diff line number
Diff line change
@@ -501,14 +501,14 @@ class TestGithubIssue70089 {
501
501
}
502
502
503
503
doVoidStuff{[weak self]in
504
-
doVoidStuff{[self]in // expected-error {{value of optional type 'TestGithubIssue70089?' must be unwrapped to a value of type 'TestGithubIssue70089'}} expected-note {{coalesce using '??' to provide a default when the optional value contains 'nil'}} expected-note {{force-unwrap using '!' to abort execution if the optional value contains 'nil'}}
505
-
x +=1
504
+
doVoidStuff{[self]in
505
+
x +=1 // expected-error {{explicit use of 'self' is required when 'self' is optional, to make control flow explicit}} expected-note{{reference 'self?.' explicitly}}
506
506
}
507
507
}
508
508
509
509
doVoidStuff{[weak self]in
510
-
doVoidStuff{[self]in // expected-error {{value of optional type 'TestGithubIssue70089?' must be unwrapped to a value of type 'TestGithubIssue70089'}} expected-note {{coalesce using '??' to provide a default when the optional value contains 'nil'}} expected-note {{force-unwrap using '!' to abort execution if the optional value contains 'nil'}}
511
-
self.x +=1
510
+
doVoidStuff{[self]in
511
+
self.x +=1 // expected-error {{value of optional type 'TestGithubIssue70089?' must be unwrapped to refer to member 'x' of wrapped base type 'TestGithubIssue70089'}} expected-note {{chain the optional using '?' to access member 'x' only for non-'nil' base values}} expected-note{{force-unwrap using '!' to abort execution if the optional value contains 'nil'}}
512
512
}
513
513
}
514
514
@@ -647,12 +647,6 @@ class TestGithubIssue69911 {
647
647
}
648
648
}
649
649
}
650
-
651
-
doVoidStuff{[weak self]in
652
-
doVoidStuff{[self]in // expected-error {{value of optional type 'TestGithubIssue69911?' must be unwrapped to a value of type 'TestGithubIssue69911'}} expected-note{{coalesce using '??' to provide a default when the optional value contains 'nil'}} expected-note{{force-unwrap using '!' to abort execution if the optional value contains 'nil'}}
0 commit comments