Skip to content

Commit

Permalink
Everything passes now.
Browse files Browse the repository at this point in the history
Although there are some disturbing diagnostics
regarding type recursion during unification
which didn't happen with the old system.
  • Loading branch information
skaller committed Feb 6, 2022
1 parent 292ba28 commit cb63089
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/compiler/flx_bind/flx_bbind.ml
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,8 @@ print_endline ("\n===================\nBETA EVERYTHING \n=======================
Flx_bsym_table.iter
(fun bid parent bsym ->
let f_btype t = Flx_beta.beta_reduce "Global beta reduction" state.counter bsym_table Flx_srcref.dummy_sr t in
let f_bexpr e = Flx_bexpr.map ~f_btype e in
let f_bexe exe = Flx_bexe.map ~f_btype exe in
let rec f_bexpr e = Flx_bexpr.map ~f_btype ~f_bexpr e in
let f_bexe exe = Flx_bexe.map ~f_btype ~f_bexpr exe in
let bbdcl = Flx_bbdcl.map ~f_btype ~f_bexe ~f_bexpr bsym.bbdcl in
let bsym = Flx_bsym.replace_bbdcl bsym bbdcl in
Flx_bsym_table.update bsym_table bid bsym
Expand Down
12 changes: 12 additions & 0 deletions src/compiler/flx_frontend/flx_numono.ml
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,18 @@ is a virtual function. Not much is going to be kept.
failwith "SYSTEM ERROR: monomorphisation failed"
end;

Flx_bsym_table.iter
(fun bid parent bsym ->
let f_btype t = Flx_beta.beta_reduce "Post Mono Global beta reduction" syms.counter bsym_table Flx_srcref.dummy_sr t in
let rec f_bexpr e = Flx_bexpr.map ~f_btype ~f_bexpr e in
let f_bexe exe = Flx_bexe.map ~f_btype ~f_bexpr exe in
let bbdcl = Flx_bbdcl.map ~f_btype ~f_bexe ~f_bexpr bsym.bbdcl in
let bsym = Flx_bsym.replace_bbdcl bsym bbdcl in
Flx_bsym_table.update bsym_table bid bsym
) bsym_table
;


if syms.Flx_mtypes2.compiler_options.Flx_options.print_flag then
begin
print_endline "";
Expand Down
8 changes: 7 additions & 1 deletion src/compiler/flx_frontend/flx_xcoerce.ml
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ justified by theory, it doesn't check if, for example, that
compact linear type transformations are actually isomorphisms, etc
*)
and expand_coercion new_table bsym_table counter parent remap ((srcx,srct) as srce) dstt sr =
(*
print_endline ("Src type " ^ Flx_print.sbt bsym_table srct);
print_endline ("Dst type " ^ Flx_print.sbt bsym_table dstt);
*)
if Flx_typeeq.type_eq (Flx_print.sbt bsym_table) counter srct dstt
then srce
else
Expand Down Expand Up @@ -392,9 +396,11 @@ and process_expr new_table bsym_table counter parent sr expr =

let process_exe new_table bsym_table counter parent exe =
let sr = Flx_bexe.get_srcref exe in
let newexe = Flx_bexe.map ~f_bexpr:(process_expr new_table bsym_table counter parent sr) exe in
(*
print_endline ("Old bexe=" ^ Flx_print.sbx bsym_table exe);
*)
let newexe = Flx_bexe.map ~f_bexpr:(process_expr new_table bsym_table counter parent sr) exe in
(*
print_endline ("New bexe=" ^ Flx_print.sbx bsym_table newexe);
*)
newexe
Expand Down
1 change: 0 additions & 1 deletion src/compiler/flx_opt/flx_opt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ let stack_calls syms bsym_table =
(* Do some platform independent optimizations of the code. *)
let optimize_bsym_table' syms bsym_table (root_proc: int option) =
print_debug syms "//OPTIMISING";

let bsym_table = print_time syms "[flx_opt]; Expanding Coercions (polymorphic)" begin fun () ->
(* make wrappers for non-function functional values *)
Flx_xcoerce.expand_coercions syms bsym_table end
Expand Down

0 comments on commit cb63089

Please sign in to comment.