JuliaDebug / Cthulhu.jl

The slow descent into madness
MIT License
644 stars 41 forks source link

Display certain unions with `Base.warn_color()` to match `code_warntype` #533

Open jishnub opened 8 months ago

jishnub commented 8 months ago

On Julia nightly,

julia> using LinearAlgebra

julia> @code_warntype rand(3,3) \ Bidiagonal(1:3, 1:2, :U)

vs

julia> @descend_code_warntype rand(3,3) \ Bidiagonal(1:3, 1:2, :U)

show the return types with different colors. @code_warntype uses yellow, whereas @descend_code_warntype uses red. It would be good for these to be identical.

Cthulhu:

@code_warntype:

This is on the master branch of Cthulhu with

julia> versioninfo()
Julia Version 1.11.0-DEV.1247
Commit 2afc20c18a8 (2024-01-10 16:38 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, tigerlake)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)
Environment:
  LD_LIBRARY_PATH = :/usr/lib/x86_64-linux-gnu/gtk-3.0/modules
  JULIA_EDITOR = subl

(Cthulhu) pkg> st
Project Cthulhu v2.10.0
Status `~/Dropbox/JuliaPackages/Cthulhu.jl/Project.toml`
  [da1fd8a2] CodeTracking v1.3.5
  [1eca21be] FoldingTrees v1.2.1
  [70703baa] JuliaSyntax v0.4.8
  [aea7be01] PrecompileTools v1.2.0
  [21216c6a] Preferences v1.4.1
  [d265eb64] TypedSyntax v1.2.4
  [b8c1c048] WidthLimitedIO v1.0.1
  [b77e0a4c] InteractiveUtils v1.11.0
  [3fa0cd96] REPL v1.11.0
  [cf7118a7] UUIDs v1.11.0
  [4ec0a83e] Unicode v1.11.0
Zentrik commented 8 months ago

If anyone wants to fix, https://github.com/JuliaDebug/Cthulhu.jl/blob/c93216d53a712822b8d74b10eca1e7b0a1c6ea60/TypedSyntax/src/show.jl#L123