@@ -197,7 +197,7 @@ open class JSONDecoder {
197197 do {
198198 var parser = JSONParser ( bytes: Array ( data) )
199199 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 )
201201 } catch let error as JSONError {
202202 throw DecodingError . dataCorrupted ( DecodingError . Context ( codingPath: [ ] , debugDescription: " The given data was not valid JSON. " , underlyingError: error) )
203203 } catch {
@@ -292,11 +292,11 @@ extension JSONDecoderImpl: Decoder {
292292 if type == Decimal . self {
293293 return try self . unwrapDecimal ( ) as! T
294294 }
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 )
297297 }
298298
299- return try T ( from: self )
299+ return try type . init ( from: self )
300300 }
301301
302302 private func unwrapDate( ) throws -> Date {
@@ -611,8 +611,8 @@ extension JSONDecoderImpl {
611611 try decodeFixedWidthInteger ( )
612612 }
613613
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 )
616616 }
617617
618618 @inline ( __always) private func decodeFixedWidthInteger< T: FixedWidthInteger > ( ) throws -> T {
@@ -746,9 +746,9 @@ extension JSONDecoderImpl {
746746 try decodeFixedWidthInteger ( key: key)
747747 }
748748
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 {
750750 let newDecoder = try decoderForKey ( key)
751- return try newDecoder. unwrap ( as: T . self )
751+ return try newDecoder. unwrap ( as: type )
752752 }
753753
754754 func nestedContainer< NestedKey> ( keyedBy type: NestedKey . Type , forKey key: K ) throws
@@ -926,9 +926,9 @@ extension JSONDecoderImpl {
926926 try decodeFixedWidthInteger ( )
927927 }
928928
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 )
932932
933933 // Because of the requirement that the index not be incremented unless
934934 // decoding the desired result type succeeds, it can not be a tail call.
0 commit comments