Cat-Lips / GodotSharp.SourceGenerators

C# source generators for the Godot Game Engine
MIT License
112 stars 10 forks source link

Nullable types in generated methods fail to compile #33

Closed Cat-Lips closed 1 year ago

Cat-Lips commented 1 year ago
          Unrelated: it seems like `?` in parameter types does not work.
public partial class Item : MarginContainer
{
    [OnInstantiate]
    private void Init(int? units) { }
}

This gives:

CSC : warning CS8785: Generator 'OnInstantiateSourceGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'ArgumentException' with message 'The hintName 'Item.Init(int?).g.cs' contains an invalid character '?' at position 30. (Parameter 'hintName')'

Interestingly, using Nullable<int> does not work either.

Originally posted by @ttencate in https://github.com/Cat-Lips/GodotSharp.SourceGenerators/issues/26#issuecomment-1606069923