-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use p_get_aspect in p_iterable_cursor_type
This change makes `p_iterable_cursor_type` use `p_get_aspect` to check out if the `Iterable` aspect is defined for the entity being check. Since aspects can be set on any part of the entity, and that they can be inherited, `p_iterable_cursor_type` should use `p_get_aspect` instead of simply call `p_get_aspect_spec_expr`.
- Loading branch information
1 parent
c5ec240
commit 73694db
Showing
4 changed files
with
105 additions
and
2 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
53 changes: 53 additions & 0 deletions
53
testsuite/tests/name_resolution/iterable_aspect/private_view.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,53 @@ | ||
procedure Private_View is | ||
package P is | ||
type Sequence is private with | ||
Iterable => (First => Iter_First, | ||
Has_Element => Iter_Has_Element, | ||
Next => Iter_Next); | ||
|
||
function Iter_First (Container : Sequence) return Integer; | ||
function Iter_Has_Element | ||
(Container : Sequence; | ||
Position : Integer) return Boolean; | ||
function Iter_Next | ||
(Container : Sequence; | ||
Position : Integer) return Integer; | ||
private | ||
|
||
type Sequence is record | ||
Content : String (1 .. 10); | ||
end record; | ||
|
||
function Iter_First (Container : Sequence) return Integer is | ||
(Container.Content'First); | ||
function Iter_Has_Element | ||
(Container : Sequence; | ||
Position : Integer) return Boolean is | ||
(Position < Container.Content'Last); | ||
function Iter_Next | ||
(Container : Sequence; | ||
Position : Integer) return Integer is (Position + 1); | ||
end P; | ||
|
||
package body P is | ||
function Ident (I : Integer) return Boolean is (True); | ||
|
||
-- Below, Sequence refers to the private view of Sequence, which has no | ||
-- aspect Iterable. `p_iterable_cursor_type` should also look for the | ||
-- Iterable aspect on the public part too. | ||
function "<" (Left : Sequence; Right : Sequence) return Boolean is | ||
(for all N in Left => Ident (N)); | ||
pragma Test_Statement; | ||
|
||
type New_Sequence is new Sequence; | ||
|
||
-- Below, New_Sequence refers to the type declared above, inheriting the | ||
-- Iterable aspect from Sequence. `p_iterable_cursor_type` should also | ||
-- look for the Iterable aspect on the parent types. | ||
function "<" (Left : New_Sequence; Right : New_Sequence) return Boolean | ||
is (for all N in Left => Ident (N)); | ||
pragma Test_Statement; | ||
end P; | ||
begin | ||
null; | ||
end Private_View; |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
driver: name-resolution | ||
input_sources: [test.adb] | ||
input_sources: [test.adb, private_view.adb] |