Skip to content

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

Draft
maximilianruesch wants to merge 24 commits into
mainfrom
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 24 commits into
mainfrom
mr/fix/constant-folding-type-parameters

Conversation

@maximilianruesch

@maximilianruesch maximilianruesch commented May 19, 2026

Copy link
Copy Markdown
Collaborator

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

Base automatically changed from mr/chore/update-hugr-0.28 to main June 9, 2026 15:22
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

2 participants