You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is perhaps ok for the main purpose of scope, the reason it's called "scope". But we can also use scope to check for example that return does not occur in global scope.
However, what we have is not sufficient to detect that return (erroneously) appears in a gate definition. This is because the spec says gate and subroutine definitions share one kind of scope. (There is likely an inconsistency here anyway.)
We probably want to
Add more variants to the ScopeType enum above. Eg. a scope for subroutine definitions and one for gate definitions.
Decide on the granularity and names for the errors. At least something for our current system for recording semantic errors.
Maybe add a function or two or some system to traverse the scope stack checking for something. For example, you can return from inside a control flow scope inside a subroutine definition. But not from within control flow in global scope. We don't want to check for this in an ad hoc way.
The text was updated successfully, but these errors were encountered:
We have a bit of ad-hoc checking for incompatible error scopes.
The scope struct currently follows exactly the jargon and definitions in the OQ3 spec:
openqasm3_parser/crates/oq3_semantics/src/symbols.rs
Lines 16 to 25 in b174b2b
This is perhaps ok for the main purpose of scope, the reason it's called "scope". But we can also use scope to check for example that
return
does not occur in global scope.However, what we have is not sufficient to detect that
return
(erroneously) appears in a gate definition. This is because the spec says gate and subroutine definitions share one kind of scope. (There is likely an inconsistency here anyway.)We probably want to
ScopeType
enum above. Eg. a scope for subroutine definitions and one for gate definitions.The text was updated successfully, but these errors were encountered: