[SR-13888] Dictionary iteration by keys forces copy-on-write for struct elements #56286
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Environment
Reproduces in Swift 5.3 in Xcode 12.2 (12B45b).
Additional Detail from JIRA
md5: 09b091ceed16227924bc5ab27342d84d
relates to:
Issue Description:
For the following example, I would expect testDict to complete successfully; however, isKnownUniquelyReferenced fails for the dictionary values, forcing unnecessary copies if the values use copy on write. The optimiser should be able to avoid retains on the dictionary values in the `.keys` loop since they are not referenced or used there.
The text was updated successfully, but these errors were encountered: