-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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-4969] Generic parameter could not be inferred. #47546
Comments
@rudkx, @airspeedswift, any idea why there wouldn't be enough type information here? |
+ @natecook1000 who might have seen this before |
@swift-ci create |
This seems to be related to SR-922: the tuple labels of |
Comment by Paul Ossenbruggen (JIRA) Is there a workaround for this? |
Yes - remap the dictionary to be tuple-less e.g. d1.merge(d2.lazy.map { ($0.key,$0.value) }) Ugly but should work until this is resolved (which is already done on GitHub) |
Comment by Paul Ossenbruggen (JIRA) Great! Thanks so much, that worked. |
Ben meant to say "label-less" or unlabeled tuple. |
This seems to be working now (Xcode 9 beta 3). |
Environment
macOS 10.12.5
Xcode 8.3.2
Swift Development Snapshot 2017-05-21 (a)
Additional Detail from JIRA
md5: d2daf56b398d2bb6d5c3f3d75f1b03d4
is duplicated by:
Generic parameter 'S' could not be inferred
when callingmerging(_:uniquingKeysWith:)
method on Dictionary<String, Any> instanceIssue Description:
There are two function of Dictionary could not use.
public mutating func merge<S>(_ other: S, uniquingKeysWith combine: (Dictionary.Value, Dictionary.Value) throws -> Dictionary.Value) rethrows where S : Sequence, S.Element == (Dictionary.Key, Dictionary.Value)
public func merging<S>(_ other: S, uniquingKeysWith combine: (Dictionary.Value, Dictionary.Value) throws -> Dictionary.Value) rethrows -> [Dictionary.Key : Dictionary.Value] where S : Sequence, S.Element == (Dictionary.Key, Dictionary.Value).
I tried the example, but I encountered a compile bug.
var dictionary = ["a": 1, "b": 2]
dictionary.merge(["a": 3, "c": 4]) { (current, _) in current }
let dictionary = ["a": 1, "b": 2]
let otherDictionary = ["a": 3, "b": 4]
let keepingCurrent = dictionary.merging(otherDictionary) { (current, _) in current }
Generic parameter 'S' could not be inferred.
The text was updated successfully, but these errors were encountered: