From f9901be1f955afc481b6bdfa895927fa7e0aca66 Mon Sep 17 00:00:00 2001 From: Bruno Andreotti Date: Mon, 26 Feb 2024 14:44:55 -0300 Subject: [PATCH] Fix implementation of `DeBruijnMap::is_empty` --- carcara/src/ast/polyeq.rs | 2 +- carcara/src/utils.rs | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/carcara/src/ast/polyeq.rs b/carcara/src/ast/polyeq.rs index 4c2df07d..fe0be2ce 100644 --- a/carcara/src/ast/polyeq.rs +++ b/carcara/src/ast/polyeq.rs @@ -482,7 +482,7 @@ impl DeBruijnMap { } fn is_empty(&self) -> bool { - self.indices.0.is_empty() && self.indices.1.is_empty() && self.counter.is_empty() + self.indices.0.is_empty() && self.indices.1.is_empty() } fn push(&mut self) { diff --git a/carcara/src/utils.rs b/carcara/src/utils.rs index 98d52e6b..ac601b93 100644 --- a/carcara/src/utils.rs +++ b/carcara/src/utils.rs @@ -111,12 +111,8 @@ impl HashMapStack { Self { scopes: vec![IndexMap::new()] } } - pub fn height(&self) -> usize { - self.scopes.len() - } - pub fn is_empty(&self) -> bool { - self.height() == 0 + self.scopes.iter().all(IndexMap::is_empty) } pub fn push_scope(&mut self) {