Skip to content

Commit e258d9f

Browse files
committed
C#: Use the first best location from the list of locations.
1 parent d18915a commit e258d9f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

csharp/extractor/Semmle.Extraction/LocationExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private static bool BetterThan(Location l1, Location l2)
7676
/// lexicographically smaller filepath and span is considered better.
7777
/// </summary>
7878
public static Location? BestOrDefault(this IEnumerable<Location> locations) =>
79-
locations.Any() ? locations.Aggregate((best, loc) => BetterThan(best, loc) ? best : loc) : null;
79+
locations.Any() ? locations.Aggregate((best, loc) => BetterThan(loc, best) ? loc : best) : null;
8080

8181
public static Location Best(this IEnumerable<Location> locations) =>
8282
locations.BestOrDefault() ?? throw new ArgumentException("No location found.");

0 commit comments

Comments
 (0)