We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apple Swift version 3.0 (swiftlang-800.0.30 clang-800.0.24). OS X 10.11.5 (15F34) Xcode 8.0 beta (8S128d)
md5: 87c5a0a7f77c314a39495f411bd985df
duplicates:
Issue Description:
When using ..< to generate the range to map over, the compiler can not resolve ..< when the closure is more complex.
The error is:
error: repl.swift:1:21: error: ambiguous reference to member '..<' let result = (0 ..< 4).map { ^~~
Swift...<:14:13: note: found this candidate public func ..<<Bound : Comparable>(minimum: Bound, maximum: Bound) -> Range<Bound> ^
Swift...<:14:13: note: found this candidate public func ..<<Bound : _Strideable where Bound : Comparable, Bound.Stride : Integer>(minimum: Bound, maximum: Bound) -> CountableRange<Bound>
Code that works:
let result = (0 ..< 4).map { $0 }
Code that doesn't work:
let result = (0 ..< 4).map { let temp = $0 return temp }
and
let result = (0 ..< 4).map { a in let temp = a return temp }
The text was updated successfully, but these errors were encountered:
Comment by Magnus Ahltorp (JIRA)
let range = 0..<4 let result = range.map { (a: Int) in let temp = a return temp }
results in
error: repl.swift:2:20: error: expression type '[_]' is ambiguous without more context
while
let range = 0..<4 let result : [Int] = range.map { (a: Int) in let temp = a return temp }
works.
Sorry, something went wrong.
There's some explanation linked in SR-1570.
No branches or pull requests
Environment
Apple Swift version 3.0 (swiftlang-800.0.30 clang-800.0.24).
OS X 10.11.5 (15F34)
Xcode 8.0 beta (8S128d)
Additional Detail from JIRA
md5: 87c5a0a7f77c314a39495f411bd985df
duplicates:
Issue Description:
When using ..< to generate the range to map over, the compiler can not resolve ..< when the closure is more complex.
The error is:
error: repl.swift:1:21: error: ambiguous reference to member '..<'
let result = (0 ..< 4).map {
^~~
Swift...<:14:13: note: found this candidate
public func ..<<Bound : Comparable>(minimum: Bound, maximum: Bound) -> Range<Bound>
^
Swift...<:14:13: note: found this candidate
public func ..<<Bound : _Strideable where Bound : Comparable, Bound.Stride : Integer>(minimum: Bound, maximum: Bound) -> CountableRange<Bound>
Code that works:
let result = (0 ..< 4).map {
$0
}
Code that doesn't work:
let result = (0 ..< 4).map {
let temp = $0
return temp
}
and
let result = (0 ..< 4).map { a in
let temp = a
return temp
}
The text was updated successfully, but these errors were encountered: