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
{{ message }}
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
I'm observing several odd behaviors, I'm not sure which of them are bugs and which are expected, so I'll report them all at once without unentangling them.
The following code throws an error CS0136 A local or parameter named 'angle' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter, even though the angle variable in the outer scope is defined after the loop, so no shadowing occurs.
operation Tmp() : Unit {
for i in 0 .. 1 {
let angle = i * 2;
}
let angle = 0;
}
I'm also not sure how to interpret a local or parameter phrase - is it something like "a local variable or parameter"?
With an extra conjugation in place, the same code passes compilation, though if the variable angle in the loop was shadowing the variable outside of it, it is still doing it with an extra block inside.
operation Tmp() : Unit {
for i in 0 .. 1 {
within {
let angle = i * 2;
} apply {
let a = 1;
}
}
let angle = 0;
}
Additionally, it gives a warning The variable '__qsVar1__a__' is assigned but its value is never used, which looks like something from QIR, since the user-facing variable name is a. The unused variable warning for angle looks as expected.
System information
QDK 0.24.210930
The text was updated successfully, but these errors were encountered:
Describe the bug
I'm observing several odd behaviors, I'm not sure which of them are bugs and which are expected, so I'll report them all at once without unentangling them.
CS0136 A local or parameter named 'angle' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter
, even though theangle
variable in the outer scope is defined after the loop, so no shadowing occurs.I'm also not sure how to interpret
a local or parameter
phrase - is it something like "a local variable or parameter"?angle
in the loop was shadowing the variable outside of it, it is still doing it with an extra block inside.Additionally, it gives a warning
The variable '__qsVar1__a__' is assigned but its value is never used
, which looks like something from QIR, since the user-facing variable name isa
. The unused variable warning forangle
looks as expected.System information
The text was updated successfully, but these errors were encountered: