mcabbott / mcabbott/InTheRed.jl

Error printing integers with `nothing`

Open
#5 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
4
Forks
0
PR merge metrics
No merged PRs in 30d

Description

julia> [1,2,3,nothing,4]
5-element Vector{Union{Nothing, Int64}}:
 1         #    ┝━━━━━━━━
 2         #    ┝━━━━━━━━━━━━━━━━╸
 3         #    ┝━━━━━━━━━━━━━━━━━━━━━━━━╸
  nothing  #  Error showing value of type Vector{Union{Nothing, Int64}}:

SYSTEM (REPL): showing an error caused an error
ERROR: 1-element ExceptionStack:
MethodError: no method matching isfinite(::Nothing)
The function `isfinite` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  isfinite(::Missing)
   @ Base missing.jl:101
  isfinite(::BigFloat)
   @ Base mpfr.jl:1048
  isfinite(::FixedPointNumbers.FixedPoint)
   @ FixedPointNumbers ~/.julia/packages/FixedPointNumbers/Dn4hv/src/FixedPointNumbers.jl:102
  ...

Stacktrace:
  [1] print_matrix_row(io::IOContext{…}, X::AbstractVector, A::Vector{…}, i::Int64, cols::Vector{…}, ::Tuple{…}, idxlast::Int64)
    @ InTheRed ~/.julia/dev/InTheRed/src/InTheRed.jl:391
  [2] _print_matrix(io::IOContext{…}, X::AbstractVecOrMat, pre::String, sep::Tuple{…}, post::String, hdots::String, vdots::String, ddots::String, hmod::Int64, vmod::Int64, rowsA::UnitRange{…}, colsA::UnitRange{…})
    @ Base ./arrayshow.jl:213
  [3] print_matrix(io::IOContext{…}, X::AbstractVector{…}, pre::String, sep::String, post::String, hdots::String, vdots::String, ddots::String, hmod::Int64, vmod::Int64)
    @ InTheRed ~/.julia/dev/InTheRed/src/InTheRed.jl:339
  [4] print_matrix
    @ ~/.julia/dev/InTheRed/src/InTheRed.jl:337 [inlined]
  [5] print_array
    @ ./arrayshow.jl:358 [inlined]
  [6] show(io::IOContext{Base.TTY}, ::MIME{Symbol("text/plain")}, X::Vector{Union{Nothing, Int64}})
    @ Base ./arrayshow.jl:399

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Julia REPL expression from the issue, then inspect print_matrix_row and print_matrix in src/InTheRed.jl around lines 337-391, alongside the related Base arrayshow call. Done means displaying a vector containing nothing without the showing error or the isfinite(::Nothing) MethodError.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.