Skip to content

fix: Support sum variants with sum types containing type variables in constant folding#1609

Draft
maximilianruesch wants to merge 2 commits into
mr/chore/update-hugr-0.28from
mr/fix/constant-folding-type-parameters
Draft

fix: Support sum variants with sum types containing type variables in constant folding#1609
maximilianruesch wants to merge 2 commits into
mr/chore/update-hugr-0.28from
mr/fix/constant-folding-type-parameters

Conversation

@maximilianruesch
Copy link
Copy Markdown
Collaborator

@maximilianruesch maximilianruesch commented May 19, 2026

Addresses constant folding support for sum variants where sum types contain type variables by:

  • Loading the value via LoadConstant if possible (i.e. if not parametrized)
  • Otherwise, loading the value via a Tag op if possible (i.e. if it is a sum variant)
    • To reduce the work done here, only sum variants with no child values are supported (others are skipped), so we do not have to recursively reconstruct the nodes required for the values.
  • Otherwise, doing nothing

Based on #1580

Closes #1536

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Invalid HUGR generation of arrays from constant_folding in NormalizeGuppy

1 participant