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
[DiagnosticQol][SR-14505] Use DeclDescriptive kind in missing return data flow diagnostics (#36952)
* [Diagnostics] Use DeclDescriptiveKind on data flow diagnostics to improve diagnostic message
* [tests] Add regression tests to SILOptimizer/return.swift
* [tests] Adapt other tests to changes of SR-14505
* [Diagnostics] Adapt message for missing return diagnostics, remove article
* [Diagnostics] Adapt message for missing return diagnostics to have a note with fix
* [tests] Adjust tests in validation suit
Copy file name to clipboardExpand all lines: test/FixCode/fixits-omit-return.swift
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -2,24 +2,28 @@
2
2
3
3
func ff_fixit_addreturn()->String{
4
4
print("entering ff_fixit_addreturn()")
5
-
"foo" // expected-warning {{string literal is unused}} expected-error {{missing return in a function expected to return 'String'; did you mean to return the last expression?}} {{5-5=return }}
5
+
"foo" // expected-warning {{string literal is unused}} expected-error {{missing return in global function expected to return 'String'}}
6
+
// expected-note@-1 {{did you mean to return the last expression?}}{{5-5=return }}
6
7
}
7
8
8
9
letcl_fixit_addreturn:()->String={
9
10
print("entering cl_fixit_addreturn()")
10
-
"foo" // expected-warning {{string literal is unused}} expected-error {{missing return in a closure expected to return 'String'; did you mean to return the last expression?}} {{5-5=return }}
11
+
"foo" // expected-warning {{string literal is unused}} expected-error {{missing return in closure expected to return 'String'}}
12
+
// expected-note@-1 {{did you mean to return the last expression?}}{{5-5=return }}
11
13
}
12
14
13
15
func ff_fixit_addreturn_ifdecl()->String{
14
16
#if true
15
17
print("entering ff_fixit_addreturn_ifdecl()")
16
-
"foo" // expected-warning {{string literal is unused}} expected-error {{missing return in a function expected to return 'String'; did you mean to return the last expression?}} {{5-5=return }}
18
+
"foo" // expected-warning {{string literal is unused}} expected-error {{missing return in global function expected to return 'String'}}
19
+
// expected-note@-1 {{did you mean to return the last expression?}}{{5-5=return }}
17
20
#endif
18
21
}
19
22
20
23
letcl_fixit_addreturn_ifdecl:()->String={
21
24
#if true
22
25
print("entering cl_fixit_addreturn_ifdecl()")
23
-
"foo" // expected-warning {{string literal is unused}} expected-error {{missing return in a closure expected to return 'String'; did you mean to return the last expression?}} {{5-5=return }}
26
+
"foo" // expected-warning {{string literal is unused}} expected-error {{missing return in closure expected to return 'String'}}
27
+
// expected-note@-1 {{did you mean to return the last expression?}}{{5-5=return }}
0 commit comments