A follow up is needed for a process of merging backing fields for a partial property #76870
Labels
Area-Compilers
Feature - Partial Properties
untriaged
Issues and PRs which have not yet been triaged by a lead
It looks like initially PartialDefinitionPart and PartialImplementationPart are created with their own unique backing field symbols. After the parts are merged,
ContainingType.GetMembers()
containsPartialDefinitionPart.BackingField
andPartialImplementationPart.BackingField
is adjusted to point to that field symbolas well. The field symbol originally created for PartialImplementationPart is not amongContainingType.GetMembers()
, but if the implementation part has an initializer, corresponding bound field initializer refers to that field, rather than to thePartialDefinitionPart.BackingField
. Also, it is very likely thatPartialDefinitionPart.BackingField.HasInitializer
is set to false. Emitted code for a simple scenario looks correct, likely due to the fact that the fields share the same name. However, the internal compiler data structures look inconsistent, which potentially might cause observable problems in some scenarios.Another aspect is the
FieldSymbol.AssociatedSymbol
's behavior. Is it supposed to returnPartialDefinitionPart
orPartialImplementationPart
? Whatever the answer is, it feels inappropriate for the other part to return the same field symbol fromBackingField
.The text was updated successfully, but these errors were encountered: