Skip to content

Commit

Permalink
Fix erroneously re-throwing reduce (on Swift 5.3 pre-release) within …
Browse files Browse the repository at this point in the history
…global (via static nature) variable initializer.

Error looked like:

```
/Users/crusty/Projects/Xcode/Carthage/Source/XCDBLD/SDK.swift:80:3: error: call can throw, but errors cannot be thrown out of a global variable initializer
                KeyValuePairs.reduce([
                ^
```

Co-authored-by: J.D. Healy <[email protected]>
  • Loading branch information
eofs and jdhealy authored Jun 30, 2020
1 parent c7550f8 commit da50c33
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/XCDBLD/SDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ public struct SDK: Hashable {
/// hardcoded `simulatorHeuristic` · all keyed by lowercased `name`.
/// - Note: The aliases are intended to be matched case-insensitevly.
private static let knownIn2019YearDictionary: [String: (String, [String], String)] =
KeyValuePairs.reduce([
([
"MacOSX": (["macOS", "Mac", "OSX"], "macOS"),
"iPhoneOS": (["iOS Device", "iOS"], "iOS"),
"iPhoneSimulator": (["iOS Simulator"], "Simulator - iOS"),
"WatchOS": (["watchOS"], "watchOS"),
"WatchSimulator": (["watchOS Simulator", "watchsimulator"], "Simulator - watchOS"),
"AppleTVOS": (["tvOS"], "tvOS"),
"AppleTVSimulator": (["tvOS Simulator", "appletvsimulator", "tvsimulator"], "Simulator - tvOS"),
])(into: [:]) {
] as KeyValuePair).reduce(into: [:]) {
$0[$1.0.lowercased()] = ($1.0, $1.1.0, $1.1.1)
}

Expand Down

0 comments on commit da50c33

Please sign in to comment.