File tree Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Original file line number Diff line number Diff line change 1
1
name = " DynamicPPL"
2
2
uuid = " 366bfd00-2699-11ea-058f-f148b4cae6d8"
3
- version = " 0.17.4 "
3
+ version = " 0.17.5 "
4
4
5
5
[deps ]
6
6
AbstractMCMC = " 80f14c24-f653-4e6a-9b94-39d6b0f70001"
Original file line number Diff line number Diff line change @@ -546,9 +546,10 @@ function make_returns_explicit!(body::Expr)
546
546
end
547
547
548
548
const FloatOrArrayType = Type{<: Union{AbstractFloat,AbstractArray} }
549
- hasmissing (T:: Type{<:AbstractArray{TA}} ) where {TA<: AbstractArray } = hasmissing (TA)
550
- hasmissing (T:: Type{<:AbstractArray{>:Missing}} ) = true
551
- hasmissing (T:: Type ) = false
549
+ hasmissing (:: Type ) = false
550
+ hasmissing (:: Type{>:Missing} ) = true
551
+ hasmissing (:: Type{<:AbstractArray{TA}} ) where {TA} = hasmissing (TA)
552
+ hasmissing (:: Type{Union{}} ) = false # issue #368
552
553
553
554
"""
554
555
build_output(modelinfo, linenumbernode)
Original file line number Diff line number Diff line change 588
588
@model outer () = @submodel x = inner ()
589
589
@test outer ()() isa Real
590
590
end
591
+
592
+ @testset " issue #368: hasmissing dispatch" begin
593
+ @test ! DynamicPPL. hasmissing (typeof (Union{}[]))
594
+
595
+ # (nested) arrays with `Missing` eltypes
596
+ @test DynamicPPL. hasmissing (Vector{Union{Missing,Float64}})
597
+ @test DynamicPPL. hasmissing (Matrix{Union{Missing,Real}})
598
+ @test DynamicPPL. hasmissing (Vector{Matrix{Union{Missing,Float32}}})
599
+
600
+ # no `Missing`
601
+ @test ! DynamicPPL. hasmissing (Vector{Float64})
602
+ @test ! DynamicPPL. hasmissing (Matrix{Real})
603
+ @test ! DynamicPPL. hasmissing (Vector{Matrix{Float32}})
604
+ end
591
605
end
You can’t perform that action at this time.
0 commit comments