-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support stabilised syntax for OpenQASM 3 switch
#11417
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8baa0cf
Support stabilised syntax for OpenQASM 3 `switch`
jakelishman afd32ae
Fix lint
jakelishman 41fdf36
:us:
jakelishman 0891659
Make AST node more descriptive
jakelishman 57a0c22
Merge remote-tracking branch 'ibm/main' into qasm3/switch-v2
jakelishman a549280
Use correct version number
jakelishman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
16 changes: 16 additions & 0 deletions
16
releasenotes/notes/qasm3-stable-switch-61a10036d1587778.yaml
This file contains 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
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,16 @@ | ||||||||||||||||||||||||||||||||||
--- | ||||||||||||||||||||||||||||||||||
features: | ||||||||||||||||||||||||||||||||||
- | | ||||||||||||||||||||||||||||||||||
The OpenQASM 3 exporter (see :func:`~.qasm3.dump` and :func:`~.qasm3.dumps` functions in | ||||||||||||||||||||||||||||||||||
:mod:`qiskit.qasm3`) now supports the stabilised syntax of the ``switch`` statement in OpenQASM 3 | ||||||||||||||||||||||||||||||||||
by default. The pre-certification syntax of the ``switch`` statement is still available by | ||||||||||||||||||||||||||||||||||
using the :attr:`.ExperimentalFeatures.SWITCH_CASE_V1` flag in the ``experimental`` argument of | ||||||||||||||||||||||||||||||||||
the exporter. There is no feature flag required for the stabilised syntax, but if you are | ||||||||||||||||||||||||||||||||||
interfacing with other tooling that is not yet updated, you may need to pass the experimental | ||||||||||||||||||||||||||||||||||
flag. | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
The syntax of the stabilised form is slightly different with regards to terminating ``break`` | ||||||||||||||||||||||||||||||||||
Comment on lines
+5
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||
statements (no longer required nor permitted), and multiple cases are now combined into a single | ||||||||||||||||||||||||||||||||||
``case`` line, rather than using C-style fall-through. For more detail, see `the OpenQASM 3 | ||||||||||||||||||||||||||||||||||
documentation on the switch-case construct | ||||||||||||||||||||||||||||||||||
<https://openqasm.com/language/classical.html#the-switch-statement>`__. |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to think of a
bettermore useful name than....Preview
. I think contemporary software devs find the word "Legacy" distasteful. But it's probably widely understood by casual programmers. MaybeSwitchStatementOldStyle
. In OQ3, "old style" refers to OQ2 legacy syntax. In this case it's not from a previous version. ButOldStyle
tells me that I probably don't want this, even if I am not familiar with its history.Or even
SwitchStatementObsolete
. This really tells me I should not be using it.