Skip to content

Allow hashable ADTs to participate in variable dumps #16

Description

@uurl

Problem

TyId::hashable() currently excludes every ADT, even when all of its fields are recursively hashable and deterministically printable.

Generated ADTs derive Debug and optionally Copy and Clone, but they never derive Hash. Consequently, initialized ADT locals are never selected by insert_dump_var_gadget() for hash-based output.

Proposed change

  • Allow TyId::hashable() to accept ADTs that contain no floating-point or pointer types.
  • Add Hash to the generated derive attributes for ADTs that satisfy TyId::hashable().
  • Preserve the current exclusion of pointer-containing and floating-point-containing values.
  • Add tests covering primitive-field ADTs, nested ADTs, floating-point fields, and pointer fields.

Scope

This should not change:

  • The dumper function signature.
  • Memory or pointer semantics.
  • Type-generation weights.
  • ADT generation behavior.
  • The handling of floats or pointers.

Acceptance criteria

  • Hashable generated ADTs derive Hash.
  • Nested hashable ADTs derive Hash.
  • ADTs containing floats or pointers do not derive Hash.
  • Hashable initialized ADT locals can be selected by the existing dump-variable logic.
  • Existing workspace tests continue to pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions