From e258d9fa74135e3d2abda8c5462fecd6ff3cadcb Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Wed, 26 Jun 2024 11:04:38 +0200 Subject: [PATCH] C#: Use the first best location from the list of locations. --- csharp/extractor/Semmle.Extraction/LocationExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/extractor/Semmle.Extraction/LocationExtensions.cs b/csharp/extractor/Semmle.Extraction/LocationExtensions.cs index 9ea70c00a0e..f615fe65963 100644 --- a/csharp/extractor/Semmle.Extraction/LocationExtensions.cs +++ b/csharp/extractor/Semmle.Extraction/LocationExtensions.cs @@ -76,7 +76,7 @@ namespace Semmle.Extraction /// lexicographically smaller filepath and span is considered better. /// public static Location? BestOrDefault(this IEnumerable locations) => - locations.Any() ? locations.Aggregate((best, loc) => BetterThan(best, loc) ? best : loc) : null; + locations.Any() ? locations.Aggregate((best, loc) => BetterThan(loc, best) ? loc : best) : null; public static Location Best(this IEnumerable locations) => locations.BestOrDefault() ?? throw new ArgumentException("No location found.");