Skip to content

fix: Compile and lower comptime functions with fully qualified names - #2517

Merged
maximilianruesch merged 7 commits into
Quantinuum:mainfrom
manav4u:fix/comptime-qualified-names-2319
Nov 11, 2026
Merged

maximilianruesch merged 7 commits into
Quantinuum:mainfrom
manav4u:fix/comptime-qualified-names-2319

Conversation

@manav4u

@manav4u manav4u commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Fixes #2319.

Use the existing qualified function-name and monomorphization helpers when compiling comptime functions, matching ordinary Guppy functions. This replaces generated names such as __hugr__.panicking_func.7 in panic traces with stack_traces.comptime.panicking_func.

Keep type and constant instantiations distinct with the existing monomorphized-name format. Add four tests for qualified names, type and constant instantiations, and same-named functions in different scopes. Update the existing comptime panic-trace snapshot; source file and line metadata are unchanged.

Local validation on Linux / CPython 3.13.17:

  • All four new tests fail against unmodified main and pass with the candidate.
  • Focused tracing, metadata, stack-trace and side-effect ordering tests pass.
  • Broader suite, completed in separate groups with notebook tests excluded: 2,201 passed, 31 skipped, 13 xfailed, 8 failed. The same eight failures reproduce with the production files restored to unmodified main: one missing miette-py renderer dependency and seven forked dependency-decoupling tests exiting with status 3 in this environment.
  • Changed-file Ruff checks, Ruff formatting, focused mypy with silent imports / missing imports ignored, and git diff --check pass.

This is local validation, not a clean full-suite or remote-CI result. Notebook tests were not completed. Investigation, patch and tests were AI-assisted; independent human review is pending.

@manav4u
manav4u requested a review from a team as a code owner November 10, 2026 14:15
@manav4u
manav4u requested a review from tatiana-s November 10, 2026 14:15

@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.

Nice PR, just want to get the tests in the right place!

Comment thread tests/test_comptime_function_names.py Outdated

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.

There is no reason this needs to be a top level file, especially since this is doing some integration / end-to-end testing. Please move these tests to the existing tests.integration.test_link_name module. You should be able to reuse some functions (such as the function name extractor) from there.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moved the four comptime name tests into tests.integration.test_link_name, reused _func_names and the qualifier fixture, and removed the top-level file and its duplicate extractor. The production fix is unchanged. The 17 link-name tests pass, and the four moved regressions still fail without the production fix.

@maximilianruesch
maximilianruesch removed the request for review from tatiana-s November 10, 2026 20:22
@maximilianruesch maximilianruesch changed the title fix: use qualified names for comptime functions fix: Use qualified names for comptime functions Nov 10, 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.

🚀

Thanks for this!

@maximilianruesch
maximilianruesch added this pull request to the merge queue Nov 11, 2026
@maximilianruesch
maximilianruesch removed this pull request from the merge queue due to a manual request Nov 11, 2026
@maximilianruesch maximilianruesch changed the title fix: Use qualified names for comptime functions fix: Compile and lower comptime functions with fully qualified names Nov 11, 2026
@maximilianruesch
maximilianruesch added this pull request to the merge queue Nov 11, 2026
Merged via the queue into Quantinuum:main with commit fdf3c4a Nov 11, 2026
15 checks passed
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]: Comptime function names in debug traces

2 participants