Skip to content
Snippets Groups Projects
  • thorstenhater's avatar
    Fix ambiguous Region/Locset expressions (#1629) · 939cb91a
    thorstenhater authored
    - Add a set of test cases to check the behaviour
    - Remove the function `(nil)` from the the DSL
    - Remove `nil` and `()` as literals
    - Add functions `(region-nil)` and `(locset-nil)`
    
    Fixes an issue where `join` (and likely `intersect`) would not work due to the fact that
    `nil` values could not be coerced to `region` or `locset`. This occurred while loading 
    a NML files.
    
    While investigating it was found that certain calls, eg `(join () ())` are ambiguous and cannot
    be resolved without changes in no proportion to the gain. The cause here is that
    we can resolve `()` as region or a locset and at the same time `join` maps a list of
    locsets or regions to a locset or region, consequently `(join () ())` can be both.
    
    For future reference, in `label_parse.cpp::eval` we look for the first match in the `eval_map` 
    of a function name that can be successfully evaluated. However, this might not be the best match
    (and the ordering depends on the internals of `eval_map`).  We _could_ check all successful
    evaluations, but as eval is recursive, this idea has some obvious issues.
    939cb91a