Assigning a variable to itself doesn't yield a warning/error inside a closure #80047
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
triage needed
This issue needs more specific labels
Description
The logic that checks whether a variable is (mistakingly) assigned to itself is not working when the assignment is in a closure.
This currently happens with Xcode 16.3 beta 2.
Reproduction
Expected behavior
b = b
should yield a warning and/or error as this code is illogical.Environment
swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.109.103 clang-1700.0.13.2)
Additional information
This looks like a silly bug, but this prevented the compiler from catching a fairly nasty bug that was hitting many customers in our apps. A functional warning would have prevented this bug from shipping in the first place.
The text was updated successfully, but these errors were encountered: