Skip to content

_from_array impl for vector doesn't handle nested elements #515

@sritchie

Description

@sritchie

For example, we can fill a nested choicemap from an array:

julia> Gen._from_array(Gen.choicemap(:face => Gen.choicemap(:cake => 2), :foo => 3), [4, 5], 1)
(2, DynamicChoiceMap(Dict{Any, Any}(:face => DynamicChoiceMap(Dict{Any, Any}(:cake => 4), Dict{Any, Any}()), :foo => 5), Dict{Any, Any}()))

but the implementation of _from_array for vectors doesn't recursively call _from_array on its elements:

julia> Gen._from_array([1,2,[3]], [4,5,6], 1)
ERROR: MethodError: no method matching _from_array(::Vector{Any}, ::Vector{Int64}, ::Int64)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions