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

Broken in 1.6+ #13

Open
johnnychen94 opened this issue Sep 6, 2020 · 10 comments
Open

Broken in 1.6+ #13

johnnychen94 opened this issue Sep 6, 2020 · 10 comments

Comments

@johnnychen94
Copy link
Member

johnnychen94 commented Sep 6, 2020

Looks like some methods in julia and Cassette have changed and it breaks the functionality here:

To reproduce:

julia> versioninfo()
Julia Version 1.6.0-DEV.847
Commit 483b63780a (2020-09-05 18:19 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)

(@v1.6) pkg> test SimpleMock
@christopher-dG
Copy link
Member

Yeah, Cassette tends to not play well with nightly. I don't think any of the errors are on my end so I'm mostly likely just going to sit tight and wait for things to be fixed in Julia and Cassette.

@ranocha
Copy link

ranocha commented Feb 7, 2021

I can at least report the the tests of Cassette.jl v.0.3.4 pass while the tests of SimpleMock.jl v1.2.0 fail on Julia v1.6.0-rc:

Multiple mocks: Error During Test at /~/.julia/packages/SimpleMock/zgRuh/test/mock_fun.jl:33
  Got exception outside of a @test
  MethodError: no method matching Int64(::Mock{SimpleMock.var"#15#17"{SimpleMock.var"#15#16#18"}})
  Closest candidates are:
    (::Type{T})(::AbstractChar) where T<:Union{AbstractChar, Number} at char.jl:50
    (::Type{T})(::BigInt) where T<:Union{Int128, Int16, Int32, Int64, Int8} at gmp.jl:356
    (::Type{T})(::Base.TwicePrecision) where T<:Number at twiceprecision.jl:243
    ...
  Stacktrace:
    [1] call
      @ ~/.julia/packages/Cassette/Wjztv/src/context.jl:456 [inlined]
    [2] fallback
      @ ~/.julia/packages/Cassette/Wjztv/src/context.jl:454 [inlined]
    [3] overdub(::Cassette.Context{nametype(##334), SimpleMock.Metadata{false}, Nothing, Cassette.var"##PassType#259", Nothing, Nothing}, ::Type{Int64}, ::Mock{SimpleMock.var"#15#17"{SimpleMock.var"#15#16#18"}})
      @ Cassette ~/.julia/packages/Cassette/Wjztv/src/overdub.jl:545
    [4] overdub
      @ ./abstractarray.jl:1113 [inlined]
    [5] overdub
      @ ./array.jl:265 [inlined]
    [6] overdub(::Cassette.Context{nametype(##334), SimpleMock.Metadata{false}, Nothing, Cassette.var"##PassType#259", Nothing, Nothing}, ::typeof(unsafe_copyto!), ::Vector{Union{Ptr{Nothing}, Base.InterpreterIP}}, ::Int64, ::Vector{Union{Ptr{Nothing}, Base.InterpreterIP}}, ::Int64, ::Int64)
      @ Cassette ~/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
    [7] overdub
      @ ./array.jl:811 [inlined]
    [8] overdub
      @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:56 [inlined]
    [9] overdub(::Cassette.Context{nametype(##334), SimpleMock.Metadata{false}, Nothing, Cassette.var"##PassType#259", Nothing, Nothing}, ::typeof(Test.scrub_backtrace), ::Vector{Union{Ptr{Nothing}, Base.InterpreterIP}})
      @ Cassette ~/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
   [10] overdub
      @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:62 [inlined]
   [11] overdub(::Cassette.Context{nametype(##334), SimpleMock.Metadata{false}, Nothing, Cassette.var"##PassType#259", Nothing, Nothing}, ::typeof(Test.scrub_exc_stack), ::Vector{Any})
      @ Cassette ~/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
   [12] overdub
      @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:165 [inlined]
   [13] overdub(::Cassette.Context{nametype(##334), SimpleMock.Metadata{false}, Nothing, Cassette.var"##PassType#259", Nothing, Nothing}, ::Type{Test.Error}, ::Symbol, ::Expr, ::MethodError, ::Vector{Any}, ::LineNumberNode)
      @ Cassette ~/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
   [14] overdub
      @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:553 [inlined]
   [15] overdub(::Cassette.Context{nametype(##334), SimpleMock.Metadata{false}, Nothing, Cassette.var"##PassType#259", Nothing, Nothing}, ::typeof(Test.do_test), ::Test.Threw, ::Expr)
      @ Cassette ~/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
   [16] overdub
      @ ~/.julia/packages/SimpleMock/zgRuh/test/mock_fun.jl:37 [inlined]
   [17] overdub(::Cassette.Context{nametype(##334), SimpleMock.Metadata{false}, Nothing, Cassette.var"##PassType#259", Nothing, Nothing}, ::var"#13#14", ::Mock{SimpleMock.var"#15#17"{SimpleMock.var"#15#16#18"}}, ::Mock{SimpleMock.var"#15#17"{SimpleMock.var"#15#16#18"}})
      @ Cassette ~/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
   [18] invokelatest(::Any, ::Any, ::Vararg{Any, N} where N; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
      @ Base ./essentials.jl:707
   [19] invokelatest(::Any, ::Any, ::Vararg{Any, N} where N)
      @ Base ./essentials.jl:706
   [20] mock(::Function, ::Symbol, ::Function, ::Vararg{Function, N} where N; filters::Vector{Function})
      @ SimpleMock ~/.julia/packages/SimpleMock/zgRuh/src/mock_fun.jl:140
   [21] #mock#35
      @ ~/.julia/packages/SimpleMock/zgRuh/src/mock_fun.jl:113 [inlined]
   [22] mock(::Function, ::Function, ::Function)
      @ SimpleMock ~/.julia/packages/SimpleMock/zgRuh/src/mock_fun.jl:113
   [23] macro expansion
      @ ~/.julia/packages/SimpleMock/zgRuh/test/mock_fun.jl:34 [inlined]
   [24] macro expansion
      @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
   [25] top-level scope
      @ ~/.julia/packages/SimpleMock/zgRuh/test/mock_fun.jl:34
   [26] include(fname::String)
      @ Base.MainInclude ./client.jl:444
   [27] macro expansion
      @ ~/.julia/packages/SimpleMock/zgRuh/test/runtests.jl:14 [inlined]
   [28] macro expansion
      @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
   [29] macro expansion
      @ ~/.julia/packages/SimpleMock/zgRuh/test/runtests.jl:14 [inlined]
   [30] macro expansion
      @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
   [31] top-level scope
      @ ~/.julia/packages/SimpleMock/zgRuh/test/runtests.jl:10
   [32] include(fname::String)
      @ Base.MainInclude ./client.jl:444
   [33] top-level scope
      @ none:6
   [34] eval(m::Module, e::Any)
      @ Core ./boot.jl:360
   [35] exec_options(opts::JLOptions)
      @ Base ./client.jl:261
   [36] _start()
      @ Base ./client.jl:485

@ranocha
Copy link

ranocha commented Feb 8, 2021

We get a similar error in our tests in Trixi.jl at
https://github.com/trixi-framework/Trixi.jl/pull/438/checks?check_run_id=1853639267#step:6:586

  TypeError: in Vararg, in count, expected Int64, got Type{Union{StaticArrays.Dynamic, Int64}}
  Stacktrace:
    [1] call(#unused#::Cassette.Context{N, var"#s3", Nothing, P, B, H} where {N<:Cassette.AbstractContextName, var"#s3", P<:Cassette.AbstractPass, B<:Union{Nothing, IdDict{Module, Dict{Symbol, Cassette.BindingMeta}}}, H<:Union{Cassette.DisableHooks, Nothing}}, f::typeof(Core.apply_type), #unused#::Type{A}, #unused#::Type{B}) where {A, B}
      @ Cassette ~/.julia/packages/Cassette/Wjztv/src/context.jl:463
    [2] fallback(::Cassette.Context{nametype(##258), SimpleMock.Metadata{false}, Nothing, Cassette.var"##PassType#259", Nothing, Nothing}, ::Function, ::Vararg{Any, N} where N)
      @ Cassette ~/.julia/packages/Cassette/Wjztv/src/context.jl:454
    [3] overdub(::Cassette.Context{nametype(##258), SimpleMock.Metadata{false}, Nothing, Cassette.var"##PassType#259", Nothing, Nothing}, ::typeof(Core.apply_type), ::Type{Vararg{Any, N} where N}, ::Type{Union{StaticArrays.Dynamic, Int64}})
      @ Cassette ~/.julia/packages/Cassette/Wjztv/src/overdub.jl:545
    [4] overdub
      @ ~/.julia/packages/StaticArrays/NTbHj/src/traits.jl:61 [inlined]
    [5] overdub(overdub_context#257::Cassette.Context{nametype(##258), SimpleMock.Metadata{false}, Nothing, Cassette.var"##PassType#259", Nothing, Nothing}, overdub_arguments#258::Type{StaticArrays.Size{(2,)}})
      @ Cassette ~/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
    [6] overdub
      @ ~/.julia/packages/StaticArrays/NTbHj/src/traits.jl:67 [inlined]
    [7] overdub(::Cassette.Context{nametype(##258), SimpleMock.Metadata{false}, Nothing, Cassette.var"##PassType#259", Nothing, Nothing}, ::Type{StaticArrays.Size}, ::Type{Tuple{2}})
      @ Cassette ~/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
    [8] overdub
      @ ~/.julia/packages/StaticArrays/NTbHj/src/traits.jl:89 [inlined]
    [9] overdub
      @ ~/.julia/packages/StaticArrays/NTbHj/src/abstractarray.jl:2 [inlined]
   [10] overdub(::Cassette.Context{nametype(##258), SimpleMock.Metadata{false}, Nothing, Cassette.var"##PassType#259", Nothing, Nothing}, ::typeof(length), ::Type{StaticArrays.SVector{2, Float64}})
      @ Cassette ~/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
   [11] overdub
      @ ~/.julia/packages/StaticArrays/NTbHj/src/convert.jl:29 [inlined]
   [12] overdub(::Cassette.Context{nametype(##258), SimpleMock.Metadata{false}, Nothing, Cassette.var"##PassType#259", Nothing, Nothing}, ::typeof(convert), ::Type{StaticArrays.SVector{2, Float64}}, ::Vector{Float64})
      @ Cassette ~/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
   [13] overdub
      @ ./Base.jl:34 [inlined]
   [14] overdub(::Cassette.Context{nametype(##258), SimpleMock.Metadata{false}, Nothing, Cassette.var"##PassType#259", Nothing, Nothing}, ::typeof(setproperty!), ::Trixi.ParallelTree{2}, ::Symbol, ::Vector{Float64})
      @ Cassette ~/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
   [15] overdub
      @ ~/work/Trixi.jl/Trixi.jl/src/mesh/parallel_tree.jl:92 [inlined]
   [16] overdub(::Cassette.Context{nametype(##258), SimpleMock.Metadata{false}, Nothing, Cassette.var"##PassType#259", Nothing, Nothing}, ::typeof(Trixi.init!), ::Trixi.ParallelTree{2}, ::Vector{Float64}, ::Float64, ::Bool)
      @ Cassette ~/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
   [17] overdub
      @ ~/work/Trixi.jl/Trixi.jl/src/mesh/parallel_tree.jl:78 [inlined]
   [18] overdub
      @ ~/work/Trixi.jl/Trixi.jl/src/mesh/mesh.jl:41 [inlined]
   [19] overdub(::Cassette.Context{nametype(##258), SimpleMock.Metadata{false}, Nothing, Cassette.var"##PassType#259", Nothing, Nothing}, ::Type{Trixi.TreeMesh{2, Trixi.ParallelTree{2}}}, ::Int64, ::Vector{Float64}, ::Float64, ::Bool)
      @ Cassette ~/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
   [20] overdub
      @ ~/work/Trixi.jl/Trixi.jl/src/mesh/mesh.jl:74 [inlined]
   [21] overdub(::Cassette.Context{nametype(##258), SimpleMock.Metadata{false}, Nothing, Cassette.var"##PassType#259", Nothing, Nothing}, ::Type{Trixi.TreeMesh{2, Trixi.ParallelTree{2}}}, ::Int64, ::Tuple{Float64, Float64}, ::Int64, ::Bool)
      @ Cassette ~/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
   [22] overdub
      @ ~/work/Trixi.jl/Trixi.jl/src/mesh/mesh.jl:74 [inlined]
   [23] overdub
      @ ~/work/Trixi.jl/Trixi.jl/test/test_unit.jl:67 [inlined]
   [24] overdub(::Cassette.Context{nametype(##258), SimpleMock.Metadata{false}, Nothing, Cassette.var"##PassType#259", Nothing, Nothing}, ::Main.TestUnit.var"#7#37", ::Main.TestUnit.var"#8#38")
      @ Cassette ~/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
   [25] invokelatest(::Any, ::Any, ::Vararg{Any, N} where N; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
      @ Base ./essentials.jl:707
   [26] invokelatest(::Any, ::Any, ::Vararg{Any, N} where N)
      @ Base ./essentials.jl:706
   [27] mock(f::Function, ctx::Symbol, args::Pair{typeof(Trixi.mpi_nranks), Main.TestUnit.var"#8#38"}; filters::Vector{Function})
      @ SimpleMock ~/.julia/packages/SimpleMock/zgRuh/src/mock_fun.jl:140
   [28] #mock#35
      @ ~/.julia/packages/SimpleMock/zgRuh/src/mock_fun.jl:113 [inlined]
   [29] mock(f::Function, args::Pair{typeof(Trixi.mpi_nranks), Main.TestUnit.var"#8#38"})
      @ SimpleMock ~/.julia/packages/SimpleMock/zgRuh/src/mock_fun.jl:113
   [30] macro expansion
      @ ~/work/Trixi.jl/Trixi.jl/test/test_unit.jl:66 [inlined]
   [31] macro expansion
      @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
   [32] macro expansion
      @ ~/work/Trixi.jl/Trixi.jl/test/test_unit.jl:66 [inlined]
   [33] macro expansion
      @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
   [34] macro expansion
      @ ~/work/Trixi.jl/Trixi.jl/test/test_unit.jl:65 [inlined]
   [35] macro expansion
      @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
   [36] macro expansion
      @ ~/work/Trixi.jl/Trixi.jl/test/test_unit.jl:64 [inlined]
   [37] macro expansion
      @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
   [38] top-level scope
      @ ~/work/Trixi.jl/Trixi.jl/test/test_unit.jl:14
   [39] include(fname::String)
      @ Base.MainInclude ./client.jl:444
   [40] macro expansion
      @ ~/work/Trixi.jl/Trixi.jl/test/runtests.jl:44 [inlined]
   [41] macro expansion
      @ timing.jl:206 [inlined]
   [42] macro expansion
      @ ~/work/Trixi.jl/Trixi.jl/test/runtests.jl:43 [inlined]
   [43] macro expansion
      @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
   [44] macro expansion
      @ ~/work/Trixi.jl/Trixi.jl/test/runtests.jl:11 [inlined]
   [45] top-level scope
      @ timing.jl:206
   [46] include(fname::String)
      @ Base.MainInclude ./client.jl:444
   [47] top-level scope
      @ none:6
   [48] eval(m::Module, e::Any)
      @ Core ./boot.jl:360
   [49] exec_options(opts::Base.JLOptions)
      @ Base ./client.jl:261
   [50] _start()
      @ Base ./client.jl:485
Internal error: encountered unexpected error in runtime:
TypeError(func=:TypeVar, context="upper bound", expected=Type, got=Vararg{Any, N} where N)
jl_type_error_rt at /buildworker/worker/package_linux64/build/src/rtutils.c:119
jl_new_typevar at /buildworker/worker/package_linux64/build/src/builtins.c:1125
TypeVar at ./boot.jl:382
apply_type_tfunc at ./compiler/tfuncs.jl:1231
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2238 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2420
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1703 [inlined]
do_apply at /buildworker/worker/package_linux64/build/src/builtins.c:672
builtin_tfunction at ./compiler/tfuncs.jl:1488
abstract_call_builtin at ./compiler/abstractinterpretation.jl:827
jfptr_abstract_call_builtin_8526.clone_1 at /opt/hostedtoolcache/julia/1.6.0-rc1/x64/lib/julia/sys.so (unknown line)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2238 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2420
abstract_call_known at ./compiler/abstractinterpretation.jl:958
abstract_call at ./compiler/abstractinterpretation.jl:1060
abstract_call at ./compiler/abstractinterpretation.jl:1044
abstract_eval_statement at ./compiler/abstractinterpretation.jl:1171
typeinf_local at ./compiler/abstractinterpretation.jl:1449
typeinf_nocycle at ./compiler/abstractinterpretation.jl:1507
_typeinf at ./compiler/typeinfer.jl:214
typeinf at ./compiler/typeinfer.jl:209
typeinf_edge at ./compiler/typeinfer.jl:806
abstract_call_method at ./compiler/abstractinterpretation.jl:490
abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:143
abstract_call_known at ./compiler/abstractinterpretation.jl:1037
abstract_call at ./compiler/abstractinterpretation.jl:1060
abstract_apply at ./compiler/abstractinterpretation.jl:739
abstract_call_known at ./compiler/abstractinterpretation.jl:956
abstract_call at ./compiler/abstractinterpretation.jl:1060
abstract_call at ./compiler/abstractinterpretation.jl:1044
abstract_eval_statement at ./compiler/abstractinterpretation.jl:1171
typeinf_local at ./compiler/abstractinterpretation.jl:1449
typeinf_nocycle at ./compiler/abstractinterpretation.jl:1507
_typeinf at ./compiler/typeinfer.jl:214
typeinf at ./compiler/typeinfer.jl:209
typeinf_edge at ./compiler/typeinfer.jl:806
abstract_call_method at ./compiler/abstractinterpretation.jl:490
abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:143
abstract_call_known at ./compiler/abstractinterpretation.jl:1037
abstract_call at ./compiler/abstractinterpretation.jl:1060
abstract_apply at ./compiler/abstractinterpretation.jl:739
abstract_call_known at ./compiler/abstractinterpretation.jl:956
abstract_call at ./compiler/abstractinterpretation.jl:1060
abstract_call at ./compiler/abstractinterpretation.jl:1044
abstract_eval_statement at ./compiler/abstractinterpretation.jl:1171
typeinf_local at ./compiler/abstractinterpretation.jl:1449
typeinf_nocycle at ./compiler/abstractinterpretation.jl:1507
_typeinf at ./compiler/typeinfer.jl:214
typeinf at ./compiler/typeinfer.jl:209
typeinf_ext at ./compiler/typeinfer.jl:892
typeinf_ext_toplevel at ./compiler/typeinfer.jl:925
typeinf_ext_toplevel at ./compiler/typeinfer.jl:921
jfptr_typeinf_ext_toplevel_14033.clone_1 at /opt/hostedtoolcache/julia/1.6.0-rc1/x64/lib/julia/sys.so (unknown line)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2238 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2420
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1703 [inlined]
jl_type_infer at /buildworker/worker/package_linux64/build/src/gf.c:298
jl_generate_fptr at /buildworker/worker/package_linux64/build/src/jitlayers.cpp:340
jl_compile_method_internal at /buildworker/worker/package_linux64/build/src/gf.c:1971
jl_compile_method_internal at /buildworker/worker/package_linux64/build/src/gf.c:2237 [inlined]
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2230 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2420
overdub at /home/runner/.julia/packages/StaticArrays/NTbHj/src/traits.jl:61 [inlined]
overdub at /home/runner/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
unknown function (ip: 0x7fa48d3e6141)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2238 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2420
overdub at /home/runner/.julia/packages/StaticArrays/NTbHj/src/traits.jl:67 [inlined]
overdub at /home/runner/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
overdub at /home/runner/.julia/packages/StaticArrays/NTbHj/src/traits.jl:89 [inlined]
overdub at /home/runner/.julia/packages/StaticArrays/NTbHj/src/abstractarray.jl:2 [inlined]
overdub at /home/runner/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
overdub at /home/runner/.julia/packages/StaticArrays/NTbHj/src/convert.jl:29 [inlined]
overdub at /home/runner/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
unknown function (ip: 0x7fa48d3e5ab5)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2238 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2420
overdub at ./Base.jl:34 [inlined]
overdub at /home/runner/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
overdub at /home/runner/work/Trixi.jl/Trixi.jl/src/mesh/parallel_tree.jl:92 [inlined]
overdub at /home/runner/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
overdub at /home/runner/work/Trixi.jl/Trixi.jl/src/mesh/parallel_tree.jl:78 [inlined]
overdub at /home/runner/work/Trixi.jl/Trixi.jl/src/mesh/mesh.jl:41 [inlined]
overdub at /home/runner/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
unknown function (ip: 0x7fa48d3d0aaf)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2238 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2420
overdub at /home/runner/work/Trixi.jl/Trixi.jl/src/mesh/mesh.jl:74 [inlined]
overdub at /home/runner/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
overdub at /home/runner/work/Trixi.jl/Trixi.jl/src/mesh/mesh.jl:74 [inlined]
overdub at /home/runner/work/Trixi.jl/Trixi.jl/test/test_unit.jl:91 [inlined]
overdub at /home/runner/.julia/packages/Cassette/Wjztv/src/overdub.jl:0
unknown function (ip: 0x7fa4cdb003b1)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2238 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2420
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1703 [inlined]
do_apply at /buildworker/worker/package_linux64/build/src/builtins.c:672
jl_f__apply_latest at /buildworker/worker/package_linux64/build/src/builtins.c:722
#invokelatest#2 at ./essentials.jl:707
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2238 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2420
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1703 [inlined]
do_apply at /buildworker/worker/package_linux64/build/src/builtins.c:672
invokelatest at ./essentials.jl:706
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2238 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2420
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1703 [inlined]
do_apply at /buildworker/worker/package_linux64/build/src/builtins.c:672
#mock#36 at /home/runner/.julia/packages/SimpleMock/zgRuh/src/mock_fun.jl:140
mock##kw at /home/runner/.julia/packages/SimpleMock/zgRuh/src/mock_fun.jl:117 [inlined]
#mock#35 at /home/runner/.julia/packages/SimpleMock/zgRuh/src/mock_fun.jl:113 [inlined]
mock at /home/runner/.julia/packages/SimpleMock/zgRuh/src/mock_fun.jl:113
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2238 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2420
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1703 [inlined]
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:115
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:204
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:155 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:561
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:489
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:489
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:489
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:489
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:489
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:489
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:489
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:489
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:669
macro expansion at /home/runner/work/Trixi.jl/Trixi.jl/test/test_unit.jl:90 [inlined]
macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
macro expansion at /home/runner/work/Trixi.jl/Trixi.jl/test/test_unit.jl:90 [inlined]
macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
macro expansion at /home/runner/work/Trixi.jl/Trixi.jl/test/test_unit.jl:65 [inlined]
macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
macro expansion at /home/runner/work/Trixi.jl/Trixi.jl/test/test_unit.jl:64 [inlined]
macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
top-level scope at /home/runner/work/Trixi.jl/Trixi.jl/test/test_unit.jl:14
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:879
jl_eval_module_expr at /buildworker/worker/package_linux64/build/src/toplevel.c:197 [inlined]
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:670
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:827
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/toplevel.c:931
eval at ./boot.jl:360 [inlined]
include_string at ./loading.jl:1090
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2238 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2420
_include at ./loading.jl:1144
include at ./client.jl:444
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2238 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2420
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1703 [inlined]
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:115
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:204
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:155 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:561
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:489
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:489
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:669
macro expansion at /home/runner/work/Trixi.jl/Trixi.jl/test/runtests.jl:44 [inlined]
macro expansion at timing.jl:206 [inlined]
macro expansion at /home/runner/work/Trixi.jl/Trixi.jl/test/runtests.jl:43 [inlined]
macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
macro expansion at /home/runner/work/Trixi.jl/Trixi.jl/test/runtests.jl:11 [inlined]
top-level scope at timing.jl:206
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:879
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:827
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/toplevel.c:931
eval at ./boot.jl:360 [inlined]
include_string at ./loading.jl:1090
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2238 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2420
_include at ./loading.jl:1144
include at ./client.jl:444
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2238 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2420
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1703 [inlined]
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:115
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:204
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:155 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:561
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:669
top-level scope at none:6
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:879
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:827
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/toplevel.c:931
eval at ./boot.jl:360
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2238 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2420
exec_options at ./client.jl:261
_start at ./client.jl:485
jfptr__start_50107.clone_1 at /opt/hostedtoolcache/julia/1.6.0-rc1/x64/lib/julia/sys.so (unknown line)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2238 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2420
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1703 [inlined]
true_main at /buildworker/worker/package_linux64/build/src/jlapi.c:557
repl_entrypoint at /buildworker/worker/package_linux64/build/src/jlapi.c:699
main at /buildworker/worker/package_linux64/build/cli/loader_exe.c:51
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
_start at /opt/hostedtoolcache/julia/1.6.0-rc1/x64/bin/julia (unknown line)

@christopher-dG
Copy link
Member

Yeah, I noticed this on the beta. Was hoping an RC would fix it, but apparently not. As you've also inferred, I think this is on Cassette's end.

@christopher-dG christopher-dG changed the title broken in nightly version Broken in 1.6+ Mar 23, 2021
@christopher-dG
Copy link
Member

Still seeing errors in 1.6 RC3, unfortunately. I haven't really had time to dig into debugging.

@christopher-dG christopher-dG pinned this issue Mar 23, 2021
@mofii
Copy link

mofii commented Apr 9, 2021

Oh this is what's up! I was about to ask what I was missing since I couldn't even get the examples from the documentation to work:

julia> using SimpleMock
julia> f(x) = x + 1
julia> mock(+) do plus
           @assert plus isa Mock
           @assert f(0) != 1  # The call to + is mocked.
           @assert called_once_with(plus, 0, 1)
       end
ERROR: type TypeofVararg has no field name
Stacktrace:
  [1] getproperty(x::Core.TypeofVararg, f::Symbol)
    @ Base ./Base.jl:33
  [2] (::SimpleMock.var"#43#45"{Vector{Any}, Vector{Expr}})(T::Core.TypeofVararg)
    @ SimpleMock ~/.julia/packages/SimpleMock/zgRuh/src/mock_fun.jl:187
  [3] foreach
    @ ./abstractarray.jl:2146 [inlined]
  [4] make_overdub(#unused#::Type{Cassette.Context{SimpleMock.var"####279#Name", M, T, P, B, H} where {M, T<:Union{Nothing, Cassette.Tag}, P<:Cassette.AbstractPass, B<:Union{Nothing, IdDict{Module, Dict{Symbol, Cassette.BindingMeta}}}, H<:Union{Cassette.DisableHooks, Nothing}}}, f::typeof(+), sig::Tuple{Core.TypeofVararg})
    @ SimpleMock ~/.julia/packages/SimpleMock/zgRuh/src/mock_fun.jl:183
  [5] (::SimpleMock.var"#37#38"{UnionAll, Bool})(k::Tuple{typeof(+), Core.TypeofVararg})
    @ SimpleMock ~/.julia/packages/SimpleMock/zgRuh/src/mock_fun.jl:131
  [6] foreach(f::SimpleMock.var"#37#38"{UnionAll, Bool}, itr::Tuple{Tuple{typeof(+), Core.TypeofVararg}})
    @ Base ./abstractarray.jl:2146
  [7] mock(f::Function, ctx::Symbol, args::Function; filters::Vector{Function})
    @ SimpleMock ~/.julia/packages/SimpleMock/zgRuh/src/mock_fun.jl:127
  [8] #mock#35
    @ ~/.julia/packages/SimpleMock/zgRuh/src/mock_fun.jl:113 [inlined]
  [9] mock(f::Function, args::Function)
    @ SimpleMock ~/.julia/packages/SimpleMock/zgRuh/src/mock_fun.jl:113
 [10] top-level scope
    @ REPL[47]:1

I would love to use SimpleMock to write unit tests for TcpInstruments.

@christopher-dG without knowing anything about how Cassette works, is there anything I can do to help debug this?

@christopher-dG
Copy link
Member

Unfortunately an example that uses SimpleMock is not super useful to the Cassette devs, so we need to try to find an example with just Cassette. If you've got time to kill and want to go try learning about the internals of this package and Cassette to do so, feel free!

But actually, a new direction involving @femtomc's Mixtape.jl instead of Cassette is looking quite promising so if that pans out it'll solve this issue.

@femtomc
Copy link

femtomc commented Apr 9, 2021

Re -- https://github.com/femtomc/Mixtape.jl. Yes, promising ... but there are drawbacks, including instability of internal APIs to AbstractInterpreter. Not super likely, but possible. See the README for a bit more about restrictions.

I also discovered that if you do method overlay using Mixtape.jl -- for some reason you lose stacktraces right now (so errors will be "bare" errors). I'm trying to figure this out -- it may be easy or hard, I'm not sure yet.

@mmiller-max mmiller-max unpinned this issue Sep 25, 2021
@leferrad
Copy link

What is the status of this issue? What is needed to have at least a partial solution to make CI work? I'm not familiarized with the code, but I can inspect to see if there is a possible workaround for this.

Looking at CI logs, what I see is that the only test that fails is the one for "Multiple mock", and in particular the problem occurs in the call to invokelatest() for overdub.

@leferrad
Copy link

If I change a little bit the test that is failing as it follows then it does pass:

@testset "Multiple mocks 2" begin
    mock((*) => Mock((a, b) -> a + b), (/) => Mock((a, b) -> a + b)) do mul, div
        @test 1 * 1 != 1
        @test 1 / 1 != 1
        @test called_once_with(mul, 1, 1)
        @test called_once_with(div, 1, 1)
    end
end

When the Mocks implemented are just Mock() instances then I got this error: caused by: TypeError: in Vararg, in count, expected Int64, got Type{Any}, which I suspect it is related to the type inference on the mock behavior.

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

6 participants