Skip to content

Commit 6e37eff

Browse files
committed
Remove 3-argument evaluate!! as well
1 parent 9c648dc commit 6e37eff

File tree

2 files changed

+6
-47
lines changed

2 files changed

+6
-47
lines changed

src/model.jl

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -864,12 +864,6 @@ If multiple threads are available, the varinfo provided will be wrapped in a
864864
865865
Returns a tuple of the model's return value, plus the updated `varinfo`
866866
(unwrapped if necessary).
867-
868-
evaluate!!(model::Model, varinfo, context)
869-
870-
When an extra context stack is provided, the model's context is inserted into
871-
that context stack. See `combine_model_and_external_contexts`. This method is
872-
deprecated.
873867
"""
874868
function AbstractPPL.evaluate!!(model::Model, varinfo::AbstractVarInfo)
875869
return if use_threadsafe_eval(model.context, varinfo)
@@ -878,17 +872,6 @@ function AbstractPPL.evaluate!!(model::Model, varinfo::AbstractVarInfo)
878872
evaluate_threadunsafe!!(model, varinfo)
879873
end
880874
end
881-
function AbstractPPL.evaluate!!(
882-
model::Model, varinfo::AbstractVarInfo, context::AbstractContext
883-
)
884-
Base.depwarn(
885-
"The `context` argument to evaluate!!(model, varinfo, context) is deprecated.",
886-
:dynamicppl_evaluate_context,
887-
)
888-
new_ctx = combine_model_and_external_contexts(model.context, context)
889-
model = contextualize(model, new_ctx)
890-
return evaluate!!(model, varinfo)
891-
end
892875

893876
"""
894877
evaluate_threadunsafe!!(model, varinfo)
@@ -940,32 +923,6 @@ end
940923

941924
is_splat_symbol(s::Symbol) = startswith(string(s), "#splat#")
942925

943-
"""
944-
combine_model_and_external_contexts(model_context, external_context)
945-
946-
Combine a context from a model and an external context into a single context.
947-
948-
The resulting context stack has the following structure:
949-
950-
`external_context` -> `childcontext(external_context)` -> ... ->
951-
`model_context` -> `childcontext(model_context)` -> ... ->
952-
`leafcontext(external_context)`
953-
954-
The reason for this is that we want to give `external_context` precedence over
955-
`model_context`, while also preserving the leaf context of `external_context`.
956-
We can do this by
957-
958-
1. Set the leaf context of `model_context` to `leafcontext(external_context)`.
959-
2. Set leaf context of `external_context` to the context resulting from (1).
960-
"""
961-
function combine_model_and_external_contexts(
962-
model_context::AbstractContext, external_context::AbstractContext
963-
)
964-
return setleafcontext(
965-
external_context, setleafcontext(model_context, leafcontext(external_context))
966-
)
967-
end
968-
969926
"""
970927
make_evaluate_args_and_kwargs(model, varinfo)
971928

src/test_utils/contexts.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,12 @@ function test_context(context::DynamicPPL.AbstractContext, model::DynamicPPL.Mod
6363
# TODO(torfjelde): Make the `varinfo` used for testing a kwarg once it makes sense for other varinfos.
6464
# Untyped varinfo.
6565
varinfo_untyped = DynamicPPL.VarInfo()
66-
@test (DynamicPPL.evaluate!!(model, varinfo_untyped, SamplingContext(context)); true)
67-
@test (DynamicPPL.evaluate!!(model, varinfo_untyped, context); true)
66+
model_with_spl = contextualize(model, SamplingContext(context))
67+
model_without_spl = contextualize(model, context)
68+
@test DynamicPPL.evaluate!!(model_with_spl, varinfo_untyped) isa Any
69+
@test DynamicPPL.evaluate!!(model_without_spl, varinfo_untyped) isa Any
6870
# Typed varinfo.
6971
varinfo_typed = DynamicPPL.typed_varinfo(varinfo_untyped)
70-
@test (DynamicPPL.evaluate!!(model, varinfo_typed, SamplingContext(context)); true)
71-
@test (DynamicPPL.evaluate!!(model, varinfo_typed, context); true)
72+
@test DynamicPPL.evaluate!!(model_with_spl, varinfo_typed) isa Any
73+
@test DynamicPPL.evaluate!!(model_without_spl, varinfo_typed) isa Any
7274
end

0 commit comments

Comments
 (0)