MikeInnes / Poirot.jl

My name is Hercule Poirot and I am probably the greatest detective in the world.
Other
64 stars 2 forks source link

Tracing error due to widening #4

Closed simeonschaub closed 2 years ago

simeonschaub commented 4 years ago

Not sure, if this is the right place to report this, but the following example errors for me:

julia> infer() do
           b = Uniform(-1, 1)
           expr1 = 2*b + 1
           expr2 = -b + 0.5
           expr1 > expr2
       end
ERROR: Tracing Error: MethodError: no method matching widen(::Mjolnir.Multi{Tuple{Mjolnir.Basic,Mjolnir.Numeric}})
You may have intended to import Base.widen
Closest candidates are:
  widen(::Union{Type{T}, Mjolnir.Const{T}, Mjolnir.Node{T}, Mjolnir.Partial{T}, Mjolnir.Shape{T}}) where T at /home/simeon/.julia/packages/Mjolnir/zR0p8/src/infer.jl:29
Stacktrace:
 [1] trace(::Any, ::Any, ::Vararg{Any,N} where N) at /home/simeon/.julia/packages/Mjolnir/zR0p8/src/trace.jl:272
 [2] trace at /home/simeon/.julia/packages/Poirot/8BnHd/src/compiler/simplify.jl:15 [inlined]
 [3] infer(::Function, ::Poirot.Multi) at /home/simeon/.julia/packages/Poirot/8BnHd/src/inference/inference.jl:20
 [4] infer(::Function) at /home/simeon/.julia/packages/Poirot/8BnHd/src/inference/inference.jl:29
 [5] top-level scope at REPL[9]:1
SYSTEM (REPL): showing an error caused an error
ERROR: MethodError: no method matching widen(::Mjolnir.Multi{Tuple{Mjolnir.Basic,Mjolnir.Numeric}})
You may have intended to import Base.widen
Closest candidates are:
  widen(::Union{Type{T}, Mjolnir.Const{T}, Mjolnir.Node{T}, Mjolnir.Partial{T}, Mjolnir.Shape{T}}) where T at /home/simeon/.julia/packages/Mjolnir/zR0p8/src/infer.jl:29
Stacktrace:
 [1] _broadcast_getindex_evalf at ./broadcast.jl:648 [inlined]
 [2] _broadcast_getindex at ./broadcast.jl:621 [inlined]
 [3] (::Base.Broadcast.var"#19#20"{Base.Broadcast.Broadcasted{Base.Broadcast.Style{Tuple},Nothing,typeof(Mjolnir.widen),Tuple{Tuple{Mjolnir.Multi{Tuple{Mjolnir.Basic,Mjolnir.Numeric}},DataType}}}})(::Int64) at ./broadcast.jl:1046
 [4] ntuple at ./ntuple.jl:42 [inlined]
 [5] copy at ./broadcast.jl:1046 [inlined]
 [6] materialize(::Base.Broadcast.Broadcasted{Base.Broadcast.Style{Tuple},Nothing,typeof(Mjolnir.widen),Tuple{Tuple{Mjolnir.Multi{Tuple{Mjolnir.Basic,Mjolnir.Numeric}},DataType}}}) at ./broadcast.jl:837
 [7] showerror(::IO, ::Mjolnir.TraceError) at /home/simeon/.julia/packages/Mjolnir/zR0p8/src/trace.jl:35
 [8] (::Base.var"#689#690"{Mjolnir.TraceError})(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}) at ./errorshow.jl:90
 [9] with_output_color(::Function, ::Symbol, ::IOContext{REPL.Terminals.TTYTerminal}; bold::Bool) at ./util.jl:72
 [10] with_output_color(::Function, ::Symbol, ::IOContext{REPL.Terminals.TTYTerminal}) at ./util.jl:70
 [11] showerror(::IOContext{REPL.Terminals.TTYTerminal}, ::Mjolnir.TraceError, ::Array{Base.StackTraces.StackFrame,1}; backtrace::Bool) at ./errorshow.jl:89
 [12] show_exception_stack(::IOContext{REPL.Terminals.TTYTerminal}, ::Array{Any,1}) at ./errorshow.jl:737
 [13] display_error(::IOContext{REPL.Terminals.TTYTerminal}, ::Array{Any,1}) at ./client.jl:104
 [14] #invokelatest#1 at ./essentials.jl:710 [inlined]
 [15] invokelatest at ./essentials.jl:709 [inlined]
 [16] print_response(::IO, ::Any, ::Bool, ::Bool, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:233
 [17] print_response(::REPL.AbstractREPL, ::Any, ::Bool, ::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:223
 [18] (::REPL.var"#do_respond#54"{Bool,Bool,REPL.var"#64#73"{REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:822
 [19] #invokelatest#1 at ./essentials.jl:710 [inlined]
 [20] invokelatest at ./essentials.jl:709 [inlined]
 [21] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/LineEdit.jl:2354
 [22] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:1143
 [23] (::REPL.var"#38#42"{REPL.LineEditREPL,REPL.REPLBackendRef})() at ./task.jl:356

I am on the latest master for Poirot and Mjolnir:

(Poirot) pkg> st
Status `~/Documents/Julia/Poirot/Project.toml`
  [7869d1d1] IRTools v0.4.0 `https://github.com/MikeInnes/IRTools.jl.git#master`
  [1154507a] Mjolnir v0.1.0 `https://github.com/MikeInnes/Mjolnir.jl#master`
  [8990bfda] Poirot v0.1.0 `https://github.com/MikeInnes/Poirot.jl#master`