Skip to content

Commit e2ff872

Browse files
committed
Fix another infinite lookup
1 parent 25d8a80 commit e2ff872

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

src/language/term/Equality.re

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,11 @@ let equality =
295295
open OptUtil.Syntax;
296296
let lookup1 = {
297297
let* env1 = env1;
298-
Environment.lookup(env1, x);
298+
let v = Environment.lookup(env1, x);
299+
switch (v) {
300+
| Some({term: Var(v), _}) when v == x => None
301+
| _ => v
302+
};
299303
};
300304
switch (lookup1) {
301305
| Some(v1) => exp'(v1, e2)
@@ -309,7 +313,11 @@ let equality =
309313
open OptUtil.Syntax;
310314
let lookup2 = {
311315
let* env2 = env2;
312-
Environment.lookup(env2, y);
316+
let v = Environment.lookup(env2, y);
317+
switch (v) {
318+
| Some({term: Var(v), _}) when v == y => None
319+
| _ => v
320+
};
313321
};
314322
switch (lookup2) {
315323
| Some(v2) => exp'(e1, v2)

src/web/app/editors/stepper/MissingStep.re

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,16 @@ module Update = {
289289
|> {
290290
let.calc sctx = ctx
291291
and.calc to_exp = cached_exp
292-
and.calc from_exp = exp;
292+
and.calc from_exp = selected_exp;
293293
let env = SemanticCtx.get_env(sctx);
294-
let from_exp = Substitution.in_exp(env, from_exp);
294+
let from_exp =
295+
Substitution.in_exp(
296+
env,
297+
from_exp
298+
|> Option.value(
299+
~default=IdTagged.FreshGrammar.Exp.empty_hole(),
300+
),
301+
);
295302
let to_exp = Substitution.in_exp(env, to_exp);
296303
RewriteChecker.check_rewrite(~settings, ~env, from_exp, to_exp);
297304
};
@@ -325,9 +332,16 @@ module Update = {
325332
|> {
326333
let.calc sctx = ctx
327334
and.calc to_exp = cached_exp
328-
and.calc from_exp = exp;
335+
and.calc from_exp = selected_exp;
329336
let env = SemanticCtx.get_env(sctx);
330-
let from_exp = Substitution.in_exp(env, from_exp);
337+
let from_exp =
338+
Substitution.in_exp(
339+
env,
340+
from_exp
341+
|> Option.value(
342+
~default=IdTagged.FreshGrammar.Exp.empty_hole(),
343+
),
344+
);
331345
let to_exp = Substitution.in_exp(env, to_exp);
332346
RewriteChecker.check_written_step(
333347
~settings,

0 commit comments

Comments
 (0)