Skip to content

Commit 7076327

Browse files
Disambiguation between variable and function with same name
1 parent 517bd32 commit 7076327

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

stdlib/public/SDK/Foundation/JSONEncoder.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,9 @@ extension _JSONEncoder {
883883

884884
// This method is called "box_" instead of "box" to disambiguate it from the overloads. Because the return type here is different from all of the "box" overloads (and is more general), any "box" calls in here would call back into "box" recursively instead of calling the appropriate overload, which is not what we want.
885885
fileprivate func box_(_ value: Encodable) throws -> NSObject? {
886-
let type = type(of: value)
886+
// Disambiguation between variable and function is required due to
887+
// issue tracked at: https://bugs.swift.org/browse/SR-1846
888+
let type = Swift.type(of: value)
887889
if type == Date.self || type == NSDate.self {
888890
// Respect Date encoding strategy
889891
return try self.box((value as! Date))

0 commit comments

Comments
 (0)