Merge pull request #1402 from AleoHQ/fix-duplicate-bug

[Fix] Fixes the random flying bug with duplicates
This commit is contained in:
gluax 2021-10-20 04:05:19 -07:00 committed by GitHub
commit 4fb0c73873
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -66,6 +66,11 @@ impl Identifier {
span,
}
}
/// Check if the Identifier name matches the other name
pub fn matches(&self, other: &Self) -> bool {
self.name == other.name
}
}
impl<'ast> From<InputIdentifier<'ast>> for Identifier {
@ -90,7 +95,7 @@ impl fmt::Debug for Identifier {
impl PartialEq for Identifier {
fn eq(&self, other: &Self) -> bool {
self.name == other.name
self.name == other.name && self.span == other.span
}
}

View File

@ -36,7 +36,7 @@ impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
match context.input.remove(0) {
ConstrainedValue::CircuitExpression(_variable, members) => {
// Modify the circuit variable in place
let matched_variable = members.iter_mut().find(|member| &member.0 == name);
let matched_variable = members.iter_mut().find(|member| member.0.matches(name));
match matched_variable {
Some(member) => {