C#: For implicit constructors, pick a unique source location as reporting location (if any).

This commit is contained in:
Michael Nebel
2025-10-03 11:40:42 +02:00
parent b5592ad42f
commit 12dc65d170

View File

@@ -222,7 +222,8 @@ namespace Semmle.Extraction.CSharp.Entities
if (Symbol.IsImplicitlyDeclared)
{
return ContainingType!.ReportingLocation;
var best = Symbol.Locations.Where(l => l.IsInSource).BestOrDefault();
return best ?? ContainingType!.ReportingLocation;
}
return Symbol.ContainingType.Locations.FirstOrDefault();