Skip to content

Disallow passing types as tags #6947

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

Merged
merged 5 commits into from
Jan 14, 2025

Conversation

dstrain115
Copy link
Collaborator

  • This has caused confusion when passing a tag type with PhysicalZTag as a tag when you mean the instance PhysicalZTag().

Fixes: #3897

- This has caused confusion when passing a tag type
with PhysicalZTag as a tag when you mean the instance
PhysicalZTag().
@dstrain115 dstrain115 requested review from vtomole and a team as code owners January 13, 2025 21:47
Copy link

codecov bot commented Jan 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.86%. Comparing base (988ecbc) to head (a39ccb9).
Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6947   +/-   ##
=======================================
  Coverage   97.86%   97.86%           
=======================================
  Files        1084     1084           
  Lines       94408    94408           
=======================================
+ Hits        92393    92397    +4     
+ Misses       2015     2011    -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@pavoljuhas pavoljuhas left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! Please consider updating a few comments before merging -

diff --git a/cirq-google/cirq_google/api/v2/program.proto b/cirq-google/cirq_google/api/v2/program.proto
index cbc66cc4..c0b4dc32 100644
--- a/cirq-google/cirq_google/api/v2/program.proto
+++ b/cirq-google/cirq_google/api/v2/program.proto
@@ -146 +146 @@ message ZPowGate {
-  // cirq.ZPowGate(...).with_tags(cirq.google.PhysicalZTag)
+  // cirq.ZPowGate(...).with_tags(cirq.google.PhysicalZTag())
diff --git a/cirq-google/cirq_google/transformers/target_gatesets/google_cz_gateset.py b/cirq-google/cirq_google/transformers/target_gatesets/google_cz_gateset.py
index dacefe8c..fe59e26b 100644
--- a/cirq-google/cirq_google/transformers/target_gatesets/google_cz_gateset.py
+++ b/cirq-google/cirq_google/transformers/target_gatesets/google_cz_gateset.py
@@ -40 +40 @@ class GoogleCZTargetGateset(cirq.CZTargetGateset):
-             `cirq_google.PhysicalZTag`) from single-qubit Pauli operations. Defaults to False.
+             `cirq_google.PhysicalZTag()`) from single-qubit Pauli operations. Defaults to False.

@dstrain115 dstrain115 enabled auto-merge (squash) January 14, 2025 17:03
@dstrain115 dstrain115 merged commit 63e4c7d into quantumlib:main Jan 14, 2025
37 checks passed
BichengYing pushed a commit to BichengYing/Cirq that referenced this pull request Jun 20, 2025
* Disallow passing types as tags

- This has caused confusion when passing a tag type
with PhysicalZTag as a tag when you mean the instance
PhysicalZTag().
- Adds comments to TaggedOperation and Operation to explain the limitation.
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.

Gate tagged with cirq.google.PhysicalZTag does not serialize
2 participants