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

Vararg{T,T} where T leads to internal error in code_typed #55916

Open
simeonschaub opened this issue Sep 28, 2024 · 0 comments
Open

Vararg{T,T} where T leads to internal error in code_typed #55916

simeonschaub opened this issue Sep 28, 2024 · 0 comments

Comments

@simeonschaub
Copy link
Member

simeonschaub commented Sep 28, 2024

Originally reported by @vtjnash in JuliaDebug/Cthulhu.jl#505, but as a different bug:

julia> f(x) = 1
f (generic function with 1 method)

julia> f(::Vararg{T,T}) where {T} = "2"
f (generic function with 2 methods)

julia> g(x) = f(x)
g (generic function with 1 method)

julia> code_typed(g, (Any,); optimize=false)
ERROR: MethodError: no method matching ⊑(::Core.Compiler.JLTypeLattice, ::Int64, ::Type{Any})
The function `⊑` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  ⊑(::Core.Compiler.JLTypeLattice, ::Type, ::Type)
   @ Core compiler/abstractlattice.jl:153
  ⊑(::Core.Compiler.ConstsLattice, ::Any, ::Any)
   @ Core compiler/typelattice.jl:553
  ⊑(::Core.Compiler.PartialsLattice, ::Any, ::Any)
   @ Core compiler/typelattice.jl:479
  ...

Stacktrace:
  [1] ⊑
    @ ./compiler/typelattice.jl:572 [inlined]
  [2] ⊑(lattice::Core.Compiler.PartialsLattice{Core.Compiler.ConstsLattice}, a::Any, b::Any)
    @ Core.Compiler ./compiler/typelattice.jl:550
  [3] tmerge_fast_path(lattice::Core.Compiler.PartialsLattice{Core.Compiler.ConstsLattice}, typea::Any, typeb::Any)
    @ Core.Compiler ./compiler/typelimits.jl:403
  [4] tmerge(lattice::Core.Compiler.PartialsLattice{Core.Compiler.ConstsLattice}, typea::Any, typeb::Any)
    @ Core.Compiler ./compiler/typelimits.jl:650
  [5] tmerge
    @ ./compiler/typelimits.jl:530
  [6] tmerge
    @ ./compiler/typelimits.jl:490 [inlined]
  [7] #tmerge##0
    @ ./compiler/abstractlattice.jl:291 [inlined]
  [8] collect_slot_refinements
    @ ./compiler/abstractinterpretation.jl:563
  [9] 
    @ Core.Compiler ./compiler/abstractinterpretation.jl:218
 [10] abstract_call_known
    @ ./compiler/abstractinterpretation.jl:2358
 [11] abstract_call(interp::Core.Compiler.NativeInterpreter, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, sv::Core.Compiler.InferenceState, max_methods::Int64)
    @ Core.Compiler ./compiler/abstractinterpretation.jl:2448
 [12] abstract_call(interp::Core.Compiler.NativeInterpreter, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, sv::Core.Compiler.InferenceState)
    @ Core.Compiler ./compiler/abstractinterpretation.jl:2441
 [13] abstract_call(interp::Core.Compiler.NativeInterpreter, arginfo::Core.Compiler.ArgInfo, sv::Core.Compiler.InferenceState)
    @ Core.Compiler ./compiler/abstractinterpretation.jl:2595
 [14] abstract_eval_call(interp::Core.Compiler.NativeInterpreter, e::Expr, vtypes::Vector{Core.Compiler.VarState}, sv::Core.Compiler.InferenceState)
    @ Core.Compiler ./compiler/abstractinterpretation.jl:2608
 [15] abstract_eval_statement_expr(interp::Core.Compiler.NativeInterpreter, e::Expr, vtypes::Vector{Core.Compiler.VarState}, sv::Core.Compiler.InferenceState)
    @ Core.Compiler ./compiler/abstractinterpretation.jl:2843
 [16] abstract_eval_statement(interp::Core.Compiler.NativeInterpreter, e::Any, vtypes::Vector{Core.Compiler.VarState}, sv::Core.Compiler.InferenceState)
    @ Core.Compiler ./compiler/abstractinterpretation.jl:2953
 [17] abstract_eval_basic_statement(interp::Core.Compiler.NativeInterpreter, stmt::Any, pc_vartable::Vector{Core.Compiler.VarState}, frame::Core.Compiler.InferenceState)
    @ Core.Compiler ./compiler/abstractinterpretation.jl:3278
 [18] typeinf_local(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)
    @ Core.Compiler ./compiler/abstractinterpretation.jl:3540
 [19] typeinf_nocycle(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)
    @ Core.Compiler ./compiler/abstractinterpretation.jl:3656
 [20] _typeinf(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)
    @ Core.Compiler ./compiler/typeinfer.jl:262
 [21] typeinf(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)
    @ Core.Compiler ./compiler/typeinfer.jl:207
 [22] typeinf_frame(interp::Core.Compiler.NativeInterpreter, mi::Core.MethodInstance, run_optimizer::Bool)
    @ Core.Compiler ./compiler/typeinfer.jl:1052
 [23] typeinf_code
    @ ./compiler/typeinfer.jl:1007 [inlined]
 [24] typeinf_code
    @ ./compiler/typeinfer.jl:1001 [inlined]
 [25] code_typed_by_type(tt::Type; optimize::Bool, debuginfo::Symbol, world::UInt64, interp::Core.Compiler.NativeInterpreter)
    @ Base ./reflection.jl:1710
 [26] code_typed_by_type
    @ ./reflection.jl:1689 [inlined]
 [27] code_typed(f::Any, types::Any; kwargs::@Kwargs{optimize::Bool})
    @ Base ./reflection.jl:1662
 [28] top-level scope
    @ REPL[10]:1
Some type information was truncated. Use `show(err)` to see complete types.

Regular execution still works though:

julia> g(1)
1
@simeonschaub simeonschaub changed the title Vararg{T,T} where T leads to internal error Vararg{T,T} where T leads to internal error in code_typed Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant