Skip to content

Commit b87a50a

Browse files
committed
Fix anonymous argument with type parameter
1 parent f2eb635 commit b87a50a

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "DynamicPPL"
22
uuid = "366bfd00-2699-11ea-058f-f148b4cae6d8"
3-
version = "0.17.9"
3+
version = "0.17.10"
44

55
[deps]
66
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"

src/compiler.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ function build_model_info(input_expr)
262262
# Extract the names of the arguments.
263263
allargs_syms = map(allargs_exprs) do arg
264264
MacroTools.@match arg begin
265-
(::Type{T_}) | (name_::Type{T_}) => T
265+
(::S_{T_}) | (name_::Type{T_}) => T
266266
name_::T_ => name
267267
x_ => x
268268
end

test/compiler.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,4 +602,10 @@ end
602602
@test !DynamicPPL.hasmissing(Matrix{Real})
603603
@test !DynamicPPL.hasmissing(Vector{Matrix{Float32}})
604604
end
605+
606+
@testset "issue #393: anonymous argument with type parameter" begin
607+
@model f_393(::Val{ispredict}=Val(false)) where {ispredict} = ispredict ? 0 : 1
608+
@test f_393()() == 1
609+
@test f_393(Val(true))() == 0
610+
end
605611
end

0 commit comments

Comments
 (0)