Skip to content

Add component attribute macro - #117

Open
robpatterson13 wants to merge 1 commit into
rob/dialect-macrofrom
rob/component-attr-macro
Open

robpatterson13 wants to merge 1 commit into
rob/dialect-macrofrom
rob/component-attr-macro

Conversation

@robpatterson13

Copy link
Copy Markdown
Collaborator

Adds a feature gated #[component] attribute (currently behind the component-attribute feature) for declaring which dialect instructions a struct handles. The #[instructions { ... }] list accepts named instructions, groups, and entire dialects, while keeping the struct and its existing fields intact.

The macro implements Component and checks that the struct has an Execute implementation for every selected instruction. It supports generic structs, dialect aliases, and qualified paths. With the feature enabled, Component no longer implies HasInstructionSet, so callers that need generated instruction types must add that bound explicitly.

The branch adds validation for duplicate or overlapping selections, unknown instructions, and missing Execute implementations, plus runtime and compile-fail tests.

This adds the initial addition of this macro, but we might need additions in the (near) future to allow for instructions from a component to be pulled into a composite that contains it (as part of the instruction flattening implementation). Additionally, once this is stabilized, we can remove the feature flag and the component! macro.

@robpatterson13
robpatterson13 added this pull request to stack #116 September 23, 2026 19:30
@robpatterson13
robpatterson13 force-pushed the rob/component-attr-macro branch from bf31f46 to 36097ff Compare September 23, 2026 19:35
@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://QuEraComputing.github.io/vihaco/pr-preview/pr-117/

Built to branch gh-pages at 2026-09-23 19:37 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@robpatterson13
robpatterson13 force-pushed the rob/component-attr-macro branch from 36097ff to d0cefd2 Compare September 23, 2026 19:36

This branch has not been deployed

No deployments
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.

1 participant