Skip to content

Commit 7a5ffed

Browse files
committed
Implement 'rethrows' checking in Sema.
Now with amazing new fixes and tests for methods and generics! Swift SVN r28499
1 parent 9b67c6b commit 7a5ffed

File tree

4 files changed

+1151
-113
lines changed

4 files changed

+1151
-113
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1798,13 +1798,30 @@ ERROR(isa_pattern_value,sema_tcp,none,
17981798

17991799
ERROR(try_unhandled,sema,none,
18001800
"errors thrown from here are not handled", ())
1801+
ERROR(throwing_call_unhandled,sema,none,
1802+
"call can throw, but the error is not handled", ())
18011803
ERROR(tryless_throwing_call_unhandled,sema,none,
18021804
"call can throw, but it is not marked with 'try' and "
18031805
"the error is not handled", ())
18041806
ERROR(throw_in_nonthrowing_function,sema,none,
18051807
"error is not handled because the enclosing function "
18061808
"is not declared 'throws'", ())
18071809

1810+
ERROR(throwing_call_in_rethrows_function,sema,none,
1811+
"throwing call in 'rethrows' function is not to a parameter "
1812+
"function", ())
1813+
ERROR(tryless_throwing_call_in_rethrows_function,sema,none,
1814+
"throwing call in 'rethrows' function is not to a parameter "
1815+
"function and is not marked with 'try'", ())
1816+
ERROR(throw_in_rethrows_function,sema,none,
1817+
"'rethrows' function may only throw by calling a parameter "
1818+
"function", ())
1819+
NOTE(because_rethrows_argument_throws,sema,none,
1820+
"call is to 'rethrows' function, but argument function can throw", ())
1821+
NOTE(because_rethrows_default_argument_throws,sema,none,
1822+
"call is to 'rethrows' function, but a defaulted argument function"
1823+
" can throw", ())
1824+
18081825
ERROR(throwing_call_in_nonthrowing_autoclosure,sema,none,
18091826
"call can throw, but it is executed in a non-throwing "
18101827
"autoclosure",())
@@ -1818,11 +1835,11 @@ ERROR(throw_in_nonthrowing_autoclosure,sema,none,
18181835
ERROR(try_unhandled_in_nonexhaustive_catch,sema,none,
18191836
"errors thrown from here are not handled because the "
18201837
"enclosing catch is not exhaustive", ())
1838+
ERROR(throwing_call_in_nonexhaustive_catch,sema,none,
1839+
"call can throw, but the enclosing catch is not exhaustive", ())
18211840
ERROR(tryless_throwing_call_in_nonexhaustive_catch,sema,none,
18221841
"call can throw, but it is not marked with 'try' and "
18231842
"the enclosing catch is not exhaustive", ())
1824-
ERROR(throwing_call_in_nonexhaustive_catch,sema,none,
1825-
"call can throw, but the enclosing catch is not exhaustive", ())
18261843
ERROR(throw_in_nonexhaustive_catch,sema,none,
18271844
"error is not handled because the enclosing catch is not exhaustive", ())
18281845

0 commit comments

Comments
 (0)