Skip to content

Commit 812b1bc

Browse files
committed
Fix IH not appearing with pattern cast mismatch
1 parent ca8155b commit 812b1bc

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed

src/language/proof/MatchExp.re

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ let rec match_exp =
7171
ctx,
7272
),
7373
)
74-
| Some(e) => Equality.semantic.exp(e, exp) ? Some(ctx) : None
74+
| Some(e) =>
75+
print_endline("ASSIGNED");
76+
print_endline("assigned exp: " ++ Exp.show(e));
77+
Equality.ignoring_ascriptions.exp(e, exp) ? Some(ctx) : None;
7578
}
7679
};
7780
| (Var(x), Var(y)) when are_alpha_equiv(alphas, x, y) => Some(ctx)
@@ -265,6 +268,8 @@ and match_pat = (pat_r: Pat.t, pat: Pat.t): option(alphas) =>
265268
| (Projector(_, p1), _) => match_pat(p1, pat)
266269
| (_, Parens(p2))
267270
| (_, Projector(_, p2)) => match_pat(pat_r, p2)
271+
| (Asc(p1, _), _) => match_pat(p1, pat)
272+
| (_, Asc(p2, _)) => match_pat(pat_r, p2)
268273
| (Invalid(x), Invalid(y)) when x == y => Some([])
269274
| (Invalid(_), _) => None
270275
| (EmptyHole, EmptyHole) => Some([])
@@ -319,11 +324,6 @@ and match_pat = (pat_r: Pat.t, pat: Pat.t): option(alphas) =>
319324
let* alphas2 = match_pat(x2, y2);
320325
Some(alphas1 @ alphas2);
321326
| (Ap(_, _), _) => None
322-
| (Asc(x, t1), Asc(y, t2)) =>
323-
let* alphas1 = match_pat(x, y);
324-
let* () = match_typ(t1, t2);
325-
Some(alphas1);
326-
| (Asc(_, _), _) => None
327327
| (Label(l1), Label(l2)) when l1 == l2 => Some([])
328328
| (Label(_), _) => None
329329
| (TupLabel({term: ExplicitNonlabel, _}, pat_r), _) =>

src/language/proof/ProofHacks.re

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ let exp_idx = (e1: Exp.t, e2: Exp.t) => {
3232
(cont, exp) =>
3333
if (Exp.rep_id(exp) == Exp.rep_id(e1)) {
3434
raise(Found(exp));
35-
} else if (DHExp.fast_equal(exp, e1)) {
35+
} else if (Equality.ignoring_ascriptions.exp(exp, e1)) {
3636
n := n^ + 1;
3737
exp;
3838
} else {
@@ -58,7 +58,7 @@ let nth_exp = (e1: Exp.t, n: int, e2: Exp.t) => {
5858
Exp.map_term(
5959
~f_exp=
6060
(cont, exp) =>
61-
if (DHExp.fast_equal(exp, e1)) {
61+
if (Equality.ignoring_ascriptions.exp(exp, e1)) {
6262
if (count^ == n) {
6363
raise(Found(exp));
6464
} else {
@@ -349,7 +349,7 @@ let rec replace_exp =
349349
switch (term) {
350350
/* Note[Matt]: We are not currently checking alpha-equivalence here because it's unlikely
351351
to come up, but we could. */
352-
| _ when Exp.fast_equal(exp, replace) =>
352+
| _ when Equality.ignoring_ascriptions.exp(exp, replace) =>
353353
with_exp |> Exp.replace_all_ids
354354
/* Forms with binders: check if any bound variables are in the coctx,
355355
if so, stop. */

src/language/term/Equality.re

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,3 +776,9 @@ let semantic_settings = {
776776
};
777777

778778
let semantic = equality(semantic_settings);
779+
780+
let ignoring_ascriptions =
781+
equality({
782+
...semantic_settings,
783+
ignore_ascriptions: true,
784+
});

src/util/StringUtil.re

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,5 @@ let subseq_search = (s: string, sub: string): bool => {
180180
);
181181
};
182182

183-
print_endline(
184-
"Subseq search: "
185-
++ sub
186-
++ " in "
187-
++ s
188-
++ "returns"
189-
++ string_of_bool(search(0, 0)),
190-
);
191-
192183
search(0, 0);
193184
};

0 commit comments

Comments
 (0)