Skip to content

Commit

Permalink
use mode for constructor pattern elaborations + add undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrus- committed Jul 25, 2024
1 parent 64f5d13 commit 13b0d28
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/haz3lcore/dynamics/Elaborator.re
Original file line number Diff line number Diff line change
Expand Up @@ -455,11 +455,16 @@ and dhpat_of_upat = (m: Statics.Map.t, upat: Term.UPat.t): option(DHPat.t) => {
| InHole(Common(NoType(FreeConstructor(_)))) =>
Some(BadConstructor(u, 0, name))
| _ =>
let dc =
let ty =
switch (Ctx.lookup_ctr(ctx, name)) {
| None => DHPat.Constructor(name, Unknown(Internal))
| Some({typ, _}) =>
DHPat.Constructor(name, Typ.normalize(ctx, typ))
| None => Typ.Unknown(Internal)
| Some({typ, _}) => Typ.normalize(ctx, typ)
};
let dc =
switch (mode) {
| Ana(ana_ty) =>
DHPat.Constructor(name, Typ.normalize(ctx, ana_ty))
| _ => DHPat.Constructor(name, ty)
};
wrap(dc);
}
Expand Down
1 change: 1 addition & 0 deletions src/haz3lcore/dynamics/TypeAssignment.re
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ let rec typ_of_dhexp =
} else {
None;
};
| Undefined => Some(Typ.Unknown(Internal))
};
};

Expand Down

0 comments on commit 13b0d28

Please sign in to comment.