浏览代码

C#: Make MustBeVariantAnalyzer ignore OmittedTypeArgument

Fixes assertion error in the analyzer.
Ignacio Roldán Etcheverry 3 年之前
父节点
当前提交
3666e9fcd0
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MustBeVariantAnalyzer.cs

+ 5 - 0
modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MustBeVariantAnalyzer.cs

@@ -39,6 +39,11 @@ namespace Godot.SourceGenerators
             for (int i = 0; i < typeArgListSyntax.Arguments.Count; i++)
             for (int i = 0; i < typeArgListSyntax.Arguments.Count; i++)
             {
             {
                 var typeSyntax = typeArgListSyntax.Arguments[i];
                 var typeSyntax = typeArgListSyntax.Arguments[i];
+
+                // Ignore omitted type arguments, e.g.: List<>, Dictionary<,>, etc
+                if (typeSyntax is OmittedTypeArgumentSyntax)
+                    continue;
+
                 var typeSymbol = sm.GetSymbolInfo(typeSyntax).Symbol as ITypeSymbol;
                 var typeSymbol = sm.GetSymbolInfo(typeSyntax).Symbol as ITypeSymbol;
                 Debug.Assert(typeSymbol != null);
                 Debug.Assert(typeSymbol != null);