Skip to content

Commit

Permalink
Fix: PILAnalyzer::Children visits Trait functions twice (#2336)
Browse files Browse the repository at this point in the history
Fix #1964
  • Loading branch information
gzanitti authored Jan 15, 2025
1 parent 968223d commit e4ebab3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pil-analyzer/src/pil_analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,8 @@ impl Children<Expression> for PILAnalyzer {
self.definitions
.values()
.filter_map(|(_, def)| def.as_ref())
// Since TraitFunction definition is already included in the declaration itself, we filter TraitFunctions to avoid duplicates
.filter(|def| !matches!(def, FunctionValueDefinition::TraitFunction(_, _)))
.flat_map(|def| def.children())
.chain(self.trait_impls.iter().flat_map(|impl_| impl_.children()))
.chain(self.proof_items.iter()),
Expand All @@ -576,6 +578,8 @@ impl Children<Expression> for PILAnalyzer {
self.definitions
.values_mut()
.filter_map(|(_, def)| def.as_mut())
// Since TraitFunction definition is already included in the declaration itself, we filter TraitFunctions to avoid duplicates
.filter(|def| !matches!(def, FunctionValueDefinition::TraitFunction(_, _)))
.flat_map(|def| def.children_mut())
.chain(
self.trait_impls
Expand Down

0 comments on commit e4ebab3

Please sign in to comment.