Some fixes & cleanup after early review

This commit is contained in:
Louis Gesbert 2023-08-25 14:12:02 +02:00
parent 72882f82df
commit 17172cf47d
6 changed files with 10 additions and 8 deletions

View File

@ -1,5 +1,5 @@
(* This file is part of the Catala build system, a specification language for
tax and social benefits computation rules. Copyright (C) 2020 Inria,
tax and social benefits computation rules. Copyright (C) 2022-2023 Inria,
contributors: Louis Gesbert <louis.gesbert@inria.fr>
Licensed under the Apache License, Version 2.0 (the "License"); you may not
@ -213,6 +213,12 @@ let run_inline_tests
in
let pid =
let cwd = Unix.getcwd () in
(* Catala depends on the CWD when printing relative file locations
in error messages. Here we are dealing with inline tests, and it
would be inconvenient for the file to contain its own location
relative to where the test was run from ; to avoid that, we
ensure to always run the catala exec from the directory where the
test file was found. *)
Unix.chdir file_dir;
Fun.protect ~finally:(fun () -> Unix.chdir cwd)
@@ fun () ->

View File

@ -1,5 +1,5 @@
(* This file is part of the Catala build system, a specification language for
tax and social benefits computation rules. Copyright (C) 2020 Inria,
tax and social benefits computation rules. Copyright (C) 2022-2023 Inria,
contributors: Louis Gesbert <louis.gesbert@inria.fr>
Licensed under the Apache License, Version 2.0 (the "License"); you may not

View File

@ -1277,7 +1277,4 @@ let translate_program (prgm : 'm Scopelang.Ast.program) : 'm Ast.program =
ctx )
in
let items, ctx = translate_defs top_ctx defs_ordering in
(* WIP TODO FIXME HERE: the scopes in submodules are not translated here it
seems, and their input structs not added to decl_ctx (see From_surface:1476
for decl_ctx flattening info) *)
{ code_items = Bindlib.unbox items; decl_ctx = ctx.decl_ctx }

View File

@ -79,6 +79,7 @@ type context = {
scopes : scope_context ScopeName.Map.t; (** For each scope, its context *)
topdefs : TopdefName.t Ident.Map.t; (** Global definitions *)
topdef_types : typ TopdefName.Map.t;
(** Types associated with the global definitions *)
structs : struct_context StructName.Map.t;
(** For each struct, its context *)
enums : enum_context EnumName.Map.t; (** For each enum, its context *)

View File

@ -149,8 +149,6 @@ let build_program_dep_graph (prgm : 'm Ast.program) : SDependencies.t =
used_defs g)
g scope.Ast.scope_decl_rules)
prgm.program_scopes g
(* TODO FIXME: Add submodules here, they may still need dependency resolution
type-wise (?) *)
let check_for_cycle_in_defs (g : SDependencies.t) : unit =
(* if there is a cycle, there will be an strongly connected component of

View File

@ -1,4 +1,4 @@
(* This file is part of the Catala compiler, a specification language for tax <
(* This file is part of the Catala compiler, a specification language for tax
and social benefits computation rules. Copyright (C) 2020-2022 Inria,
contributor: Denis Merigoux <denis.merigoux@inria.fr>, Alain Delaët-Tixeuil
<alain.delaet--tixeuil@inria.fr>, Louis Gesbert <louis.gesbert@inria.fr>