Skip to content

Commit

Permalink
Merge pull request kind2-mc#1093 from daniel-larraz/poly-type-dep
Browse files Browse the repository at this point in the history
Fix dependency analysis for polymorphic user types
  • Loading branch information
daniel-larraz authored Aug 28, 2024
2 parents f5023d8 + dd0a2d9 commit 0d2710a
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 0d2710a

Please sign in to comment.