jonniedie / ComponentArrays.jl

Arrays with arbitrarily nested named components.
MIT License
287 stars 34 forks source link

Consider redacting printing of Axis types #172

Open nrontsis opened 1 year ago

nrontsis commented 1 year ago

This PR reduces the very long stacktraces that can sometimes occur with ComponentArrays, by having by introducing a redacted form of Base.show for Axis types.

Example:

using ComponentArrays
h() = nothing
h(ComponentArray(zeros(3, 2), Axis((:first, :second, :third, :fourth)), FlatAxis()))

now gives

ERROR: MethodError: no method matching h(::ComponentMatrix{Float64, Matrix{Float64}, Tuple{Axis{...}, FlatAxis}})
Closest candidates are:
  h() at REPL[2]:1
Stacktrace:
 [1] top-level scope
   @ REPL[3]:1

instead of

ERROR: MethodError: no method matching h(::ComponentMatrix{Float64, Matrix{Float64}, Tuple{Axis{(first = 1, second = 2, third = 3, fourth = 4)}, FlatAxis}})
Closest candidates are:
  h() at REPL[2]:1
Stacktrace:
 [1] top-level scope
   @ REPL[3]:1

Relevant discourse threads: [1], [2]

codecov-commenter commented 1 year ago

Codecov Report

Merging #172 (a94945b) into master (cbb24ef) will decrease coverage by 0.89%. The diff coverage is 14.28%.

@@            Coverage Diff             @@
##           master     #172      +/-   ##
==========================================
- Coverage   73.49%   72.59%   -0.90%     
==========================================
  Files          20       20              
  Lines         679      686       +7     
==========================================
- Hits          499      498       -1     
- Misses        180      188       +8     
Impacted Files Coverage Δ
src/show.jl 1.69% <14.28%> (-2.16%) :arrow_down:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more