diff --git a/lkql_checker/share/lkql/bit_records_without_layout_definition.lkql b/lkql_checker/share/lkql/bit_records_without_layout_definition.lkql index d0fa46783..627ded934 100644 --- a/lkql_checker/share/lkql/bit_records_without_layout_definition.lkql +++ b/lkql_checker/share/lkql/bit_records_without_layout_definition.lkql @@ -1,6 +1,6 @@ # TODO: move this function to libadalang fun lal_is_mod_type(n) = - n.f_type_expr.p_designated_type_decl().f_type_def is ModIntTypeDef + n.f_type_expr.p_designated_type_decl().p_root_type() is TypeDecl(f_type_def: ModIntTypeDef) @check(message="bit record without layout definition", category="Style", subcategory="Portability") diff --git a/testsuite/tests/checks/bit_records/bit.ads b/testsuite/tests/checks/bit_records/bit.ads index 065a504db..d40972276 100644 --- a/testsuite/tests/checks/bit_records/bit.ads +++ b/testsuite/tests/checks/bit_records/bit.ads @@ -1,5 +1,7 @@ package Bit is type My_Mod is mod 8; + subtype X is My_Mod; + type D is new My_Mod; type Rec1 is record -- NOFLAG I : My_Mod; @@ -17,4 +19,12 @@ package Bit is type Rec2_PA is record -- FLAG I : My_Mod; end record with Pack, Size => 32; + + type Rec3 is record -- FLAG + I : X; + end record with Pack; + + type Rec4 is record -- FLAG + I : D; + end record with Pack; end Bit; diff --git a/testsuite/tests/checks/bit_records/test.out b/testsuite/tests/checks/bit_records/test.out index 23f34da3b..a05bbd8e7 100644 --- a/testsuite/tests/checks/bit_records/test.out +++ b/testsuite/tests/checks/bit_records/test.out @@ -1,8 +1,16 @@ -bit.ads:11:9: rule violation: bit record without layout definition -11 | type Rec2_PP is record -- FLAG +bit.ads:13:9: rule violation: bit record without layout definition +13 | type Rec2_PP is record -- FLAG | ^^^^^^^ -bit.ads:17:9: rule violation: bit record without layout definition -17 | type Rec2_PA is record -- FLAG +bit.ads:19:9: rule violation: bit record without layout definition +19 | type Rec2_PA is record -- FLAG | ^^^^^^^ +bit.ads:23:9: rule violation: bit record without layout definition +23 | type Rec3 is record -- FLAG + | ^^^^ + +bit.ads:27:9: rule violation: bit record without layout definition +27 | type Rec4 is record -- FLAG + | ^^^^ +