aviatesk / JET.jl

An experimental code analyzer for Julia. No need for additional type annotations.
https://aviatesk.github.io/JET.jl/dev/
MIT License
738 stars 30 forks source link

MethodError: no method matching add_control_flow!(::BitVector, ::Core.Compiler.CFG, ::BitSet) #587

Closed msagarpatel closed 5 months ago

msagarpatel commented 10 months ago

This error occurred in our test suite which uses JET. @Drvi notes:

The crux of the issue is that LoweredCodeUtils changed a method signature of add_control_flow! in this PR (the last arg of add_control_flow! used to be a BitSet which is what JET does). It seems that add_control_flow! is an unexported function, so JET is basically touching internals of this package so semver didn’t guard us here.

  MethodError: no method matching add_control_flow!(::BitVector, ::Core.Compiler.CFG, ::BitSet)

  Closest candidates are:
    add_control_flow!(::Any, ::Any, !Matched::AbstractVector{LoweredCodeUtils.Path})
     @ LoweredCodeUtils ~/.julia/packages/LoweredCodeUtils/4GqSU/src/codeedges.jl:762

  Stacktrace:
    [1] select_dependencies!(concretize::BitVector, src::Core.CodeInfo, edges::LoweredCodeUtils.CodeEdges)
      @ JET ~/.julia/packages/JET/wFGWz/src/toplevel/virtualprocess.jl:1195
    [2] select_statements(src::Core.CodeInfo)
      @ JET ~/.julia/packages/JET/wFGWz/src/toplevel/virtualprocess.jl:1066
    [3] partially_interpret!(interp::JET.ConcreteInterpreter{JET.var"#usemodule_with_err_handling#56"{JET.VirtualProcessResult, String, JET.ToplevelConfig, Int64, Set{Symbol}, Base.RefValue{LineNumberNode}, JET.var"#err_handler#49"{JET.VirtualProcessResult, String, Base.RefValue{LineNumberNode}}}, JET.JETAnalyzer{JET.BasicPass}}, mod::Module, src::Core.CodeInfo)
      @ JET ~/.julia/packages/JET/wFGWz/src/toplevel/virtualprocess.jl:1040
    [4] _virtual_process!(res::JET.VirtualProcessResult, toplevelex::Expr, filename::String, analyzer::JET.JETAnalyzer{JET.BasicPass}, config::JET.ToplevelConfig, context::Module, pkg_mod_depth::Int64, force_concretize::Bool)
      @ JET ~/.julia/packages/JET/wFGWz/src/toplevel/virtualprocess.jl:804
    [5] _virtual_process!
      @ ~/.julia/packages/JET/wFGWz/src/toplevel/virtualprocess.jl:611 [inlined]
    [6] _virtual_process!(res::JET.VirtualProcessResult, s::String, filename::String, analyzer::JET.JETAnalyzer{JET.BasicPass}, config::JET.ToplevelConfig, context::Module, pkg_mod_depth::Int64)
      @ JET ~/.julia/packages/JET/wFGWz/src/toplevel/virtualprocess.jl:591
    [7] virtual_process(x::String, filename::String, analyzer::JET.JETAnalyzer{JET.BasicPass}, config::JET.ToplevelConfig)
      @ JET ~/.julia/packages/JET/wFGWz/src/toplevel/virtualprocess.jl:445
    [8] #analyze_and_report_text!#134
      @ ~/.julia/packages/JET/wFGWz/src/JET.jl:992 [inlined]
    [9] analyze_and_report_file!(analyzer::JET.JETAnalyzer{JET.BasicPass}, filename::String, pkgid::Nothing; jetconfigs::Base.Pairs{Symbol, Any, NTuple{7, Symbol}, NamedTuple{(:ignored_modules, :analyze_from_definitions, :concretization_patterns, :context, :target_defined_modules, :toplevel_logger, :mode), Tuple{Nothing, Bool, Vector{Any}, Module, Bool, Nothing, Symbol}}})
      @ JET ~/.julia/packages/JET/wFGWz/src/JET.jl:800
   [10] analyze_and_report_file! (repeats 2 times)
      @ ~/.julia/packages/JET/wFGWz/src/JET.jl:795 [inlined]
   [11] report_file(args::String; jetconfigs::Base.Pairs{Symbol, Any, NTuple{7, Symbol}, NamedTuple{(:ignored_modules, :analyze_from_definitions, :concretization_patterns, :context, :target_defined_modules, :toplevel_logger, :mode), Tuple{Nothing, Bool, Vector{Any}, Module, Bool, Nothing, Symbol}}})
      @ JET ~/.julia/packages/JET/wFGWz/src/analyzers/jetanalyzer.jl:1665
   [12] report_file
      @ ~/.julia/packages/JET/wFGWz/src/analyzers/jetanalyzer.jl:1662 [inlined]
   [13] jet_test_file(file_path::String; ignored_modules::Nothing, jet_frames_to_skip::Tuple{}, analyze_from_definitions::Bool, concretization_patterns::Vector{Any}, context::Module, target_defined_modules::Bool, mode::Symbol)
      @ Main.var"##JET error analysis from package definitions#318" ~/packages/jet_test_utils.jl:197
...truncated...
aviatesk commented 10 months ago

Yeah, we need to update JET so that it is compatible with the latest version of LoweredCodeUtils.

aviatesk commented 5 months ago

Fixed in 0.9.0.