don't apply rewrite if types don't match
@@ -125,6 +125,14 @@ impl<L: SynthLanguage> Applier<L, SynthAnalysis> for NotUndefined<L> {
return vec![];
}
+ if let Some(enode_or_var) = self.rhs.ast.as_ref().last() {
+ if let ENodeOrVar::ENode(x) = enode_or_var {
+ if x.get_type() != egraph[matched_id].data.class_type {
+ return vec![];
+ }
+ }
+ }
+
let id = apply_pat(self.rhs.ast.as_ref(), egraph, subst);
if !egraph[id].data.is_defined() {
