Skip to content

Problem with Hecke and Revise #2195

@aaruni96

Description

@aaruni96

I am trying to write some Hecke code, and I am not able to apply the Hecke.example() and Hecke.revise() strategy on my code ( https://github.com/aaruni96/Hecke.jl/blob/ak96/rectangles/examples/packingproblem/Interval.jl ).

I am using recent versions of Hecke and Revise:

(hecketmp) pkg> st
Status `~/Desktop/hecketmp/Project.toml`
  [3e1990a7] Hecke v0.39.12 `~/Programs/git/Github/Hecke.jl`
  [295af30f] Revise v3.13.2

Running the code without Hecke, using just Revise.includet() allows me to use Revise.

julia> Hecke.example("packingproblem/Interval.jl")
rectarray (generic function with 1 method)

julia> Hecke.revise("packingproblem/Interval.jl")

julia> r1 = rectangle(0//1, 1//3, 0//1, 1//3)
rectangle(interval(0//1, 1//3), interval(0//1, 1//3))

julia> r2 = rectangle(2//3, 1//1, 2//3, 1//1)
rectangle(interval(2//3, 1//1), interval(2//3, 1//1))

# intentional bug
julia> intersect(r1, r2)
(false, nothing)(false, nothing)ERROR: MethodError: no method matching rectangle(::Nothing, ::Nothing)
The type `rectangle` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:
  rectangle(::interval, ::interval)
   @ Main ~/Programs/git/Github/Hecke.jl/examples/packingproblem/Interval.jl:55
  rectangle(::Rational, ::Rational, ::Rational, ::Rational)
   @ Main ~/Programs/git/Github/Hecke.jl/examples/packingproblem/Interval.jl:16
  rectangle(::Integer)
   @ Main ~/Programs/git/Github/Hecke.jl/examples/packingproblem/Interval.jl:27
  ...

Stacktrace:
 [1] intersect(r1::rectangle, r2::rectangle)
   @ Main ~/Programs/git/Github/Hecke.jl/examples/packingproblem/Interval.jl:109
 [2] top-level scope
   @ REPL[7]:1

# try to fix the bug and run the example again
julia> intersect(r1, r2)
┌ Error: Failed to revise /home/akaushik/Programs/git/Github/Hecke.jl/src/../examples/packingproblem/Interval.jl
│   exception =
│    AssertionError: ld[idx] < typemax(eltype(ld))
│    Stacktrace:
│      [1] handle_method_deletion!(siginfo::Revise.SigInfo, rex::Revise.RelocatableExpr, world::UInt64)
│        @ Revise ~/.julia/packages/Revise/b0dDX/src/packagedef.jl:381
│      [2] (::Revise.var"#delete_missing!##0#delete_missing!##1"{OrderedCollections.OrderedDict{Revise.RelocatableExpr, Union{Nothing, Vector{Union{Revise.SigInfo, Revise.TypeInfo}}}}, OrderedCollections.OrderedDict{Revise.RelocatableExpr, Union{Nothing, Vector{Union{Revise.SigInfo, Revise.TypeInfo}}}}, IdSet{Union{Method, Type}}, IdSet{Type}, UInt64})()
│        @ Revise ~/.julia/packages/Revise/b0dDX/src/packagedef.jl:339
│      [3] with_logstate(f::Revise.var"#delete_missing!##0#delete_missing!##1"{OrderedCollections.OrderedDict{Revise.RelocatableExpr, Union{Nothing, Vector{Union{Revise.SigInfo, Revise.TypeInfo}}}}, OrderedCollections.OrderedDict{Revise.RelocatableExpr, Union{Nothing, Vector{Union{Revise.SigInfo, Revise.TypeInfo}}}}, IdSet{Union{Method, Type}}, IdSet{Type}, UInt64}, logstate::Base.CoreLogging.LogState)
│        @ Base.CoreLogging ./logging/logging.jl:542
│      [4] with_logger
│        @ ./logging/logging.jl:653 [inlined]
│      [5] delete_missing!
│        @ ~/.julia/packages/Revise/b0dDX/src/packagedef.jl:338 [inlined]
│      [6] delete_missing!(mod_exs_infos_old::OrderedCollections.OrderedDict{Module, OrderedCollections.OrderedDict{Revise.RelocatableExpr, Union{Nothing, Vector{Union{Revise.SigInfo, Revise.TypeInfo}}}}}, mod_exs_infos_new::OrderedCollections.OrderedDict{Module, OrderedCollections.OrderedDict{Revise.RelocatableExpr, Union{Nothing, Vector{Union{Revise.SigInfo, Revise.TypeInfo}}}}}, reeval_list::IdSet{Union{Method, Type}}, handled_types::IdSet{Type}, world::UInt64)
│        @ Revise ~/.julia/packages/Revise/b0dDX/src/packagedef.jl:362
│      [7] handle_deletions(pkgdata::Revise.PkgData, file::String, reeval_list::IdSet{Union{Method, Type}}, handled_types::IdSet{Type}, world::UInt64)
│        @ Revise ~/.julia/packages/Revise/b0dDX/src/packagedef.jl:745
│      [8] macro expansion
│        @ ~/.julia/packages/Revise/b0dDX/src/packagedef.jl:948 [inlined]
│      [9] macro expansion
│        @ ./lock.jl:376 [inlined]
│     [10] revise(; throw::Bool)
│        @ Revise ~/.julia/packages/Revise/b0dDX/src/packagedef.jl:930
│     [11] revise()
│        @ Revise ~/.julia/packages/Revise/b0dDX/src/packagedef.jl:926
│     [12] top-level scope
│        @ REPL:1
└ @ Revise ~/.julia/packages/Revise/b0dDX/src/packagedef.jl:900
┌ Warning: The running code does not match the saved version for the following files:
│ 
│   /home/akaushik/Programs/git/Github/Hecke.jl/src/../examples/packingproblem/Interval.jl
│ 
│ If the error was due to evaluation order, it can sometimes be resolved by calling `Revise.retry()`.
│ Use Revise.errors() to report errors again. Only the first error in each file is shown.
│ Your prompt color may be yellow until the errors are resolved.
└ @ Revise ~/.julia/packages/Revise/b0dDX/src/packagedef.jl:1031
(false, nothing)(false, nothing)ERROR: MethodError: no method matching rectangle(::Nothing, ::Nothing)
The type `rectangle` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:
  rectangle(::interval, ::interval)
   @ Main ~/Programs/git/Github/Hecke.jl/examples/packingproblem/Interval.jl:55
  rectangle(::Rational, ::Rational, ::Rational, ::Rational)
   @ Main ~/Programs/git/Github/Hecke.jl/examples/packingproblem/Interval.jl:16
  rectangle(::Integer)
   @ Main ~/Programs/git/Github/Hecke.jl/examples/packingproblem/Interval.jl:27
  ...

Stacktrace:
 [1] intersect(r1::rectangle, r2::rectangle)
   @ Main ~/Programs/git/Github/Hecke.jl/examples/packingproblem/Interval.jl:109
 [2] top-level scope
   @ REPL[7]:1

The exact same file, with the exact same changes, work using just Revise :

julia> using Revise

julia> Revise.includet("/home/akaushik/Programs/git/Github/Hecke.jl/examples/packingproblem/Interval.jl")

julia> r1 = rectangle(0//1, 1//3, 0//1, 1//3)
rectangle(interval(0//1, 1//3), interval(0//1, 1//3))

julia> r2 = rectangle(2//3, 1//1, 2//3, 1//1)
rectangle(interval(2//3, 1//1), interval(2//3, 1//1))

# intentional bug
julia> intersect(r1, r2)
(false, nothing)(false, nothing)ERROR: MethodError: no method matching rectangle(::Nothing, ::Nothing)
The type `rectangle` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:
  rectangle(::interval, ::interval)
   @ Main ~/Programs/git/Github/Hecke.jl/examples/packingproblem/Interval.jl:55
  rectangle(::Rational, ::Rational, ::Rational, ::Rational)
   @ Main ~/Programs/git/Github/Hecke.jl/examples/packingproblem/Interval.jl:16
  rectangle(::Integer)
   @ Main ~/Programs/git/Github/Hecke.jl/examples/packingproblem/Interval.jl:27
  ...

Stacktrace:
 [1] intersect(r1::rectangle, r2::rectangle)
   @ Main ~/Programs/git/Github/Hecke.jl/examples/packingproblem/Interval.jl:109
 [2] top-level scope
   @ REPL[5]:1

# try to fix the bug and run again
julia> intersect(r1, r2)
(false, nothing)(false, nothing)(false, nothing)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions