File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed
testsuite/tests/checks/integer_as_enum Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ fun integer_types_as_enum(node) =
7070 |" X := 2;
7171 |" Y := Y + 1;
7272 |" end Proc;
73- node is TypeDecl (p_is_int_type(): true)
73+ node is ConcreteTypeDecl (p_is_int_type(): true)
7474 when not [t for t in types() if t == node]
7575 and not [t for t in instantiations() if t == node]
7676 and not [t for t in arithmetic_ops() if t == node]
Original file line number Diff line number Diff line change 1+ procedure Generics is
2+ generic
3+ type T is range <>; -- NOFLAG
4+ package Pkg is
5+ -- T is never used as an integer type so in theory it could be flagged
6+ -- by this rule. However, we don't want to flag formal types.
7+ type U is range 1 .. 3 ; -- FLAG
8+ -- make sure that concrete type declarations inside generics are still
9+ -- flagged though.
10+ end Pkg ;
11+
12+ package My_Pkg is new Pkg (Integer);
13+ begin
14+ null ;
15+ end Generics ;
Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ bit.adb:2:9: rule violation: integer type may be replaced by an enumeration
222 | type Enum is mod 2 ** 8; -- FLAG
33 | ^^^^
44
5+ generics.adb:7:12: rule violation: integer type may be replaced by an enumeration
6+ 7 | type U is range 1 .. 3; -- FLAG
7+ | ^
8+
59op.adb:2:9: rule violation: integer type may be replaced by an enumeration
6102 | type Enum is range 1 .. 3; -- FLAG
711 | ^^^^
You can’t perform that action at this time.
0 commit comments