New issue
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
[SR-5251] Generic Sequence Function Compilation Fails #47826
Comments
@swift-ci create |
FWIW it appears to be the point-free style causing issues. This works: -return fs.flatMap { f in xs.map(f) }
+return fs.flatMap { f in xs.map { x in f(x) } } Also broken: return fs.flatMap(xs.map) See also: |
Another thing that fails, but shouldn't: public extension Sequence {
public func apply<S: Sequence, A>(_ fs: S) -> [A] where S.Element == ((Element) -> A) {
return fs.flatMap { f in self.map { x in f(x) } }
}
public static func <*> <S: Sequence, A>(fs: S, xs: Self) -> [A] where S.Element == ((Element) -> A) {
return xs.apply(fs)
// Generic parameter 'A' could not be inferred
}
}
public func apply<S: Sequence, T: Sequence, A>(_ fs: S) -> (T) -> [A] where S.Element == ((T.Element) -> A) {
return { xs in
fs <*> xs
// Type of expression is ambiguous without more context
}
} |
@stephencelis Please verify and move to closed. |
All of these issues (the main one and those listed in my follow-up comment) still persist in Xcode 9 beta 4. |
@stephencelis Interesting, the code in the description and in the follow-up compiles just fine with master branch, maybe some of the changes related to this didn't make it to Beta 4, I'll double check and let you know! |
@stephencelis I found that your original example is fixed in Xcode 9 beta 3 and Xcode 9 beta 4. The follow-on examples work with the nightly from 'master' but not with the nightly from 'swift-4.0-branch.' |
@rudkx Checked on the latest snapshot and everything is fixed in the latest snapshot except for: public extension Sequence {
public func apply<S: Sequence, A>(_ fs: S) -> [A] where S.Element == ((Element) -> A) {
return fs.flatMap(self.map)
}
}
Related issue: https://bugs.swift.org/browse/SR-5586 Thanks! |
This one remaining issue is just a dup of the other issue, so I'm going to close this out. |
Environment
Swift 4 (Xcode 9 beta)
Additional Detail from JIRA
md5: 06429d9b5bd72cef8ad6037d87c94e0f
blocks:
Issue Description:
The following code should compile, but doesn't:
The error message:
The text was updated successfully, but these errors were encountered: