@Test public void testEquality() { Hole h = new Hole("i", IntType.TYPE, IntConst.class); Node n1 = new Add(h, h); Node n2 = new Add(IntConst.of(1), IntConst.of(1)); Optional<Map<Hole, Node>> unifier = Unifier.unify(n1, n2); assertTrue(unifier.isPresent()); assertEquals(IntConst.of(1), unifier.get().get(h)); }
public static Optional<Map<Hole, Node>> unify(Node pattern, Node node) { UnifyVisitor visitor = new UnifyVisitor(node); pattern.accept(visitor); return visitor.getUnifier(); }
Unifier { public static Optional<Map<Hole, Node>> unify(Node pattern, Node node) { UnifyVisitor visitor = new UnifyVisitor(node); pattern.accept(visitor); return visitor.getUnifier(); } }
Unifier { public static Optional<Map<Hole, Node>> unify(Node pattern, Node node) { UnifyVisitor visitor = new UnifyVisitor(node); pattern.accept(visitor); return visitor.getUnifier(); }  }
Unifier { public static Optional<Map<Hole, Node>> unify(Node pattern, Node node) { UnifyVisitor visitor = new UnifyVisitor(node); pattern.accept(visitor); return visitor.getUnifier(); }  static Optional<Map<Hole, Node>> unify(Node pattern, Node node); }
Unifier { public static Optional<Map<Hole, Node>> unify(Node pattern, Node node) { UnifyVisitor visitor = new UnifyVisitor(node); pattern.accept(visitor); return visitor.getUnifier(); }  static Optional<Map<Hole, Node>> unify(Node pattern, Node node);  }