Skip to content

Commit 8755055

Browse files
committed
Resolve build warning
1 parent f2780d8 commit 8755055

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Sources/Lookup/Lookup.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ public struct Lookup: Swift.CustomStringConvertible, Swift.CustomDebugStringConv
137137
}
138138
}
139139

140+
// Resolve build warning:
141+
// heterogeneous collection literal could only be inferred to '[String : Any]'; add explicit type annotation if this is intentional
142+
public init(_ anyDictionary: [String: Any]) {
143+
self.init(anyDictionary as Any)
144+
}
145+
140146
private func makeLookup(from dynamicMember: String) -> Lookup {
141147
if dynamicMember.contains(".") {
142148
var keys = dynamicMember.components(separatedBy: ".")

Tests/LookupTests/LookupTests.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,12 @@ final class LookupTests: XCTestCase {
211211
let lookup6 = Lookup([1, 2, 3, 4, 5])
212212
let lookup7 = lookup6 + [4, 5, 6, 7, 8]
213213
XCTAssertEqual(lookup7.arrayValue.count, 10)
214+
215+
let lookup8 = Lookup([
216+
"userID": 00001,
217+
"nickname": "Lookup"
218+
])
219+
XCTAssertEqual(lookup8.userID.string, "1")
214220
}
215221
mergeDictionaryLookups()
216222

0 commit comments

Comments
 (0)