Skip to content

Commit

Permalink
Merge branch 'topic/fix_no_inherited_pre' into 'master'
Browse files Browse the repository at this point in the history
Add a testcase for private overrides in "No_Inherited_Classwide_Pre"

Closes #375

See merge request eng/libadalang/langkit-query-language!319
  • Loading branch information
HugoGGuerrier committed Nov 4, 2024
2 parents 5075ab5 + a12701b commit de5959c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 6 additions & 3 deletions testsuite/tests/checks/no_inherited_classwide_pre/class.ads
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ package Class is
type T is tagged private;

type NT1 is new T and Int with private;
function Test (X : NT1) return Boolean; -- FLAG
procedure Proc (X : in out NT1); -- NOFLAG
function Test (X : NT1) return Boolean; -- FLAG
procedure Proc (X : in out NT1); -- NOFLAG

type NT2 is new T and Int1 with private;
procedure Proc (X : in out NT2); -- FLAG
procedure Proc (X : in out NT2); -- FLAG

private
type T is tagged record
Expand All @@ -24,4 +24,7 @@ private
type NT1 is new T and Int with null record;
type NT2 is new T and Int1 with null record;

type PT is new T and Int1 with null record;
procedure Proc (X : in out PT) is null; -- FLAG

end Class;
8 changes: 6 additions & 2 deletions testsuite/tests/checks/no_inherited_classwide_pre/test.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ class.adb:15:14: rule violation: overriding operation that does not inherit Pre'
| ^^^^

class.ads:13:13: rule violation: overriding operation that does not inherit Pre'Class (class.ads:4:4)
13 | function Test (X : NT1) return Boolean; -- FLAG
13 | function Test (X : NT1) return Boolean; -- FLAG
| ^^^^

class.ads:17:14: rule violation: overriding operation that does not inherit Pre'Class (class.ads:8:4)
17 | procedure Proc (X : in out NT2); -- FLAG
17 | procedure Proc (X : in out NT2); -- FLAG
| ^^^^

class.ads:28:14: rule violation: overriding operation that does not inherit Pre'Class (class.ads:8:4)
28 | procedure Proc (X : in out PT) is null; -- FLAG
| ^^^^

0 comments on commit de5959c

Please sign in to comment.