SciML / SciMLBase.jl

The Base interface of the SciML ecosystem
https://docs.sciml.ai/SciMLBase/stable
MIT License
127 stars 92 forks source link

isinplace fails due to UnionAll has no field parameters #529

Closed oxinabox closed 9 months ago

oxinabox commented 9 months ago

I am running into an issue very similar to https://github.com/SciML/SciMLBase.jl/issues/268 I suspect the cause is very similar, though the packages involved are different. And I can't tell it manually because the particular case I am hitting is for jac which also has isinplace used on it, but which doesn't have a way to manually say it is inplace or not. It is due to methods(f).ms[1].sig.parameters) in https://github.com/SciML/SciMLBase.jl/blob/c8c3a162be5469be172e2def653945e2803b2b30/src/utils.jl#L280

Here is a MWE that doesn't use any of my internal code

julia> struct Foo{T}
       end

julia> (this::Foo{T})(args...) where T=1

julia> SciMLBase.isinplace(Foo{Int}(), 4)
ERROR: type UnionAll has no field parameters
Stacktrace:
 [1] getproperty
   @ ./Base.jl:32 [inlined]
 [2] isinplace(f::Foo{…}, inplace_param_number::Int64, fname::String, iip_preferred::Bool; has_two_dispatches::Bool, isoptimization::Bool)
   @ SciMLBase ~/.julia/packages/SciMLBase/tXu8A/src/utils.jl:260
 [3] isinplace
   @ SciMLBase ~/.julia/packages/SciMLBase/tXu8A/src/utils.jl:242 [inlined]
 [4] isinplace(f::Foo{Int64}, inplace_param_number::Int64)
   @ SciMLBase ~/.julia/packages/SciMLBase/tXu8A/src/utils.jl:242
 [5] top-level scope
   @ REPL[61]:1
Some type information was truncated. Use `show(err)` to see complete types.