From da50c33001c00cddfed5c737316fa4d314432a43 Mon Sep 17 00:00:00 2001 From: eofs Date: Tue, 30 Jun 2020 11:07:36 +0300 Subject: [PATCH] Fix erroneously re-throwing reduce (on Swift 5.3 pre-release) within 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 --- Source/XCDBLD/SDK.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/XCDBLD/SDK.swift b/Source/XCDBLD/SDK.swift index 0985b5a5f0..ca72ff1bdb 100644 --- a/Source/XCDBLD/SDK.swift +++ b/Source/XCDBLD/SDK.swift @@ -77,7 +77,7 @@ 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"), @@ -85,7 +85,7 @@ public struct SDK: Hashable { "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) }