Skip to content

Commit df24c8f

Browse files
authored
Merge pull request #3808 from mtzguido/nits
Misc improvements
2 parents b75933e + 1a043e3 commit df24c8f

File tree

4 files changed

+37
-29
lines changed

4 files changed

+37
-29
lines changed

src/parser/FStarC.Parser.AST.Util.fsti

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ val eq_binder (b1 b2:binder) : bool
2727
val eq_pattern (p1 p2:pattern) : bool
2828
val eq_decl (d1 d2:decl) : bool
2929

30+
(* Returns every identifier mentioned in a decl (including
31+
the body). This is used from the interactive mode to provide
32+
hover information and jump-to-definition. *)
3033
val lidents_of_decl (t:decl) : list FStarC.Ident.lident
3134

3235
type open_namespaces_and_abbreviations = {

src/tactics/FStarC.Tactics.Interpreter.fst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ let run_unembedded_tactic_on_ps
364364
else
365365
let open FStarC.Pprint in
366366
let open FStarC.Errors.Msg in
367-
Errors.raise_error0 Errors.Fatal_UserTacticFailure [
367+
Errors.raise_error ps.entry_range Errors.Fatal_UserTacticFailure [
368368
text "A tactic raised the Stop exception but did not log errors.";
369369
text "Failing anyway."
370370
]

src/tactics/FStarC.Tactics.V2.Basic.fst

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,29 +1788,31 @@ let default_if_err (def : 'a) (t : tac 'a) : tac 'a =
17881788
| Inl _ -> return def
17891789
| Inr v -> return v
17901790

1791-
let match_env (e:env) (t1 : term) (t2 : term) : tac bool = wrap_err "match_env" <| (
1792-
let! ps = get in
1793-
let! t1, ty1, g1 = __tc e t1 in
1794-
let! t2, ty2, g2 = __tc e t2 in
1795-
proc_guard "match_env g1" e g1 None ps.entry_range ;!
1796-
proc_guard "match_env g2" e g2 None ps.entry_range ;!
1797-
let must_tot = true in
1798-
default_if_err false <|
1799-
tac_and (do_match must_tot e ty1 ty2)
1800-
(do_match must_tot e t1 t2)
1801-
)
1791+
let match_env (e:env) (t1 : term) (t2 : term) : tac bool =
1792+
wrap_err "match_env" <|
1793+
default_if_err false <| (
1794+
let! ps = get in
1795+
let! t1, ty1, g1 = __tc e t1 in
1796+
let! t2, ty2, g2 = __tc e t2 in
1797+
proc_guard "match_env g1" e g1 None ps.entry_range ;!
1798+
proc_guard "match_env g2" e g2 None ps.entry_range ;!
1799+
let must_tot = true in
1800+
tac_and (do_match must_tot e ty1 ty2)
1801+
(do_match must_tot e t1 t2)
1802+
)
18021803

1803-
let unify_env (e:env) (t1 : term) (t2 : term) : tac bool = wrap_err "unify_env" <| (
1804-
let! ps = get in
1805-
let! t1, ty1, g1 = __tc e t1 in
1806-
let! t2, ty2, g2 = __tc e t2 in
1807-
proc_guard "unify_env g1" e g1 None ps.entry_range ;!
1808-
proc_guard "unify_env g2" e g2 None ps.entry_range ;!
1809-
let must_tot = true in
1810-
default_if_err false <|
1811-
tac_and (do_unify must_tot e ty1 ty2)
1812-
(do_unify must_tot e t1 t2)
1813-
)
1804+
let unify_env (e:env) (t1 : term) (t2 : term) : tac bool =
1805+
wrap_err "unify_env" <|
1806+
default_if_err false <| (
1807+
let! ps = get in
1808+
let! t1, ty1, g1 = __tc e t1 in
1809+
let! t2, ty2, g2 = __tc e t2 in
1810+
proc_guard "unify_env g1" e g1 None ps.entry_range ;!
1811+
proc_guard "unify_env g2" e g2 None ps.entry_range ;!
1812+
let must_tot = true in
1813+
tac_and (do_unify must_tot e ty1 ty2)
1814+
(do_unify must_tot e t1 t2)
1815+
)
18141816

18151817
let unify_guard_env (e:env) (t1 : term) (t2 : term) : tac bool = wrap_err "unify_guard_env" <| (
18161818
let! ps = get in
@@ -2386,7 +2388,7 @@ let unexpected_uvars_issue r =
23862388
let i = {
23872389
issue_level = EError;
23882390
issue_range = Some r;
2389-
issue_msg = Errors.mkmsg "Cannot check relation with uvars";
2391+
issue_msg = Errors.mkmsg "Cannot check relation with uvars.";
23902392
issue_number = Some (errno Error_UnexpectedUnresolvedUvar);
23912393
issue_ctx = []
23922394
} in

src/typechecker/FStarC.TypeChecker.Tc.fst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -816,9 +816,10 @@ let tc_decl' env0 se: list sigelt & list sigelt & Env.env =
816816
| [] -> [ S.Visible_default ]
817817
| qs -> qs
818818
in
819-
List.map
820-
(fun sp -> { sp with sigquals = sigquals@sp.sigquals; sigattrs = se.sigattrs@sp.sigattrs})
821-
ses
819+
let ses = ses |> List.map (fun sp ->
820+
{ sp with sigquals = sigquals@sp.sigquals; sigattrs = se.sigattrs@sp.sigattrs}) in
821+
let ses = ses |> List.map (Compress.deep_compress_se false false) in
822+
ses
822823
else ses
823824
in
824825
let ses = ses |> List.map (fun se ->
@@ -915,9 +916,11 @@ let tc_decl' env0 se: list sigelt & list sigelt & Env.env =
915916
[se], [], env0)
916917

917918

918-
(* [tc_decl env se] typechecks [se] in environment [env] and returns *
919+
(* [tc_decl env se] typechecks [se] in environment [env] and returns
919920
* the list of typechecked sig_elts, and a list of new sig_elts elaborated
920-
* during typechecking but not yet typechecked *)
921+
* during typechecking but not yet typechecked. This may also be called
922+
* on ALREADY CHECKED declarations coming out of a splice_t. See the
923+
* check for sigmeta_already_checked below. *)
921924
let tc_decl env se: list sigelt & list sigelt & Env.env =
922925
FStarC.GenSym.reset_gensym();
923926
let env0 = env in

0 commit comments

Comments
 (0)