RCA correctly identifies an update of a mutable variable within a dynamic scope as using dynamism on that type. For example, this code is flagged as using a dynamic double:
use q = Qubit();
mutable angle = 0.0;
if M(q) == One {
set angle = 1.0;
}
However, if the mutable variable is limited to the same or smaller scope than the dynamism, it should be allowed:
use q = Qubit();
if M(q) == One {
mutable angle = 0.0;
set angle = 1.0;
}
But this also gets rejected. The check for expression kinds like Assign and AssignUpdate (plus the array variants) should be enlightened to know when the variable being updated is limited in scope and not include flags for dynamism in that case.
RCA correctly identifies an update of a mutable variable within a dynamic scope as using dynamism on that type. For example, this code is flagged as using a dynamic double:
However, if the mutable variable is limited to the same or smaller scope than the dynamism, it should be allowed:
But this also gets rejected. The check for expression kinds like
Assign
andAssignUpdate
(plus the array variants) should be enlightened to know when the variable being updated is limited in scope and not include flags for dynamism in that case.