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

@check failed with ERROR: LoadError: type UnionAll has no field parameters #54

Closed
MrVPlusOne opened this issue Sep 11, 2021 · 0 comments · Fixed by #56
Closed

@check failed with ERROR: LoadError: type UnionAll has no field parameters #54

MrVPlusOne opened this issue Sep 11, 2021 · 0 comments · Fixed by #56

Comments

@MrVPlusOne
Copy link

Hi,

I encountered the error when running the code below:

import Distributions: rand, logpdf

"""
Generalized distributions that support sampling (and evaluating the probability of) 
structured data. 
"""
abstract type GDistr end

@trait GDistr prefix Is, IsNot
@implement Is{GDistr} by rand(rng::AbstractRNG, _)
@implement Is{GDistr} by logpdf(_, x)

@assign Distribution with Is{GDistr}
@check Distribution

Is this the expected behavior? Or am I doing something wrong? (My Julia version is 1.7)

The stack trace:

ERROR: LoadError: type UnionAll has no field parameters
Stacktrace:
 [1] getproperty
   @ ./Base.jl:37 [inlined]
 [2] check_method(m::Method, sig::Type{Tuple{typeof(Distributions.logpdf), Distributions.Distribution, Union{}}}, kwnames::Tuple{})
   @ BinaryTraits ~/.julia/packages/BinaryTraits/58m13/src/interface.jl:256
 [3] has_method(f::Any, t::Any, kwnames::Tuple{})
   @ BinaryTraits ~/.julia/packages/BinaryTraits/58m13/src/interface.jl:244
 [4] check(m::Module, T::UnionAll)
   @ BinaryTraits ~/.julia/packages/BinaryTraits/58m13/src/interface.jl:56
 [5] top-level scope
   @ ~/.julia/dev/SEDL/src/distributions_utils.jl:17
tk3369 added a commit that referenced this issue Nov 24, 2021
The custom logic was originally developed to address a Bottom type issue with julialang (JuliaLang/julia#30808). However, the custom logic does not work properly for UnionAll signatures as seen from #54.

It appears that the original Julia hasmethod issue has been resolved. See my latest comment in that issue. So, I'm removing the custom logic here. All tests pass.
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

Successfully merging a pull request may close this issue.

1 participant