Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
torfjelde and github-actions[bot] authored Nov 1, 2024
1 parent 0b7ba4b commit e66e6ae
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/context_implementations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,9 @@ function dot_tilde_assume(context::PrefixContext, right, left, vn, vi)
return dot_tilde_assume(context.context, right, left, prefix.(Ref(context), vn), vi)
end

function dot_tilde_assume(rng::Random.AbstractRNG, context::PrefixContext, sampler, right, left, vn, vi)
function dot_tilde_assume(
rng::Random.AbstractRNG, context::PrefixContext, sampler, right, left, vn, vi
)
return dot_tilde_assume(
rng, context.context, sampler, right, left, prefix.(Ref(context), vn), vi
)
Expand Down Expand Up @@ -346,7 +348,6 @@ end
function dot_tilde_assume(
rng::Random.AbstractRNG, context::FixedContext, sampler, right, left, vns, vi
)

if !has_fixed_symbol(context, first(vns))
# Defer to `childcontext`.
return tilde_assume(rng, childcontext(context), sampler, right, left, vns, vi)
Expand Down
2 changes: 1 addition & 1 deletion src/contexts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ setchildcontext(parent::FixedContext, child) = FixedContext(parent.values, child
has_fixed_symbol(context::FixedContext, vn::VarName) = has_symbol(context.values, vn)

has_symbol(d::AbstractDict, vn::VarName) = haskey(d, vn)
@generated function has_symbol(::NamedTuple{names}, ::VarName{sym}) where {names, sym}
@generated function has_symbol(::NamedTuple{names}, ::VarName{sym}) where {names,sym}
return sym in names
end

Expand Down
2 changes: 1 addition & 1 deletion test/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ module Issue537 end
@testset "invalid .~ expressions" begin
@model function demo_with_invalid_dot_tilde()
m = Matrix{Float64}(undef, 1, 2)
m .~ [Normal(); Normal()]
return m .~ [Normal(); Normal()]
end

@test_throws ArgumentError demo_with_invalid_dot_tilde()()
Expand Down

0 comments on commit e66e6ae

Please sign in to comment.