Skip to content

Commit 683ac9c

Browse files
committed
fix JSONEncodable tests for Array and Dictionary when they are declared with JSONEncodable protocol type
1 parent 32b7e77 commit 683ac9c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

JSONCodable/JSONHelpers.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ protocol JSONDictionary {
1515

1616
extension Dictionary : JSONDictionary {
1717
func dictionaryIsJSONEncodable() -> Bool {
18-
return Key.self is String.Type && Value.self is JSONEncodable.Type
18+
return Key.self is String.Type && (Value.self is JSONEncodable.Type || Value.self is JSONEncodable.Protocol)
1919
}
2020

2121
func dictionaryMadeJSONEncodable() -> [String: JSONEncodable] {
@@ -37,7 +37,7 @@ protocol JSONArray {
3737

3838
extension Array: JSONArray {
3939
func elementsAreJSONEncodable() -> Bool {
40-
return Element.self is JSONEncodable.Type
40+
return Element.self is JSONEncodable.Type || Element.self is JSONEncodable.Protocol
4141
}
4242

4343
func elementsMadeJSONEncodable() -> [JSONEncodable] {

0 commit comments

Comments
 (0)