File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -288,6 +288,33 @@ module Issue537 end
288
288
x = vdemo ()()
289
289
@test all ((isassigned (x, i) for i in eachindex (x)))
290
290
end
291
+
292
+ # A couple of uses of .~ that are no longer valid as of v0.35.
293
+ @testset " old .~ syntax" begin
294
+ @model function multivariate_dot_tilde ()
295
+ x = Vector {Float64} (undef, 2 )
296
+ x .~ MvNormal (zeros (2 ), I)
297
+ return x
298
+ end
299
+ expected_error = ArgumentError (
300
+ " the right-hand side of a `.~` must be a `UnivariateDistribution`"
301
+ )
302
+ @test_throws expected_error (multivariate_dot_tilde ()(); true )
303
+
304
+ @model function vector_dot_tilde ()
305
+ x = Vector {Float64} (undef, 2 )
306
+ x .~ [Normal (), Normal ()]
307
+ return x
308
+ end
309
+ expected_error = ArgumentError ("""
310
+ As of v0.35, DynamicPPL does not allow arrays of distributions in `.~`. \
311
+ Please use `product_distribution` instead, or write a loop if necessary. \
312
+ See https://github.com/TuringLang/DynamicPPL.jl/releases/tag/v0.35.0 for more \
313
+ details.\
314
+ """ )
315
+ @test_throws expected_error (vector_dot_tilde ()(); true )
316
+ end
317
+
291
318
@testset " nested model" begin
292
319
function makemodel (p)
293
320
@model function testmodel (x)
You can’t perform that action at this time.
0 commit comments