diff --git a/Project.toml b/Project.toml index 78acb2566..06cba77ab 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "DynamicPPL" uuid = "366bfd00-2699-11ea-058f-f148b4cae6d8" -version = "0.28" +version = "0.28.1" [deps] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" diff --git a/src/debug_utils.jl b/src/debug_utils.jl index dd7f3d10c..a614508bf 100644 --- a/src/debug_utils.jl +++ b/src/debug_utils.jl @@ -286,11 +286,19 @@ function record_varname!(context::DebugContext, varname::VarName, dist) end # tilde +_isassigned(x::AbstractArray, i) = isassigned(x, i) +# HACK(torfjelde): Julia v1.7 only supports `isassigned(::AbstractArray, ::Int...)`. +# TODO(torfjelde): Determine exactly in which version this change was introduced. +if VERSION < v"v1.9.0-alpha1" + _isassigned(x::AbstractArray, inds::Tuple) = isassigned(x, inds...) + _isassigned(x::AbstractArray, idx::CartesianIndex) = _isassigned(x, Tuple(idx)) +end + _has_missings(x) = ismissing(x) function _has_missings(x::AbstractArray) # Can't just use `any` because `x` might contain `undef`. for i in eachindex(x) - if isassigned(x, i) && _has_missings(x[i]) + if _isassigned(x, i) && _has_missings(x[i]) return true end end