Skip to content

Commit

Permalink
Fix dependency analysis for polymorphic user types
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-larraz committed Aug 28, 2024
1 parent f5023d8 commit dd0a2d9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lustre/lustreAstDependencies.ml
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,10 @@ let rec mk_graph_type: LA.lustre_type -> dependency_analysis_data = function
| Some e2 -> mk_graph_expr e2
in
union_dependency_analysis_data g1 g2
| UserType (pos, _, i) -> singleton_dependency_analysis_data ty_prefix i pos
| UserType (pos, ty_args, i) -> (
let usr_g = singleton_dependency_analysis_data ty_prefix i pos in
List.fold_left union_dependency_analysis_data usr_g (List.map mk_graph_type ty_args)
)
| AbstractType (pos, i) -> singleton_dependency_analysis_data ty_prefix i pos
| TupleType (_, tys) -> List.fold_left union_dependency_analysis_data empty_dependency_analysis_data (List.map (fun t -> mk_graph_type t) tys)
| GroupType (_, tys) -> List.fold_left union_dependency_analysis_data empty_dependency_analysis_data (List.map (fun t -> mk_graph_type t) tys)
Expand Down
18 changes: 18 additions & 0 deletions tests/regression/success/poly_user_type.lus
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
type R0<<T>> = struct {
v: T;
};

type E = enum {A, B};

type R1 = struct {
f: E;
};

type R2 = struct {
opt: R0<<R1>>;
};

node N(x: R2) returns (y: R2);
let
y = x;
tel

0 comments on commit dd0a2d9

Please sign in to comment.