-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'mr/backport/release-24.2-issue-eng/ide/libadalang-tools…
…_145' into '24.2' [24.2] Backport of eng/ide/libadalang-tools#145 See merge request eng/ide/libadalang-tools!210
- Loading branch information
Showing
9 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
project generics is | ||
end generics; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
with Instantiations; | ||
package Importing is | ||
function One return Integer is (1); | ||
end Importing; |
8 changes: 8 additions & 0 deletions
8
testsuite/tests/test/private_instantiation/instantiations.adb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package body Instantiations is | ||
|
||
procedure Do_Stuff (X : in out Sort_String_3.Array_To_Sort); | ||
begin | ||
null; | ||
end Do_Stuff; | ||
|
||
end Instantiations; |
17 changes: 17 additions & 0 deletions
17
testsuite/tests/test/private_instantiation/instantiations.ads
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
with Sorting_Algorithms; | ||
package Instantiations is | ||
|
||
package Sort_Integers is new Sorting_Algorithms (5, Integer); | ||
|
||
procedure Need_Body (X : in out Integer); | ||
|
||
private | ||
|
||
type String_3 is new String (1 .. 3); | ||
|
||
package Sort_String_3 is new Sorting_Algorithms (3, String_3); | ||
use type Sort_String_3.Array_To_Sort; | ||
|
||
procedure Do_Stuff (X : in out Sort_String_3.Array_To_Sort); | ||
|
||
end Instantiations; |
49 changes: 49 additions & 0 deletions
49
testsuite/tests/test/private_instantiation/sorting_algorithms.adb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package body Sorting_Algorithms is | ||
|
||
procedure Swap (L, R : in out Element_Type); | ||
|
||
procedure Swap (L, R : in out Element_Type) is | ||
X : Element_Type; | ||
begin | ||
X := L; | ||
L := R; | ||
R := X; | ||
end Swap; | ||
|
||
procedure Selection_Sort (X : in out Array_To_Sort) is | ||
Min_Index : Natural; | ||
begin | ||
for I in X'First .. X'Last - 1 loop | ||
|
||
Min_Index := I; | ||
|
||
for J in I + 1 .. X'Last loop | ||
-- if X (J) < X (I) then | ||
if X (J) < X (Min_Index) then | ||
Min_Index := J; | ||
end if; | ||
end loop; | ||
|
||
if I /= Min_Index then | ||
Swap (X (I), X (Min_Index)); | ||
end if; | ||
|
||
end loop; | ||
end Selection_Sort; | ||
|
||
procedure Bubble_Sort (X : in out Array_To_Sort) is | ||
Swapped : Boolean; | ||
begin | ||
for I in X'First .. X'Last - 1 loop | ||
Swapped := False; | ||
for J in X'First .. X'Last - 1 loop | ||
if X (J + 1) < X (j) then | ||
Swap (X (J), X (J + 1)); | ||
Swapped := True; | ||
end if; | ||
end loop; | ||
exit when not Swapped; | ||
end loop; | ||
end Bubble_Sort; | ||
|
||
end Sorting_Algorithms; |
13 changes: 13 additions & 0 deletions
13
testsuite/tests/test/private_instantiation/sorting_algorithms.ads
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
generic | ||
Length : Positive; | ||
type Element_Type is private; | ||
with function "<" (L, R : Element_Type) return Boolean is <>; | ||
package Sorting_Algorithms is | ||
|
||
type Array_To_Sort is array (1 .. Length) of Element_Type; | ||
|
||
procedure Selection_Sort (X : in out Array_To_Sort); | ||
|
||
procedure Bubble_Sort (X : in out Array_To_Sort); | ||
|
||
end Sorting_Algorithms; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
gnattest -q -P generics.gpr --stub importing.ads | ||
gprbuild -q -P gnattest_stub/harness/test_drivers.gpr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
description: | ||
Test checking that parameter type that comes from | ||
a generic package instantiated in private part | ||
are properly ignored and not put into setter. | ||
|
||
driver: shell_script | ||
|