[SR-13114] switch statement over enum instance should release references in associated values on successful pattern match #55560
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Environment
$ swift --version
Swift version 5.2-dev (LLVM 4cd92ac, Swift 79716ef)
Target: x86_64-unknown-linux-gnu
Additional Detail from JIRA
md5: 8181bfb6c40eae032241ad95f2b96f51
is duplicated by:
Issue Description:
Right now, it seems that `switch` statements appear to retain a strong reference to the associated values in the `enum` case for the duration of the `case` block's execution. However, the payloads are no longer needed after the pattern matching succeeds, so they should be released at the beginning of the `case` block, with locally bound associated values taking an additional retain as needed.
this issue is probably related to: https://bugs.swift.org/browse/SR-13113
The text was updated successfully, but these errors were encountered: