Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing #2949 #3119

Merged
merged 3 commits into from
Nov 30, 2023
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
9 changes: 9 additions & 0 deletions ocaml/fstar-lib/generated/FStar_TypeChecker_Normalize.ml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 50 additions & 13 deletions ocaml/fstar-lib/generated/FStar_TypeChecker_TcTerm.ml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/typechecker/FStar.TypeChecker.Normalize.fst
Original file line number Diff line number Diff line change
Expand Up @@ -1732,6 +1732,10 @@ let rec norm : cfg -> env -> stack -> term -> term =
norm cfg env (Meta(env, Meta_pattern(names, args), t.pos)::stack) head
//meta doesn't block reduction, but we need to put the label back

(* Try to retain Sequence nodes when not normalizing letbindings. *)
| Meta_desugared Sequence when cfg.steps.do_not_unfold_pure_lets ->
norm cfg env (Meta(env,m,t.pos)::stack) head

| Meta_desugared (Machine_integer (_,_)) ->
(* meta doesn't block reduction,
but we need to put the label back *)
Expand Down
16 changes: 9 additions & 7 deletions src/typechecker/FStar.TypeChecker.TcTerm.fst
Original file line number Diff line number Diff line change
Expand Up @@ -2811,7 +2811,7 @@ and check_application_args env head (chead:comp) ghead args expected_topt : term
let head, chead, ghead = monadic_application head_info subst outargs arg_rets g fvs [] in
let chead, ghead = TcComm.lcomp_comp chead |> (fun (c, g) -> c, Env.conj_guard ghead g) in
let rec aux norm solve ghead tres =
let tres = SS.compress tres |> U.unrefine in
let tres = SS.compress tres |> U.unrefine |> U.unmeta_safe in
match tres.n with
| Tm_arrow {bs; comp=cres'} ->
let bs, cres' = SS.open_comp bs cres' in
Expand All @@ -2834,12 +2834,14 @@ and check_application_args env head (chead:comp) ghead args expected_topt : term
aux norm true ghead tres

| _ ->
raise_error (Errors.Fatal_ToManyArgumentToFunction,
BU.format3 "Too many arguments to function of type %s; got %s arguments, remaining type is %s"
(N.term_to_string env thead)
(BU.string_of_int n_args)
(Print.term_to_string tres))
(argpos arg) in
let open FStar.Class.PP in
let open FStar.Pprint in
raise_error_doc (Fatal_ToManyArgumentToFunction, [
prefix 4 1 (text "Too many arguments to function of type") (pp thead);
text "Got" ^/^ pp (n_args <: int) ^/^ text "arguments";
prefix 4 1 (text "Remaining type is") (pp tres);
]) (argpos arg)
in
aux false false ghead (U.comp_result chead)
in //end tc_args

Expand Down