Skip to content

Avoid construction in convert#1556

Merged
jishnub merged 3 commits intomasterfrom
jishnub/convert_special
Feb 28, 2026
Merged

Avoid construction in convert#1556
jishnub merged 3 commits intomasterfrom
jishnub/convert_special

Conversation

@jishnub
Copy link
Member

@jishnub jishnub commented Feb 28, 2026

This follows the convert implementation for AbstractArrays and short-circuits if the input is already of the correct type. There's no actual construction required in this case.

Should fix the failure on master seen in #1554

@jishnub jishnub added backport 1.12 Change should be backported to release-1.12 backport 1.13 labels Feb 28, 2026
@codecov
Copy link

codecov bot commented Feb 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.04%. Comparing base (3a4fdad) to head (00898d1).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1556   +/-   ##
=======================================
  Coverage   94.04%   94.04%           
=======================================
  Files          35       35           
  Lines       15986    15990    +4     
=======================================
+ Hits        15034    15038    +4     
  Misses        952      952           

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Member

@dkarrasch dkarrasch left a comment

Choose a reason for hiding this comment

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

Do you have any idea why this wasn't an issue before?

@jishnub jishnub removed the backport 1.12 Change should be backported to release-1.12 label Feb 28, 2026
@jishnub
Copy link
Member Author

jishnub commented Feb 28, 2026

The method was seemingly broken in #1212. It was working correctly on v1.12 before that PR was merged. I'm not entirely certain why this test didn't appear before. The Transpose seems to work even without the convert:

julia> B
4×4 Bidiagonal{Int64, UnitRange{Int64}}:
 1  1    
   2  2  
     3  3
       4

julia> Transpose(B)
4×4 transpose(::Bidiagonal{Int64, UnitRange{Int64}}) with eltype Int64:
 1      
 1  2    
   2  3  
     3  4

julia> convert(typeof(B), B)
ERROR: MethodError: Cannot `convert` an object of type Vector{Int64} to an object of type UnitRange{Int64}

julia> VERSION
v"1.14.0-DEV.1818"

I can replicate the failure on using julia's commit 248531f9b6 but this works on e8947b0ecfc, so I wonder if this was just a regression on nightly.

Edit: Looks like JuliaLang/julia@3e744a7 was the fix

@jishnub jishnub merged commit 15df5b3 into master Feb 28, 2026
4 checks passed
@jishnub jishnub deleted the jishnub/convert_special branch February 28, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants