Skip to content

Throw descriptive error in copy! into FixedSizeVector on axes mismatch - #195

Merged
giordano merged 1 commit into
JuliaArrays:mainfrom
devmotion:dmw/copy-axes-check
Oct 12, 2026
Merged

giordano merged 1 commit into
JuliaArrays:mainfrom
devmotion:dmw/copy-axes-check

Conversation

@devmotion

@devmotion devmotion commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #194.

copy!(::FixedSizeVector, ::AbstractVector) fell back to Base's vector method, which calls resize! on length mismatch (MethodError, also flagged by JET). It now checks axes(dst) == axes(src), like Base's copy!(::AbstractArray, ::AbstractArray), and throws an ArgumentError that shows both axes.

With this PR, JET no longer reports the resize! error for the example from the issue (Julia 1.13.1):

julia> @report_call mul!(FixedSizeVector{Float64}(undef, 3), LowerTriangular(rand(3, 3)), rand(3))
No errors detected

🤖 Generated with Claude Code

…match

Avoids the `resize!` fallback of `copy!(::AbstractVector, ::AbstractVector)`.

Fixes JuliaArrays#194

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@giordano

Copy link
Copy Markdown
Collaborator

CI is completely blocked for the entire organisation by JuliaArrays/StaticArrays.jl#1360. Moving testing of that package to ParallelTestRunner would much alleviate the issue (I also upgraded the org, but that shouldn't stop from using resources more efficiently)

@codecov

codecov Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.95%. Comparing base (70b8ab6) to head (2565caf).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #195      +/-   ##
==========================================
+ Coverage   92.85%   92.95%   +0.10%     
==========================================
  Files           5        5              
  Lines         210      213       +3     
==========================================
+ Hits          195      198       +3     
  Misses         15       15              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@giordano giordano left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@giordano
giordano merged commit 1f00752 into JuliaArrays:main Oct 12, 2026
18 checks passed
@devmotion
devmotion deleted the dmw/copy-axes-check branch October 12, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

copy! into a FixedSizeVector falls back to resize!

2 participants