Skip to content

fix: Ignore docstrings in guppy.unitary classes - #2514

Merged
maximilianruesch merged 3 commits into
Quantinuum:mainfrom
GBoydQ:gb/unitary_docstrings
Nov 11, 2026
Merged

maximilianruesch merged 3 commits into
Quantinuum:mainfrom
GBoydQ:gb/unitary_docstrings

Conversation

@GBoydQ

@GBoydQ GBoydQ commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Adds support for docstrings at the start of @guppy.unitary decorated classes

@GBoydQ
GBoydQ requested a review from a team as a code owner November 10, 2026 11:36
@GBoydQ
GBoydQ requested a review from qartik November 10, 2026 11:36
@qartik
qartik requested a balanced review from Copilot November 10, 2026 12:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the change adding leading-docstring support to unitary classes.

No open issues 🎉

What changed in this PR

Adds support for leading docstrings in @guppy.unitary classes while preserving existing method validation and rejecting other unsupported statements.

Changes:

  • Accepts a string expression as the first statement in a unitary class.
  • Adds an integration test compiling a documented unitary class used with the dagger modifier.
File Description
tests/​integration/​test_modifier.py Adds regression coverage for a unitary class with a docstring.
guppylang-internals/​src/​guppylang_internals/​checker/​unitary_checker.py Allows leading docstrings while retaining class-body validation.

Review effort: Balanced

@maximilianruesch maximilianruesch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imo this is more of a bugfix, since you are not doing anything with the docstrings (other than ignore them), and the test makes the whole change look more like a

fix: Ignore docstrings in guppy.unitary classes

Thoughts?

@GBoydQ GBoydQ changed the title feat: Support docstrings in guppy.unitary classes fix: Ignore docstrings in guppy.unitary classes Nov 11, 2026

@maximilianruesch maximilianruesch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@maximilianruesch
maximilianruesch added this pull request to the merge queue Nov 11, 2026
@maximilianruesch maximilianruesch added B-backport-nominated A PR (or an issue pending a PR) that is nominated for backporting to the previous minor series. B-backport-accepted A PR (or issue pending a PR) that has been accepted for backporting to the previous minor series. B-v1.2.X To be backported to the v1.2.X series labels Nov 11, 2026
Merged via the queue into Quantinuum:main with commit 698b9a4 Nov 11, 2026
22 checks passed
@maximilianruesch maximilianruesch added B-backport-accepted A PR (or issue pending a PR) that has been accepted for backporting to the previous minor series. and removed B-backport-accepted A PR (or issue pending a PR) that has been accepted for backporting to the previous minor series. labels Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-backport-accepted A PR (or issue pending a PR) that has been accepted for backporting to the previous minor series. B-backport-nominated A PR (or an issue pending a PR) that is nominated for backporting to the previous minor series. B-v1.2.X To be backported to the v1.2.X series

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants