GodotSharp.SourceGenerators icon indicating copy to clipboard operation
GodotSharp.SourceGenerators copied to clipboard

[SceneTree] Annotation Interferes with Discards

Open aroelke opened this issue 7 months ago • 6 comments

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?

aroelke avatar Jul 21 '24 03:07 aroelke