Skip to content

Gen.set_submap! breaks for non-DynamicChoiceMap submaps #516

@sritchie

Description

@sritchie

This problem comes up because there is no interface method for setting values in a choice map. For example:

julia> cm = Gen.choicemap()


julia> Gen.set_submap!(cm, :k, Gen.DynamicDSLChoiceMap(Trie{Any,Gen.ChoiceOrCallRecord}()))


julia> cm
│
└── :k


julia> Gen.set_value!(cm, (:k => :k2), "cake")
ERROR: MethodError: no method matching set_value!(::Gen.DynamicDSLChoiceMap, ::Symbol, ::String)
Closest candidates are:
  set_value!(::DynamicChoiceMap, ::Any, ::Any) at ~/.julia/packages/Gen/ME5el/src/choice_map.jl:741
  set_value!(::DynamicChoiceMap, ::Pair, ::Any) at ~/.julia/packages/Gen/ME5el/src/choice_map.jl:746
Stacktrace:

A fix now would be to put a type on set_submap! so that new_node is only allowed to be a DynamicChoiceMap, or something that supports [] setting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions