Skip to content

Conversation

@jishnub
Copy link
Member

@jishnub jishnub commented Dec 17, 2020

Currently:

julia> Base.showarg(stdout, zeros(1:2, 2:2), false)
OffsetArray(::Array{Float64,2}, 1:2, 2:2)false

Note the false at the end? That happens because toplevel && print(io, ...) evaluates to false, and the returned value is printed 😄. Shifted to an if-else block to avoid this. This also makes the function type-stable.

Now:

julia> Base.showarg(stdout, zeros(1:2, 2:2), false)
OffsetArray(::Array{Float64,2}, 1:2, 2:2)

@jishnub jishnub changed the title Make showarg type-stable and avoid returning the value of toplevel Avoid returning the value of toplevel in Base.showarg Dec 17, 2020
@codecov
Copy link

codecov bot commented Dec 17, 2020

Codecov Report

Merging #173 (60199f4) into master (9589e4d) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #173   +/-   ##
=======================================
  Coverage   99.23%   99.23%           
=======================================
  Files           4        4           
  Lines         260      261    +1     
=======================================
+ Hits          258      259    +1     
  Misses          2        2           
Impacted Files Coverage Δ
src/OffsetArrays.jl 99.45% <100.00%> (+<0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9589e4d...60199f4. Read the comment docs.

@jishnub jishnub merged commit 233a7b9 into JuliaArrays:master Dec 17, 2020
@jishnub jishnub deleted the showarg branch December 17, 2020 15:30
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.

2 participants