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
Just chiming in with a +1 since this (and its dupes) have been open for awhile. I've hit this problem many times over the years. Sometimes I immediately recognize the issue, sometimes it takes a few minutes, and sometimes I need the eyes of a colleague to jolt my brain into proper diagnostic order, so I really wish the compiler would take care of this for me 🙂
Cannot convert value of type '(A) -> IO<B>' to expected argument type '() -> IO<>'
Fix it: Insert ' as! () -> IO<>'
Maybe we lose the current fix-it, add warnings or errors per overshadowed generic (is there ever a reason to want to shadow a generic parameter?), and they can have fix-its to remove the shadowing?
Part of the inaction around any shadowing warnings is that there hasn't been a general discussion of what kinds of shadowing are okay and what aren't (a very subjective question), and that has the potential to be a sprawling discussion. I'm not sure we can agree to just deal with a little bit of it and ignore the rest, but if there's anywhere where it would make sense it would be this case: a member of a generic type whose generic parameters are exactly the same as the type's.
Environment
OSX El Capitan 10.11.4
Xcode 7.3
Additional Detail from JIRA
md5: 4a05a8615ae667cb3fe37027d209d99e
is duplicated by:
relates to:
Issue Description:
The swift compiler should warn users when they are accidentally shadowing generic type parameters in their code.
Code
Error
What I'd want to see, more or less
Related Stack Overflow Question
The text was updated successfully, but these errors were encountered: