Skip to content

Commit fe32d94

Browse files
Add AbstractRNG types to fix method ambiguities in Turing (#636)
* Add AbstractRNG types to fix method ambiguities in Turing * Format code Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Add one more annotation --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 142f753 commit fe32d94

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/context_implementations.jl

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,17 @@ function tilde_assume(::IsParent, context::AbstractContext, args...)
6363
return tilde_assume(childcontext(context), args...)
6464
end
6565

66-
function tilde_assume(rng, context::AbstractContext, args...)
66+
function tilde_assume(rng::Random.AbstractRNG, context::AbstractContext, args...)
6767
return tilde_assume(NodeTrait(tilde_assume, context), rng, context, args...)
6868
end
69-
function tilde_assume(::IsLeaf, rng, context::AbstractContext, sampler, right, vn, vi)
69+
function tilde_assume(
70+
::IsLeaf, rng::Random.AbstractRNG, context::AbstractContext, sampler, right, vn, vi
71+
)
7072
return assume(rng, sampler, right, vn, vi)
7173
end
72-
function tilde_assume(::IsParent, rng, context::AbstractContext, args...)
74+
function tilde_assume(
75+
::IsParent, rng::Random.AbstractRNG, context::AbstractContext, args...
76+
)
7377
return tilde_assume(rng, childcontext(context), args...)
7478
end
7579

@@ -121,7 +125,9 @@ end
121125
function tilde_assume(context::PrefixContext, right, vn, vi)
122126
return tilde_assume(context.context, right, prefix(context, vn), vi)
123127
end
124-
function tilde_assume(rng, context::PrefixContext, sampler, right, vn, vi)
128+
function tilde_assume(
129+
rng::Random.AbstractRNG, context::PrefixContext, sampler, right, vn, vi
130+
)
125131
return tilde_assume(rng, context.context, sampler, right, prefix(context, vn), vi)
126132
end
127133

@@ -291,7 +297,7 @@ end
291297
function dot_tilde_assume(context::AbstractContext, args...)
292298
return dot_tilde_assume(NodeTrait(dot_tilde_assume, context), context, args...)
293299
end
294-
function dot_tilde_assume(rng, context::AbstractContext, args...)
300+
function dot_tilde_assume(rng::Random.AbstractRNG, context::AbstractContext, args...)
295301
return dot_tilde_assume(NodeTrait(dot_tilde_assume, context), rng, context, args...)
296302
end
297303

@@ -309,7 +315,9 @@ function dot_tilde_assume(::IsParent, rng, context::AbstractContext, args...)
309315
return dot_tilde_assume(rng, childcontext(context), args...)
310316
end
311317

312-
function dot_tilde_assume(rng, ::DefaultContext, sampler, right, left, vns, vi)
318+
function dot_tilde_assume(
319+
rng::Random.AbstractRNG, ::DefaultContext, sampler, right, left, vns, vi
320+
)
313321
return dot_assume(rng, sampler, right, vns, left, vi)
314322
end
315323

0 commit comments

Comments
 (0)