mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Local discriminators for named entities are currently being set by the parser, so entities not created by the parser (e.g., that come from synthesized code) don't get local discriminators. Moreover, there is no checking to ensure that every named local entity gets a local discriminator, so some entities would incorrectly get a local discriminator of 0. Assign local discriminators as part of setting closure discriminators, in response to a request asking for the local discriminator, so the parser does not need to track this information, and all local declarations---including synthesized ones---get local discriminators. And add checking to make sure that every entity that needs a local discriminator gets assigned one. There are a few interesting cases in here: * There was a potential mangling collision with local property wrappers because their generated variables weren't getting local discriminators * $interpolation variables introduced for string interpolation weren't getting local discriminators, they were just wrong. * "Local rename" when dealing with captures like `[x]` was dependent on the new delcaration of `x` *not* getting a local discriminator. There are funny cases involving nesting where it would do the wrong thing.
72 KiB
72 KiB