Commit 184eda0
[BinaryPlatforms] Change "shortest match" algorithm to "best match"
My assertion in the previous attempt to fix this issue was incorrect:
> We define a simpler match as one that has fewer tags overall.
> As these candidate matches have already been filtered to match the
> given platform, the only other tags that exist are ones that are in
> addition to the tags declared by the platform. Hence, selecting the
> minimum in number of tags is equivalent to selecting the closest match.
This is demonstrably false, by my own test case:
```
platforms = Dict(
Platform("x86_64", "linux") => "bad",
Platform("x86_64", "linux"; sanitize="memory") => "good",
)
select_platform(platforms, Platform("x86_64", "linux"; sanitize="memory")) == "good"
```
In this case, because there exists a candidate that is _more general_
than the provided platform type, the shortest match is no longer the
best match.
This PR performs a more rigorous matching that works more reliably in
all cases.1 parent 4725b3e commit 184eda0
2 files changed
+36
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1068 | 1068 | | |
1069 | 1069 | | |
1070 | 1070 | | |
1071 | | - | |
1072 | | - | |
1073 | | - | |
1074 | | - | |
1075 | | - | |
1076 | | - | |
1077 | | - | |
1078 | | - | |
1079 | | - | |
1080 | | - | |
1081 | | - | |
1082 | | - | |
1083 | | - | |
1084 | | - | |
1085 | | - | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
1086 | 1093 | | |
1087 | 1094 | | |
1088 | 1095 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
333 | | - | |
334 | | - | |
| 333 | + | |
335 | 334 | | |
336 | 335 | | |
337 | 336 | | |
| |||
343 | 342 | | |
344 | 343 | | |
345 | 344 | | |
346 | | - | |
| 345 | + | |
347 | 346 | | |
348 | | - | |
349 | | - | |
350 | | - | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
351 | 357 | | |
352 | | - | |
| 358 | + | |
| 359 | + | |
353 | 360 | | |
354 | 361 | | |
355 | 362 | | |
| |||
0 commit comments