JuliaLabs / Cassette.jl

Overdub Your Julia Code
Other
371 stars 35 forks source link

implement splatnew #125

Closed vchuravy closed 5 years ago

vchuravy commented 5 years ago

https://github.com/JuliaLang/julia/pull/30577 introduced Expr(:splatnew), causing #124

This is nearly there, except that I haven't figured out what I need to do for metametadata..., @jrevels maybe we also want to unify the implementation of tagged_new and tagged_splatnew

 Error During Test at /home/vchuravy/src/Cassette/test/misctaggingtests.jl:264
  Test threw exception
  Expression: overdub(ctx, (_y->begin
                kwargtest(3; y=_y)
            end), tag(2, ctx)) === 5
  MethodError: Cannot `convert` an object of type Tuple{Cassette.Immutable{Cassette.Meta{Cassette.NoMetaData,Cassette.NoMetaMeta}}} to an object of type Cassette.NoMetaMeta
  Closest candidates are:
    convert(::Type{T}, !Matched::T) where T at essentials.jl:167
  Stacktrace:
   [1] _metametaconvert(::Type, ::Tuple{Cassette.Immutable{Cassette.Meta{Cassette.NoMetaData,Cassette.NoMetaMeta}}}) at /home/vchuravy/src/Cassette/src/tagging.jl:39
   [2] convert at /home/vchuravy/src/Cassette/src/tagging.jl:56 [inlined]
   [3] macro expansion at /home/vchuravy/src/Cassette/src/tagging.jl:521 [inlined]
   [4] tagged_splatnew(::Cassette.Context{nametype(KwargCtx),Nothing,Cassette.Tag{nametype(KwargCtx),0xfddc2783aa6f0228,Nothing},getfield(Cassette, Symbol("##PassType#375")),IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Nothing}, ::Type{NamedTuple{(:y,),Tuple{Int64}}}, ::Tagged{Cassette.Tag{nametype(KwargCtx),0xfddc2783aa6f0228,Nothing},Tuple{Int64},Cassette.NoMetaData,Tuple{Cassette.Immutable{Cassette.Meta{Cassette.NoMetaData,Cassette.NoMetaMeta}}},Cassette.Context{nametype(KwargCtx),Nothing,Cassette.Tag{nametype(KwargCtx),0xfddc2783aa6f0228,Nothing},getfield(Cassette, Symbol("##PassType#375")),IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Nothing}}) at /home/vchuravy/src/Cassette/src/tagging.jl:497
   [5] overdub(::Cassette.Context{nametype(KwargCtx),Nothing,Cassette.Tag{nametype(KwargCtx),0xfddc2783aa6f0228,Nothing},getfield(Cassette, Symbol("##PassType#375")),IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Nothing}, ::Type{NamedTuple{(:y,),Tuple{Int64}}}, ::Tagged{Cassette.Tag{nametype(KwargCtx),0xfddc2783aa6f0228,Nothing},Tuple{Int64},Cassette.NoMetaData,Tuple{Cassette.Immutable{Cassette.Meta{Cassette.NoMetaData,Cassette.NoMetaMeta}}},Cassette.Context{nametype(KwargCtx),Nothing,Cassette.Tag{nametype(KwargCtx),0xfddc2783aa6f0228,Nothing},getfield(Cassette, Symbol("##PassType#375")),IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Nothing}}) at ./boot.jl:553
   [6] overdub(::Cassette.Context{nametype(KwargCtx),Nothing,Cassette.Tag{nametype(KwargCtx),0xfddc2783aa6f0228,Nothing},getfield(Cassette, Symbol("##PassType#375")),IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Nothing}, ::Type{NamedTuple{(:y,),T} where T<:Tuple}, ::Tagged{Cassette.Tag{nametype(KwargCtx),0xfddc2783aa6f0228,Nothing},Tuple{Int64},Cassette.NoMetaData,Tuple{Cassette.Immutable{Cassette.Meta{Cassette.NoMetaData,Cassette.NoMetaMeta}}},Cassette.Context{nametype(KwargCtx),Nothing,Cassette.Tag{nametype(KwargCtx),0xfddc2783aa6f0228,Nothing},getfield(Cassette, Symbol("##PassType#375")),IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Nothing}}) at ./boot.jl:549
   [7] #145 at ./none:0 [inlined]
   [8] overdub(::Cassette.Context{nametype(KwargCtx),Nothing,Cassette.Tag{nametype(KwargCtx),0xfddc2783aa6f0228,Nothing},getfield(Cassette, Symbol("##PassType#375")),IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Nothing}, ::getfield(Main, Symbol("##145#146")), ::Tagged{Cassette.Tag{nametype(KwargCtx),0xfddc2783aa6f0228,Nothing},Int64,Cassette.NoMetaData,Cassette.NoMetaMeta,Cassette.Context{nametype(KwargCtx),Nothing,Cassette.Tag{nametype(KwargCtx),0xfddc2783aa6f0228,Nothing},getfield(Cassette, Symbol("##PassType#375")),IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Nothing}}) at /home/vchuravy/src/Cassette/src/overdub.jl:0
   [9] top-level scope at /home/vchuravy/src/Cassette/test/misctaggingtests.jl:264
   [10] include at ./boot.jl:328 [inlined]
   [11] include_relative(::Module, ::String) at ./loading.jl:1094
   [12] include(::Module, ::String) at ./Base.jl:31
   [13] include(::String) at ./client.jl:431
   [14] top-level scope at /home/vchuravy/src/Cassette/test/runtests.jl:14
   [15] top-level scope at /home/vchuravy/builds/julia/usr/share/julia/stdlib/v1.3/Test/src/Test.jl:1113
   [16] top-level scope at /home/vchuravy/src/Cassette/test/runtests.jl:14
   [17] top-level scope at util.jl:156