Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/language/term/Exp.re
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ let rep_id: t => Id.t = IdTagged.rep_id;
let term_of: t => term = IdTagged.term_of;
let unwrap: t => (term, term => t) = IdTagged.unwrap;

let cls_of_term: type a. Grammar.exp_term(a) => cls =
let rec cls_of_term: type a. Grammar.exp_term(a) => cls =
fun
| Invalid(_) => Invalid
| EmptyHole => EmptyHole
Expand Down Expand Up @@ -116,7 +116,9 @@ let cls_of_term: type a. Grammar.exp_term(a) => cls =
| Filter(_) => Filter
| Closure(_) => Closure
| Parens(_) => Parens
| Projector(_) => Projector
// We're bypassing projectors from cls because they're breaking cursor inspector messages.
// Future work could be to specialize projectors in the cursor inspector.
| Projector(_, e) => cls_of_term(e.term)
| Cons(_) => Cons
| ListConcat(_) => ListConcat
| UnOp(op, _) => UnOp(op)
Expand Down
18 changes: 11 additions & 7 deletions test/Test_Grammar.re
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,17 @@ let tests = (
let cls_testable =
testable(Fmt.using(Exp.show_cls, Fmt.string), Exp.equal_cls);
List.iter(
cls =>
check(
cls_testable,
Exp.show_cls(cls) ++ " Equivalency",
cls,
Exp.cls_of_term(sample_expression(cls).term),
),
(cls: Exp.cls) =>
switch (cls) {
| Projector => () // Excluding projectors from cls
| _ =>
check(
cls_testable,
Exp.show_cls(cls) ++ " Equivalency",
cls,
Exp.cls_of_term(sample_expression(cls).term),
)
},
exp_classes,
);
},
Expand Down