Skip to content

[record_use] Correctness: Support non-string map keys #2715

@dcharkes

Description

@dcharkes

The current JSON structure for package:record_use only supports string keys for MapConstant objects. The keys are serialized directly as strings, while the values are normalized as indices into the constants array. This limits the ability to represent const maps that use other constant types (e.g., int, bool, or other objects) as keys.

Current Format:

{
  "type": "map",
  "value": {
    "key1": 3 
  }
}

Proposed Format options:

{
  "type": "map",
  "value": {
    "1": 3,
    "2": 4
  }
}
{
  "type": "map",
  "value": [
    { "key": 1, "value": 3 },
    { "key": 2, "value": 4 },
  ]
}

Note that this does not allow for an efficient JSON view with #2681, so the map keys need to be eagerly looked up from the constants array on building the view.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions