Remove const bool flag from qsc_openqasm_compiler::types::Type#3004
Merged
minestarks merged 2 commits intominestarks/fix-bit-binop-result-castfrom Mar 6, 2026
Merged
Remove const bool flag from qsc_openqasm_compiler::types::Type#3004minestarks merged 2 commits intominestarks/fix-bit-binop-result-castfrom
qsc_openqasm_compiler::types::Type#3004minestarks merged 2 commits intominestarks/fix-bit-binop-result-castfrom
Conversation
Co-authored-by: minestarks <16928427+minestarks@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix redundant round-trip casts in OpenQASM-to-Q# compilation
Remove const bool flag from Mar 6, 2026
qsc_openqasm_compiler::types::Type
orpuente-MS
approved these changes
Mar 6, 2026
111ddf2
into
minestarks/fix-bit-binop-result-cast
2 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
Typeenum inqsc_openqasm_compilercarried aboolconst qualifier on most variants (e.g.Int(bool),Result(bool),BoolArray(ArrayDimensions, bool)). Since Q# has no const bindings, this flag was never meaningful in the Q# type representation and only added noise — requiring a dedicatedwithout_const()method just to normalize types for equality comparisons.Changes
types.rs: Strip theboolconst parameter from allTypevariants; removewithout_const().compiler.rs:semantic_type_for_qsharp_type: no longer extracts or forwardsis_constintoTypeconstruction.make_qsharp_array_ty: removes hardcodedfalseconst args.maps_to_same_qsharp_type: simplifies to direct==comparison (the note about ignoring const qualifiers is now moot).ast_builder.rs:map_qsharp_type_to_ast_tyupdated to match new variant shapes.Constness is still read from the OpenQASM parser symbol (
symbol.ty.is_const()) where it matters — to decide Q# declaration mutability (letvsmutable) — it just no longer flows into the intermediateTyperepresentation.🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.