Skip to content

BUG: strange error when using methods function #8163

@sglyon

Description

@sglyon

Consider this very dumb example:

julia> g(x, y) = println("$(typeof(x))\t$(typeof(y))")
g (generic function with 1 method)

julia> g(1.0, 2)
Float64 Int64

julia> methods(g)
#1 method for generic function "g":
g(x,y) at none:1

julia> g(x::Vector, y::Real) = println("Vector and Real")
g (generic function with 2 methods)

julia> g([1.0], 2.0)   # so we know it works
Vector and Real

julia> methods(g)
#2 methods for generic function "g":
gError showing value of type MethodTable:
ERROR: type DataType has no field body
 in show at show.jl:80 (repeats 2 times)
 in print_to_string at ./string.jl:24
 in argtype_decl at methodshow.jl:18
 in arg_decl_parts at methodshow.jl:30
 in show at methodshow.jl:36
 in show_method_table at methodshow.jl:61
 in show at methodshow.jl:74
 in anonymous at show.jl:1107
 in with_output_limit at ./show.jl:1084
 in showlimited at show.jl:1106
 in writemime at replutil.jl:2
 in display at REPL.jl:118
 in display at REPL.jl:121
 in display at multimedia.jl:149
 in print_response at REPL.jl:140
 in print_response at REPL.jl:125
 in anonymous at REPL.jl:587
 in run_interface at ./LineEdit.jl:1377
 in run_interface at /usr/local/julia/usr/lib/julia/sys.dylib
 in run_frontend at ./REPL.jl:819
 in run_repl at ./REPL.jl:170
 in _start at ./client.jl:399
 in _start at /usr/local/julia/usr/lib/julia/sys.dylib

Any idea why this is happening?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions