Skip to content

Commit

Permalink
Replaced usage of typeof with Core.Typeof in eltype
Browse files Browse the repository at this point in the history
  • Loading branch information
torfjelde committed Jul 1, 2024
1 parent cd1f85e commit 28b8eae
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/abstract_varinfo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,8 @@ Determine the default `eltype` of the values returned by `vi[spl]`.
This method is considered legacy, and is likely to be deprecated in the future.
"""
function Base.eltype(vi::AbstractVarInfo, spl::Union{AbstractSampler,SampleFromPrior})
# TODO(torfjelde): Does this cause issues with Enzyme.jl?
# TODO(torfjelde): Is there _any_ scenario where this isn't just `typeof(getlogp(vi))`?
T = Base.promote_op(getindex, typeof(vi), typeof(spl))
T = Base.promote_op(getindex, Core.Typeof(vi), Core.Typeof(spl))
if T === Union{}
# In this case `getindex(vi, spl)` errors
# Let us throw a more descriptive error message
Expand Down

0 comments on commit 28b8eae

Please sign in to comment.