File tree Expand file tree Collapse file tree 3 files changed +14
-10
lines changed
lkql_checker/share/lkql/kp
testsuite/tests/checks/KP-S814-034 Expand file tree Collapse file tree 3 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import stdlib
44fun kp_s814_034(node) =
55 |" Flag array aggregates with an others choice if the array component type is a
66 |" record type that has a string subcomponent.
7- node is Aggregate(p_is_subaggregate(): false, p_expression_type(): t)
7+ node is Aggregate(p_is_subaggregate(): false, p_expression_type(): t@BaseTypeDecl )
88 when
99 # Check that the aggregate is not a nested array aggregate
1010 not node.p_is_subaggregate() and
Original file line number Diff line number Diff line change 11procedure P is
2+ -- Ensure aggregates with no type don't trigger any error
3+ type Example_Enum is (A, B, C);
4+ for Example_Enum use (A => 0 , B => 1 , C => 2 ); -- NOFLAG
5+
26 Max_Error_Length : constant := 8 ;
37 subtype Str is String (1 .. Max_Error_Length);
48
59 S_Init : constant Str := " INIT " ;
610
7- type Rec is record
11+ type Rec is tagged record
812 Text : Str;
913 end record ;
1014
Original file line number Diff line number Diff line change 1- p.adb:22 :18: rule violation: possible occurrence of KP S814-034
2- 22 | A : Arr := (others => (others => S_Init)); -- FLAG
1+ p.adb:26 :18: rule violation: possible occurrence of KP S814-034
2+ 26 | A : Arr := (others => (others => S_Init)); -- FLAG
33 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44
5- p.adb:23 :22: rule violation: possible occurrence of KP S814-034
6- 23 | M_A : M_Arr := (others => (others => R_Init)); -- FLAG
5+ p.adb:27 :22: rule violation: possible occurrence of KP S814-034
6+ 27 | M_A : M_Arr := (others => (others => R_Init)); -- FLAG
77 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
88
9- p.adb:24 :22: rule violation: possible occurrence of KP S814-034
10- 24 | D_A : D_Arr := (others => (Text => S_Init, I => 2)); -- FLAG
9+ p.adb:28 :22: rule violation: possible occurrence of KP S814-034
10+ 28 | D_A : D_Arr := (others => (Text => S_Init, I => 2)); -- FLAG
1111 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212
13- p.adb:28 :6: rule violation: possible occurrence of KP S814-034
14- 28 | (3 => (Text => "INVALID "), others => (Text => "OTHERS ")); -- FLAG
13+ p.adb:32 :6: rule violation: possible occurrence of KP S814-034
14+ 32 | (3 => (Text => "INVALID "), others => (Text => "OTHERS ")); -- FLAG
1515 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1616
You can’t perform that action at this time.
0 commit comments