tecosaur / About.jl

Mirror of https://code.tecosaur.net/tec/About.jl
Mozilla Public License 2.0
119 stars 6 forks source link

`about(BigInt(0))` throws exception #26

Open screwdog opened 2 weeks ago

screwdog commented 2 weeks ago

On Julia 1.10 an exception occurs when using About on BigInt values.

julia> about(BigInt(1))
BigInt (mutable) (<: Signed <: Integer <: Real <: Number <: Any), occupies 16B directly (referencing 24B in total)
 alloc::Int32       4B 000000 … 00001 1
  size::Int32       4B 000000 … 00001 1
ERROR: MethodError: no method matching face!(::String, ::Symbol)

Closest candidates are:
  face!(::Union{StyledStrings.AnnotatedStrings.AnnotatedString, SubString{<:StyledStrings.AnnotatedStrings.AnnotatedString}}, ::Union{Symbol, StyledStrings.Face, Vector{<:Union{Symbol, StyledStrings.Face}}})
   @ StyledStrings ~/.julia/packages/StyledStrings/rd5VN/src/faces.jl:622

Stacktrace:
 [1] memorylayout(io::Base.TTY, value::BigInt)
   @ About ~/.julia/packages/About/52iMk/src/values.jl:106
 [2] about(io::Base.TTY, value::BigInt)
   @ About ~/.julia/packages/About/52iMk/src/values.jl:43
[...]

Version info:

Julia Version 1.10.4
Commit 48d4fd48430 (2024-06-04 10:41 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 32 × 13th Gen Intel(R) Core(TM) i9-13900KF
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, goldmont)
Threads: 32 default, 0 interactive, 16 GC (on 32 virtual cores)
Environment:
  JULIA_NUM_THREADS = auto
  JULIA_EDITOR = code
matthias314 commented 2 weeks ago

I've come across the same issue with my package LinearCombinations.jl:

julia> using About, LinearCombinations

julia> a = Linear('a'+k => k for k in 1:20)
13*n+19*t+5*f+20*u+2*c+3*d+4*e+15*p+14*o+12*m+6*g+7*h+8*i+9*j+10*k+11*l+17*r+16*q+b+18*s

julia> about(a)
Linear{Char, Int64} (<: AbstractLinear{Char, Int64} <: Any), occupies 8B directly (referencing 992B in total)
ERROR: MethodError: no method matching face!(::String, ::Symbol)

Closest candidates are:
  face!(::Union{StyledStrings.AnnotatedStrings.AnnotatedString, SubString{<:StyledStrings.AnnotatedStrings.AnnotatedString}}, ::Union{Symbol, StyledStrings.Face, Vector{<:Union{Symbol, StyledStrings.Face}}})
   @ StyledStrings ~/.julia/packages/StyledStrings/rd5VN/src/faces.jl:622

Stacktrace:
 [1] memorylayout(io::Base.TTY, value::Linear{Char, Int64})
   @ About ~/.julia/packages/About/52iMk/src/values.jl:106
 [2] about(io::Base.TTY, value::Linear{Char, Int64})
   @ About ~/.julia/packages/About/52iMk/src/values.jl:43
 [3] about(x::Linear{Char, Int64})
   @ About ~/.julia/packages/About/52iMk/src/About.jl:201
 [4] top-level scope
   @ REPL[9]:1