Commit 810b624
Fix type stability for end indexing patterns (issue SciML#525)
Add specialized getindex methods for RaggedEnd to ensure type-stable
access when using `end` indexing:
- `getindex(A, i::Int, re::RaggedEnd)` for `vec[i, end]` pattern
- `getindex(A, re::RaggedEnd, col::Int)` for `vec[end, col]` pattern
Both methods handle the RaggedEnd sentinel case (dim=0) for resolved
column indices and the non-sentinel case for ragged inner dimensions.
Added tests verifying type inference for:
- `vec[1, lastindex(vec, 2)]` - RaggedEnd in column position
- `vec[1, lastindex(vec)]` - Int in column position
- `vec[lastindex(vec, 1), 1]` - RaggedEnd in row position
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent c98f542 commit 810b624
2 files changed
+43
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
576 | 576 | | |
577 | 577 | | |
578 | 578 | | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
579 | 610 | | |
580 | 611 | | |
581 | 612 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
69 | 81 | | |
70 | 82 | | |
71 | 83 | | |
| |||
0 commit comments