@@ -58,16 +58,17 @@ DynamicTransformationContext{true}()
5858setchildcontext
5959
6060"""
61- leafcontext(context)
61+ leafcontext(context::AbstractContext )
6262
6363Return the leaf of `context`, i.e. the first descendant context that `IsLeaf`.
6464"""
65- leafcontext (context) = leafcontext (NodeTrait (leafcontext, context), context)
66- leafcontext (:: IsLeaf , context) = context
67- leafcontext (:: IsParent , context) = leafcontext (childcontext (context))
65+ leafcontext (context:: AbstractContext ) =
66+ leafcontext (NodeTrait (leafcontext, context), context)
67+ leafcontext (:: IsLeaf , context:: AbstractContext ) = context
68+ leafcontext (:: IsParent , context:: AbstractContext ) = leafcontext (childcontext (context))
6869
6970"""
70- setleafcontext(left, right)
71+ setleafcontext(left::AbstractContext , right::AbstractContext )
7172
7273Return `left` but now with its leaf context replaced by `right`.
7374
@@ -103,19 +104,21 @@ julia> # Append another parent context.
103104ParentContext(ParentContext(ParentContext(DefaultContext())))
104105```
105106"""
106- function setleafcontext (left, right)
107+ function setleafcontext (left:: AbstractContext , right:: AbstractContext )
107108 return setleafcontext (
108109 NodeTrait (setleafcontext, left), NodeTrait (setleafcontext, right), left, right
109110 )
110111end
111- function setleafcontext (:: IsParent , :: IsParent , left, right)
112+ function setleafcontext (
113+ :: IsParent , :: IsParent , left:: AbstractContext , right:: AbstractContext
114+ )
112115 return setchildcontext (left, setleafcontext (childcontext (left), right))
113116end
114- function setleafcontext (:: IsParent , :: IsLeaf , left, right)
117+ function setleafcontext (:: IsParent , :: IsLeaf , left:: AbstractContext , right:: AbstractContext )
115118 return setchildcontext (left, setleafcontext (childcontext (left), right))
116119end
117- setleafcontext (:: IsLeaf , :: IsParent , left, right) = right
118- setleafcontext (:: IsLeaf , :: IsLeaf , left, right) = right
120+ setleafcontext (:: IsLeaf , :: IsParent , left:: AbstractContext , right:: AbstractContext ) = right
121+ setleafcontext (:: IsLeaf , :: IsLeaf , left:: AbstractContext , right:: AbstractContext ) = right
119122
120123"""
121124 DynamicPPL.tilde_assume!!(
0 commit comments