Skip to content

Commit 0c5eec2

Browse files
authored
Prevent spurious error hints (#164)
1 parent ececa17 commit 0c5eec2

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ uuid = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
33
keywords = ["markov chain monte carlo", "probabilistic programming"]
44
license = "MIT"
55
desc = "A lightweight interface for common MCMC methods."
6-
version = "5.6.2"
6+
version = "5.6.3"
77

88
[deps]
99
BangBang = "198e06fe-97b7-11e9-32a5-e1d131e6ad66"

src/AbstractMCMC.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,11 @@ include("logdensityproblems.jl")
123123
if isdefined(Base.Experimental, :register_error_hint)
124124
function __init__()
125125
Base.Experimental.register_error_hint(MethodError) do io, exc, argtypes, _
126-
if Base.parentmodule(exc.f) == LogDensityProblems &&
127-
any(a -> a <: LogDensityModel, argtypes)
126+
if (
127+
any(a -> a <: LogDensityModel, argtypes) &&
128+
exc.f isa Function &&
129+
Base.parentmodule(exc.f) == LogDensityProblems
130+
)
128131
print(
129132
io,
130133
"\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)`.",

0 commit comments

Comments
 (0)