Skip to content

Commit 6b7b9f8

Browse files
committed
Fix tilde_observe!! prefixing
1 parent e324c9b commit 6b7b9f8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/context_implementations.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,14 @@ end
122122
# `PrefixContext`
123123
function tilde_observe!!(context::PrefixContext, right, left, vn, vi)
124124
# In the observe case, unlike assume, `vn` may be `nothing` if the LHS is a literal
125-
# value.
126-
prefixed_varname = vn !== nothing ? prefix(context, vn) : vn
127-
return tilde_observe!!(context.context, right, left, prefixed_varname, vi)
125+
# value. For the need for prefix_and_strip_contexts rather than just prefix, see the
126+
# comment in `tilde_assume!!`.
127+
new_vn, new_context = if vn !== nothing
128+
prefix_and_strip_contexts(context, vn)
129+
else
130+
vn, childcontext(context)
131+
end
132+
return tilde_observe!!(new_context, right, left, new_vn, vi)
128133
end
129134

130135
"""

0 commit comments

Comments
 (0)