Created
September 20, 2014 16:06
-
-
Save maxcan/e2ccadcc2e3a78fd0b9e to your computer and use it in GitHub Desktop.
type inference failing on closures
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this compiles: | |
private func loadMessages() { | |
getMsgList(self.auth).map() { (listRes:Result<MsgList>) -> Void in | |
switch(listRes) { | |
case let .Value(v): | |
die("swift needs type holes",43) | |
case let .Error(e): die("ERROR getting msgres: \(e)", 6) | |
} | |
return | |
} | |
} | |
// This fails with: | |
// Cannot convert the expression's type '(($T8) -> ($T8) -> $T7) -> (($T8) -> $T7) -> $T7' to type 'B' | |
private func loadMessages() { | |
getMsgList(self.auth).map() { | |
switch($0) { | |
case let .Value(v): | |
die("swift needs type holes",43) | |
case let .Error(e): die("ERROR getting msgres: \(e)", 6) | |
} | |
return | |
} | |
} | |
// same failure as above | |
private func loadMessages() { | |
getMsgList(self.auth).map() { a in | |
switch(a) { | |
case let .Value(v): | |
die("swift needs type holes",43) | |
case let .Error(e): die("ERROR getting msgres: \(e)", 6) | |
} | |
return | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment