Skip to content

♻️ Simplify OpenQASM gate and entry-point naming #2414

Description

@burgholzer

🤖 AI text below 🤖

Problem Statement

OpenQASM import normally names the generated entry function main. A custom gate may also be named main, so the importer renames the entry function to _mqt_entry and probes numbered suffixes against all custom gate names. This works, but spreads a source-name collision into the internal symbol policy and adds special-case code.

This follows up on the final review of #2338.

Proposed Solution

Define a simple internal naming contract that keeps the generated entry point distinct from source-level custom gate symbols. Preserve legal custom gate names, including main, across import and export while maintaining symbol-table uniqueness.

Remove the collision scan if the new invariant provides the same guarantee. Keep regression coverage for a custom gate named main and for collisions with reserved internal names.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    MLIRAnything related to MLIROpenQASMAnything related to OpenQASMcode qualityCode quality improvementsrefactorAnything related to code refactoring

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions