Commit e367145
fix(analyser): pin vec call to exact-subtype scalar overload when one exists 🎯
The vec path only used find_function_candidates (loose compatibility),
so calls like `Tuple<Int, Int> - Tuple<Int, Int>` collected both
`-(Int, Int)` and `-(Number, Number)` as candidates and the analyser
LUB'd them into `Tuple<Number, Number>`. Scalar dispatch avoids this
by trying find_function (exact subtype match) first.
Mirror that step for vec: track `vec_exact` across the scope walk, and
when no scalar competes, prefer the exact-subtype match over loose
compatibles. Restores the precision the user expected.
The Any-args case (no scalar accepts Any) still falls to Dynamic with
multiple vec candidates and LUBs across their returns — that's the
"interesting" Tuple<Number, Number> behaviour the user signed off on.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>1 parent df7b11b commit e367145
2 files changed
Lines changed: 53 additions & 3 deletions
File tree
- ndc_analyser/src
- tests/functional/programs/013_vector_math
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
| 420 | + | |
420 | 421 | | |
421 | 422 | | |
422 | 423 | | |
| |||
429 | 430 | | |
430 | 431 | | |
431 | 432 | | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
432 | 443 | | |
433 | 444 | | |
434 | 445 | | |
| |||
496 | 507 | | |
497 | 508 | | |
498 | 509 | | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
499 | 517 | | |
500 | 518 | | |
501 | 519 | | |
| |||
524 | 542 | | |
525 | 543 | | |
526 | 544 | | |
527 | | - | |
528 | | - | |
529 | | - | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
530 | 555 | | |
531 | 556 | | |
532 | 557 | | |
| |||
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
0 commit comments