Skip to content

Commit

Permalink
Merge branch 'leo/106-sem_parent_vis' into 'master'
Browse files Browse the repository at this point in the history
TGen: Fix bug in type visibility computation

Closes #106

See merge request eng/ide/libadalang-tools!144
  • Loading branch information
leocreuse committed Sep 19, 2023
2 parents ad5bc10 + 3eac2e0 commit 8b30d8f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
9 changes: 7 additions & 2 deletions src/tgen/tgen-types-translation.adb
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,14 @@ package body TGen.Types.Translation is
Sem_Parent : Ada_Node := First_Part.P_Semantic_Parent;
begin
-- Consider that N is fully private if there is a private part node
-- among the chain of semantic parents of the first part of N.
-- among the chain of semantic parents of the first part of N, until we
-- reach a library level package declaration.

while not Sem_Parent.Is_Null loop
while not Sem_Parent.Is_Null
and then
not (Sem_Parent.Kind in Ada_Package_Decl_Range
and then Sem_Parent.Parent.Kind in Ada_Library_Item_Range)
loop
if Sem_Parent.Kind in Ada_Private_Part_Range then
return True;
end if;
Expand Down
2 changes: 2 additions & 0 deletions testsuite/tests/test/marshalling_full_private/pkg.adb
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ package body Pkg is
null;
end Bar;

procedure Baz (S : UTF_8_Lines) is null;

end Pkg;
3 changes: 3 additions & 0 deletions testsuite/tests/test/marshalling_full_private/pkg.ads
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
with Ada.Strings.Text_Buffers.Utils; use Ada.Strings.Text_Buffers.Utils;

package Pkg is
type P_Type is private;
procedure Foo (P : P_Type);
type A (<>) is private;
procedure Bar (X : A);
procedure Baz (S : UTF_8_Lines);
private
type I_Type is range 0 .. 1;
type P_Type is array (I_Type) of Boolean;
Expand Down
22 changes: 14 additions & 8 deletions testsuite/tests/test/marshalling_full_private/test.out
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
pkg.ads:7:4: info: corresponding test PASSED
pkg.ads:7:4: info: corresponding test PASSED
pkg.ads:7:4: info: corresponding test PASSED
pkg.ads:7:4: info: corresponding test PASSED
pkg.ads:7:4: info: corresponding test PASSED
pkg.ads:8:4: info: corresponding test PASSED
pkg.ads:8:4: info: corresponding test PASSED
pkg.ads:8:4: info: corresponding test PASSED
pkg.ads:8:4: info: corresponding test PASSED
pkg.ads:8:4: info: corresponding test PASSED
pkg.ads:5:4: info: corresponding test PASSED
pkg.ads:5:4: info: corresponding test PASSED
pkg.ads:5:4: info: corresponding test PASSED
pkg.ads:5:4: info: corresponding test PASSED
pkg.ads:5:4: info: corresponding test PASSED
pkg.ads:3:4: info: corresponding test PASSED
pkg.ads:3:4: info: corresponding test PASSED
pkg.ads:3:4: info: corresponding test PASSED
pkg.ads:3:4: info: corresponding test PASSED
pkg.ads:3:4: info: corresponding test PASSED
pkg.ads:3:4: error: corresponding test FAILED: Test not implemented. (pkg-test_data-tests.adb:45)
pkg.ads:5:4: error: corresponding test FAILED: Test not implemented. (pkg-test_data-tests.adb:66)
12 tests run: 10 passed; 2 failed; 0 crashed.
pkg.ads:5:4: error: corresponding test FAILED: Test not implemented. (pkg-test_data-tests.adb:45)
pkg.ads:7:4: error: corresponding test FAILED: Test not implemented. (pkg-test_data-tests.adb:66)
pkg.ads:8:4: error: corresponding test FAILED: Test not implemented. (pkg-test_data-tests.adb:87)
18 tests run: 15 passed; 3 failed; 0 crashed.

0 comments on commit 8b30d8f

Please sign in to comment.