1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

C#: Fix generator crash w/ generic arrays

This commit is contained in:
Paul Joannon
2024-04-30 22:21:21 +02:00
parent d282e4f0e6
commit aba787393f
4 changed files with 69 additions and 1 deletions

View File

@@ -658,7 +658,10 @@ namespace Godot.SourceGenerators
var elementType = MarshalUtils.GetArrayElementType(type);
if (elementType == null)
return false; // Non-generic Array, so there's no hint to add
return false; // Non-generic Array, so there's no hint to add.
if (elementType.TypeKind == TypeKind.TypeParameter)
return false; // The generic is not constructed, we can't really hint anything.
var elementMarshalType = MarshalUtils.ConvertManagedTypeToMarshalType(elementType, typeCache)!.Value;
var elementVariantType = MarshalUtils.ConvertMarshalTypeToVariantType(elementMarshalType)!.Value;