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
SR-2979 'rethrows' function with non-throwing default requires 'try'
SR-7611 Incorrect compiler error to mark try for not throwing function
SR-12109 Invalid "call can throw"-error related to default argument of closure type
SR-12389 A non-throwing default argument will require try at call site
SR-15854 Compiler thinks function closure parameter default value "throws" when it's not
relates to:
SR-14270 Add test case for diagnostic note 'because_rethrows_default_argument_throws'
Issue Description:
The following code doesn't work
funcfoo(f: () throws -> () = {}) rethrows {
tryf()
}
// Finefoo({ })
// This fails with error:// call is to 'rethrows' function,// but a defaulted argument function can throwfoo()
The text was updated successfully, but these errors were encountered:
Now that default arguments are always emitted into the client, it'd be correct to fix this…but the warning happens in Sema, before we've looked at what the default argument value is. Maybe we should record the type of the default argument before coercion or something?
extensionSequence{func checksum(transform:(Element)->Int)->Int{self.lazy.map(transform).checksum()// error: Call can throw but is not marked with 'try'}}
But that code does not compile, so I had to include the xor operator as an argument anyway.
Is there an expected timeline for when this might get fixed?
Additional Detail from JIRA
md5: c87cab07c58e67b6d6876c244ca8b69f
is duplicated by:
try
for not throwing functiontry
at call siterelates to:
Issue Description:
The following code doesn't work
The text was updated successfully, but these errors were encountered: