Skip to content
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

[CQT-217] Error when redeclaring a variable #272

Merged
merged 3 commits into from
Dec 2, 2024

Conversation

rturrado
Copy link
Contributor

@rturrado rturrado commented Dec 2, 2024

Up until now, a variable could be redeclared.

Upon a redeclaration, we would simply:

  • remove the previous entry in the variable symbol table, and
  • add the new variable to the symbol table.

But this was leading us to different kind of problems.

From now on, a program as the one below will emit an error message: trying to redeclare variable 'q'.

version 3.0

qubit[2] q

H q[0]

qubit[3] q

H q[2]

@rturrado rturrado requested a review from elenbaasc December 2, 2024 11:58
We are starting to follow a bit more seriously the semantic versioning.

Since this PR introduces a change that breaks backward compatibility (valid programs up to now become invalid programs with the error redeclaration change), we MUST change the major version of the future release.
Copy link
Contributor

@elenbaasc elenbaasc left a comment

Choose a reason for hiding this comment

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

Perfect, thanks!

@rturrado rturrado merged commit d5840ad into develop Dec 2, 2024
22 checks passed
@rturrado rturrado deleted the CQT-217-Error-when-redeclaring-a-variable branch December 2, 2024 15:56
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.

2 participants