Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect printing of types with source code #473

Open
Zentrik opened this issue Jun 19, 2023 · 1 comment
Open

Incorrect printing of types with source code #473

Zentrik opened this issue Jun 19, 2023 · 1 comment
Labels
bug Something isn't working TypedSyntax An issue or pull request relating to the TypedSyntax.jl subpackage

Comments

@Zentrik
Copy link
Collaborator

Zentrik commented Jun 19, 2023

julia> @descend Base.print_to_string(Float64)
print_to_string(xs...) in Base at strings/io.jl:133
133 function print_to_string(xs::Tuple{DataType}...)::String
134     if isempty(xs::Tuple{DataType})::Bool
135         return ""
136     end
137     (siz::Int::Type{Int64})::Int64 = 0
138     for x::Type{Float64} in xs::Tuple{DataType}::Tuple{DataType, Int64}
139         (siz::Int64 += _str_sizehint(x::Type{Float64})::Int64)::Int64
140     ::Int64end
141     # specialized for performance reasons
142     s::IOBuffer = IOBuffer::Type{IOBuffer}(sizehint=siz::Int64::Tuple{Int64})::Core.var"#Type##kw"
143     for x::Type{Float64} in xs::Tuple{DataType}::Tuple{DataType, Int64}
144         print(s::IOBuffer, x::Type{Float64})
145     end
146     String::Type{String}(resize!(s::IOBuffer.data::Vector{UInt8}, s::IOBuffer.size::Int64)::Vector{UInt8})::String
147 end
Select a call to descend into or  to ascend. [q]uit. [b]ookmark.
Toggles: [w]arn, [h]ide type-stable statements, [t]ype annotations, [s]yntax highlight for Source/LLVM/Native.
Show: [S]ource code, [A]ST, [T]yped code, [L]LVM IR, [N]ative code
Actions: [E]dit source code, [R]evise and redisplay
 • 134 isempty(xs::Tuple{DataType})
   %7 = < concrete eval > convert(::Core.Const(Int64),::Core.Const(0))::Core.Const(0)
   138  x::Type{Float64} in xs::Tuple{DataType}
   139 _str_sizehint(x::Type{Float64})
   139 siz::Int64 += _str_sizehint(x::Type{Float64})::Int64
   138 \n139         (siz::Int64 += _str_sizehint(x::Type{Float64})::Int64)::Int64\n140 
   %22 = < constprop > iterate(::Core.Const((Float64,)),::Core.Const(2))::Core.Const(nothing)
   142 IOBuffer(sizehint=siz)
   142 IOBuffer::Type{IOBuffer}(sizehint=siz::Int64::Tuple{Int64})
v  142 s

On line 140 the ::Int64 is wrong. The 138 \n139 (siz::Int64 += _str_sizehint(x::Type{Float64})::Int64)::Int64\n140 seems wrong as well

@timholy
Copy link
Member

timholy commented Jul 11, 2024

This seems mostly fixed, although there is still some non-calls printed in the descend menu:

   %5 = isempty(::Tuple{DataType})::Core.Const(false)
    x::Type{Float64} in xs::Tuple{DataType}
   _str_sizehint(x::Type{Float64})
   siz += _str_sizehint(x)
   %33 = < concrete eval > iterate(::Core.Const((Float64,)),::Core.Const(2))::Core.Const(nothing)
   IOBuffer(sizehint=siz::Int64::Tuple{Int64})
 • s
    x::Type{Float64} in xs::Tuple{DataType}

See the plain s with • next to it. Hitting Enter attempts to take you into kwcall(::NamedTuple, ::Type{IOBuffer}) @ Base ~/.julia/juliaup/julia-1.10.4+0.x64.linux.gnu/share/julia/base/iobuffer.jl:106

@simeonschaub simeonschaub added TypedSyntax An issue or pull request relating to the TypedSyntax.jl subpackage bug Something isn't working labels Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working TypedSyntax An issue or pull request relating to the TypedSyntax.jl subpackage
Projects
None yet
Development

No branches or pull requests

3 participants