@@ -197,7 +197,7 @@ open class JSONDecoder {
197
197
do {
198
198
var parser = JSONParser ( bytes: Array ( data) )
199
199
let json = try parser. parse ( )
200
- return try JSONDecoderImpl ( userInfo: self . userInfo, from: json, codingPath: [ ] , options: self . options) . unwrap ( as: T . self )
200
+ return try JSONDecoderImpl ( userInfo: self . userInfo, from: json, codingPath: [ ] , options: self . options) . unwrap ( as: type )
201
201
} catch let error as JSONError {
202
202
throw DecodingError . dataCorrupted ( DecodingError . Context ( codingPath: [ ] , debugDescription: " The given data was not valid JSON. " , underlyingError: error) )
203
203
} catch {
@@ -292,11 +292,11 @@ extension JSONDecoderImpl: Decoder {
292
292
if type == Decimal . self {
293
293
return try self . unwrapDecimal ( ) as! T
294
294
}
295
- if T . self is _JSONStringDictionaryDecodableMarker . Type {
296
- return try self . unwrapDictionary ( as: T . self )
295
+ if type is _JSONStringDictionaryDecodableMarker . Type {
296
+ return try self . unwrapDictionary ( as: type )
297
297
}
298
298
299
- return try T ( from: self )
299
+ return try type . init ( from: self )
300
300
}
301
301
302
302
private func unwrapDate( ) throws -> Date {
@@ -611,8 +611,8 @@ extension JSONDecoderImpl {
611
611
try decodeFixedWidthInteger ( )
612
612
}
613
613
614
- func decode< T> ( _: T . Type ) throws -> T where T: Decodable {
615
- try self . impl. unwrap ( as: T . self )
614
+ func decode< T> ( _ type : T . Type ) throws -> T where T: Decodable {
615
+ try self . impl. unwrap ( as: type )
616
616
}
617
617
618
618
@inline ( __always) private func decodeFixedWidthInteger< T: FixedWidthInteger > ( ) throws -> T {
@@ -746,9 +746,9 @@ extension JSONDecoderImpl {
746
746
try decodeFixedWidthInteger ( key: key)
747
747
}
748
748
749
- func decode< T> ( _: T . Type , forKey key: K ) throws -> T where T: Decodable {
749
+ func decode< T> ( _ type : T . Type , forKey key: K ) throws -> T where T: Decodable {
750
750
let newDecoder = try decoderForKey ( key)
751
- return try newDecoder. unwrap ( as: T . self )
751
+ return try newDecoder. unwrap ( as: type )
752
752
}
753
753
754
754
func nestedContainer< NestedKey> ( keyedBy type: NestedKey . Type , forKey key: K ) throws
@@ -926,9 +926,9 @@ extension JSONDecoderImpl {
926
926
try decodeFixedWidthInteger ( )
927
927
}
928
928
929
- mutating func decode< T> ( _: T . Type ) throws -> T where T: Decodable {
930
- let newDecoder = try decoderForNextElement ( ofType: T . self )
931
- let result = try newDecoder. unwrap ( as: T . self )
929
+ mutating func decode< T> ( _ type : T . Type ) throws -> T where T: Decodable {
930
+ let newDecoder = try decoderForNextElement ( ofType: type )
931
+ let result = try newDecoder. unwrap ( as: type )
932
932
933
933
// Because of the requirement that the index not be incremented unless
934
934
// decoding the desired result type succeeds, it can not be a tail call.
0 commit comments