Fix tests

This commit is contained in:
Tamas Vajk
2021-04-07 15:56:01 +02:00
parent cb9a9db356
commit c069c3384e
18 changed files with 36 additions and 16 deletions

View File

@@ -164,12 +164,10 @@ namespace Semmle.Extraction.CSharp.Entities
// In case this parameter belongs to an accessor of an indexer, we need
// to get the default value from the corresponding parameter belonging
// to the indexer itself
var method = (IMethodSymbol)symbol.ContainingSymbol;
if (method is not null)
if (symbol.ContainingSymbol is IMethodSymbol method)
{
var i = method.Parameters.IndexOf(symbol);
var indexer = (IPropertySymbol?)method.AssociatedSymbol;
if (indexer is not null)
if (method.AssociatedSymbol is IPropertySymbol indexer)
defaultValue = GetParameterDefaultValue(indexer.Parameters[i]);
}
}