From 20c0960ee060fc2833771b1eadc899237a38e437 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Fri, 13 Jun 2025 23:20:11 +0100 Subject: [PATCH] Prevent spurious error hints --- Project.toml | 2 +- src/AbstractMCMC.jl | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 77de870..eef2aaf 100644 --- a/Project.toml +++ b/Project.toml @@ -3,7 +3,7 @@ uuid = "80f14c24-f653-4e6a-9b94-39d6b0f70001" keywords = ["markov chain monte carlo", "probabilistic programming"] license = "MIT" desc = "A lightweight interface for common MCMC methods." -version = "5.6.2" +version = "5.6.3" [deps] BangBang = "198e06fe-97b7-11e9-32a5-e1d131e6ad66" diff --git a/src/AbstractMCMC.jl b/src/AbstractMCMC.jl index b7c35fb..8c1d561 100644 --- a/src/AbstractMCMC.jl +++ b/src/AbstractMCMC.jl @@ -123,8 +123,11 @@ include("logdensityproblems.jl") if isdefined(Base.Experimental, :register_error_hint) function __init__() Base.Experimental.register_error_hint(MethodError) do io, exc, argtypes, _ - if Base.parentmodule(exc.f) == LogDensityProblems && - any(a -> a <: LogDensityModel, argtypes) + if ( + any(a -> a <: LogDensityModel, argtypes) && + exc.f isa Function && + Base.parentmodule(exc.f) == LogDensityProblems + ) print( io, "\n`AbstractMCMC.LogDensityModel` is a wrapper and does not itself implement the LogDensityProblems.jl interface. To use LogDensityProblems.jl methods, access the inner type with (e.g.) `logdensity(model.logdensity, params)` instead of `logdensity(model, params)`.",