Skip to content

Commit

Permalink
fix names
Browse files Browse the repository at this point in the history
  • Loading branch information
yihozhang committed Oct 4, 2024
1 parent 8395a80 commit c8e5aa9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/ast/desugar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ pub(crate) fn desugar_command(
rule,
} => {
let name = if name.as_str() == "" {
rule.to_string().replace('\"', "'")
// Adding a unique prefix because there may be duplicate rules (e.g., when
// processing a resugared egglog program).
desugar.get_fresh().to_string() + &rule.to_string().replace('\"', "'")
} else {
name.to_string()
};
Expand All @@ -261,7 +263,7 @@ pub(crate) fn desugar_command(
if let Some(new_rule) = add_semi_naive_rule(desugar, rule) {
result.push(NCommand::NormRule {
ruleset,
name: ("__seminaive-".to_string() + &name).into(),
name: (desugar.get_fresh().to_string() + &"__seminaive-" + &name).into(),
rule: new_rule,
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ impl Default for EGraph {
);
egraph.scheduler_constructors.insert(
"backoff".into(),
Rc::new(|_| Box::new(scheduler::BackoffScheduler::default())),
Rc::new(|_| Box::<scheduler::BackoffScheduler>::default()),
);
egraph
}
Expand Down Expand Up @@ -1219,7 +1219,7 @@ impl EGraph {

/// Get the current timestamp
pub fn get_timestamp(&self) -> u32 {
return self.timestamp;
self.timestamp
}

/// Bump the timestamp by 1
Expand Down
2 changes: 1 addition & 1 deletion src/scheduler.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use instant::{Duration, Instant};
use std::fmt::{Display, Formatter};
use std::mem;
use std::time::{Duration, Instant};

use crate::{CompiledRule, Error, HashSet, Ruleset, Symbol, Value};

Expand Down
2 changes: 1 addition & 1 deletion src/typechecking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ impl TypeInfo {
GenericSchedule::WithScheduler(span, scheduler, args, schedule) => {
ResolvedSchedule::WithScheduler(
span.clone(),
scheduler.clone(),
*scheduler,
args.iter()
.map(|arg| self.typecheck_expr(arg, &Default::default()))
.collect::<Result<Vec<_>, _>>()?,
Expand Down

0 comments on commit c8e5aa9

Please sign in to comment.