[SR-7769] Dynamically upgrade existing boxed values to NSObject subclasses #50308
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Additional Detail from JIRA
md5: 369eca9ec5c6064f972350d71a361043
Issue Description:
AnyObject boxing on non-Darwin platforms has to contend with the contradictory requirements that `x as AnyObject` ought to work consistently regardless of whether Foundation is present, but the generic box for unbridged value types ought to be an NSObject subclass when Foundation is present. Currently we dynamically choose a box type based on whether Foundation is present, but this breaks down if a process starts up without Foundation and dynamically loads some library that uses Foundation later. We could instead look into ways to dynamically promote the metadata for value boxes to become an
NSObject when Foundation is loaded, so that existing boxed values continue to work.
The text was updated successfully, but these errors were encountered: