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
letoptOne:Int?=1lety= optOne.map{ _ inreturn()}// Constant 'y' inferred to have type '()?', which may be unexpectedletz=[""].map{ _ inreturn()}// no warning.// The expected warning would be:// Constant 'z' inferred to have type '[()]', which may be unexpected
For more information see the thread in this tweet.
The text was updated successfully, but these errors were encountered:
Should it also give a suggestion, like putting an extra set of parentheses or writing Void explicitly to silence the warning? Or is there no reasonable case where you would actually intend to do this?
<stdin>:2:5: warning: constant 'y' inferred to have type '()?', which may be unexpected
let y = x.map { print($0) }
^
<stdin>:2:5: note: add an explicit type annotation to silence this warning
let y = x.map { print($0) }
^
Additional Detail from JIRA
md5: ebcfa84ec27da83a255c80a10ed317da
Issue Description:
For more information see the thread in this tweet.
The text was updated successfully, but these errors were encountered: