Merge pull request #91368 from raulsntos/dotnet/must-be-variant-dynamic
C#: Ignore late bound methods in MustBeVariantAnalyzer
This commit is contained in:
commit
0e0ef3cd69
|
@ -66,6 +66,12 @@ public class MustBeVariantGD0301
|
|||
Method<Rid[]>();
|
||||
}
|
||||
|
||||
public void MethodCallDynamic()
|
||||
{
|
||||
dynamic self = this;
|
||||
self.Method<object>();
|
||||
}
|
||||
|
||||
public void Method<[MustBeVariant] T>()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -50,8 +50,18 @@ namespace Godot.SourceGenerators
|
|||
var typeSymbol = sm.GetSymbolInfo(typeSyntax).Symbol as ITypeSymbol;
|
||||
Helper.ThrowIfNull(typeSymbol);
|
||||
|
||||
var parentSymbol = sm.GetSymbolInfo(parentSyntax).Symbol;
|
||||
Helper.ThrowIfNull(parentSymbol);
|
||||
var parentSymbolInfo = sm.GetSymbolInfo(parentSyntax);
|
||||
var parentSymbol = parentSymbolInfo.Symbol;
|
||||
if (parentSymbol == null)
|
||||
{
|
||||
if (parentSymbolInfo.CandidateReason == CandidateReason.LateBound)
|
||||
{
|
||||
// Invocations on dynamic are late bound so we can't retrieve the symbol.
|
||||
continue;
|
||||
}
|
||||
|
||||
Helper.ThrowIfNull(parentSymbol);
|
||||
}
|
||||
|
||||
if (!ShouldCheckTypeArgument(context, parentSyntax, parentSymbol, typeSyntax, typeSymbol, i))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue