GodotSharp.SourceGenerators
GodotSharp.SourceGenerators copied to clipboard
[SceneTree] Annotation Interferes with Discards
Since C# 7, it's been possible to use the _
character to discard unused values, but adding the [SceneTree]
annotation to a class defines it as a field used to access the scene hierarchy and prevents its use as a discard. This causes something like this (or the examples given in Microsoft's documentation for the discard) to fail to compile:
foreach ((_, var key) in someDictionary)
{
...
}
It doesn't seem to interfere with its usage in switch
expressions, but the above definitely does fail. Is this intentional?