Repository navigation
Commit 5136415
committed
fix(registry): break suffix_match ties by kind, C# stub, then QN order, not depth
1a34255 made suffix_match ties deterministic by preferring the least
nested QN, then the smaller QN. Determinism was the point, and it stays.
But depth says nothing about which same-named definition a call means.
An audit of main against v0.11.0 (2026-10-10) traced three resolution
regressions to that one rule:
- django: about 5,600 `Model.objects.X(...)` calls tie between
`QuerySet.X` and same-named methods elsewhere. `Library.filter`,
`EngineHandler.all` and `HttpResponseBase.get` are each one segment
shallower, so the QuerySet share fell from 57 % to 24 %.
- Kotlin / Java: a call went to a property or field that merely shares
the callee's name. Kotlin `where(...)` went to `var where`, and Java
`esr.indexMode()` to a field whose QN lacks its class segment.
Kotlin CALLS edges on Variable/Field targets went 785 -> 1,648.
- C#: .NET reference assemblies (`src/libraries/<Asm>/ref/<Asm>.cs`,
`throw null` bodies) are shallower than the implementation, and "ref"
sorts before "src". 14.1 % of dotnet/runtime's CALLS landed on such
stubs (4.9 % in v0.11.0).
A tie now goes to:
1. the more plainly callable candidate: Function/Method, then any other
definition, then an unknown label, then Variable/Field;
2. for C# only, an implementation over a reference-assembly stub;
3. the lexicographically smaller QN.
This is still a pure function of the candidate set (O9). The kernel
cases behind 1a34255 keep their answers: `dev_name` is the only Function
among the fields, and include/linux sorts before tools/virtio.
Measured on the bench corpora (macOS arm64, main cb8b641 vs this
change, one cold full index each):
- django: `objects.X` -> QuerySet 23.7 % -> 41.4 %; CALLS -> Variable
1,022 -> 741
- Kotlin (Exposed): CALLS -> Variable 1,648 -> 480
- Java (elasticsearch): CALLS -> Variable/Field 62,313 -> 42,957
- C# (dotnet/runtime): CALLS -> ref/ stubs 143,799 -> 52,000;
CALLS -> Variable/Field 33,779 -> 28,662
- TypeScript: CALLS -> Variable 7,978 -> 7,341
The rest of the django gap needs Manager -> QuerySet typing, which no
tie order can supply.
Tests:
- registry_tie_prefers_callable_over_property
- registry_tie_ignores_nesting_depth
- registry_tie_prefers_csharp_implementation_over_ref_stub
All three are RED on main and RED again with the registry change
reverted.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>1 parent cb8b641 commit 5136415
2 files changed
Lines changed: 186 additions & 40 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
226 | 232 | | |
227 | 233 | | |
228 | 234 | | |
| |||
237 | 243 | | |
238 | 244 | | |
239 | 245 | | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
248 | 267 | | |
249 | | - | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
250 | 277 | | |
251 | 278 | | |
252 | 279 | | |
| |||
255 | 282 | | |
256 | 283 | | |
257 | 284 | | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
267 | 304 | | |
268 | 305 | | |
269 | 306 | | |
270 | 307 | | |
271 | 308 | | |
272 | | - | |
273 | | - | |
274 | | - | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
275 | 314 | | |
276 | 315 | | |
| 316 | + | |
277 | 317 | | |
278 | 318 | | |
279 | 319 | | |
280 | 320 | | |
| 321 | + | |
281 | 322 | | |
282 | | - | |
| 323 | + | |
| 324 | + | |
283 | 325 | | |
284 | 326 | | |
| 327 | + | |
285 | 328 | | |
286 | 329 | | |
287 | 330 | | |
| |||
1409 | 1452 | | |
1410 | 1453 | | |
1411 | 1454 | | |
1412 | | - | |
1413 | | - | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
1414 | 1458 | | |
1415 | 1459 | | |
| 1460 | + | |
1416 | 1461 | | |
| 1462 | + | |
1417 | 1463 | | |
1418 | 1464 | | |
1419 | 1465 | | |
1420 | 1466 | | |
1421 | 1467 | | |
1422 | 1468 | | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
1423 | 1472 | | |
1424 | 1473 | | |
1425 | 1474 | | |
| |||
1429 | 1478 | | |
1430 | 1479 | | |
1431 | 1480 | | |
1432 | | - | |
1433 | | - | |
| 1481 | + | |
| 1482 | + | |
1434 | 1483 | | |
1435 | 1484 | | |
1436 | 1485 | | |
1437 | 1486 | | |
1438 | 1487 | | |
1439 | 1488 | | |
1440 | | - | |
1441 | | - | |
| 1489 | + | |
| 1490 | + | |
1442 | 1491 | | |
1443 | 1492 | | |
1444 | 1493 | | |
| |||
1632 | 1681 | | |
1633 | 1682 | | |
1634 | 1683 | | |
1635 | | - | |
| 1684 | + | |
1636 | 1685 | | |
1637 | | - | |
1638 | | - | |
| 1686 | + | |
| 1687 | + | |
1639 | 1688 | | |
1640 | 1689 | | |
1641 | 1690 | | |
| |||
2011 | 2060 | | |
2012 | 2061 | | |
2013 | 2062 | | |
2014 | | - | |
2015 | | - | |
| 2063 | + | |
| 2064 | + | |
2016 | 2065 | | |
2017 | 2066 | | |
2018 | 2067 | | |
| |||
2026 | 2075 | | |
2027 | 2076 | | |
2028 | 2077 | | |
2029 | | - | |
2030 | | - | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
2031 | 2081 | | |
2032 | 2082 | | |
2033 | 2083 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
919 | 919 | | |
920 | 920 | | |
921 | 921 | | |
922 | | - | |
923 | | - | |
924 | | - | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
925 | 925 | | |
926 | 926 | | |
927 | 927 | | |
| |||
951 | 951 | | |
952 | 952 | | |
953 | 953 | | |
954 | | - | |
| 954 | + | |
955 | 955 | | |
956 | 956 | | |
957 | 957 | | |
| |||
965 | 965 | | |
966 | 966 | | |
967 | 967 | | |
968 | | - | |
| 968 | + | |
969 | 969 | | |
970 | 970 | | |
971 | 971 | | |
| |||
982 | 982 | | |
983 | 983 | | |
984 | 984 | | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
985 | 1078 | | |
986 | 1079 | | |
987 | 1080 | | |
| |||
1643 | 1736 | | |
1644 | 1737 | | |
1645 | 1738 | | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
1646 | 1742 | | |
1647 | 1743 | | |
1648 | 1744 | | |
| |||
0 commit comments