-
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.
Fix selected components resolution for subprograms
As defined by the ARM in 4.1.3-9.2/3: The prefix (after any implicit dereference) shall resolve to denote an object or value of a specific tagged type T or class-wide type T'Class. The selector_name shall resolve to denote a view of a subprogram declared immediately within the declarative region in which an ancestor of the type T is declared. That means that subprograms can be called with dot notation as long as the first parameter is of the type of the object referenced by the prefix, weither the given subprogram is a primitive or not.
- Loading branch information
Showing
8 changed files
with
224 additions
and
20 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,8 @@ | ||
package Foo is | ||
type Container is tagged null record; | ||
|
||
type T is new Container with null record; | ||
subtype Record_T is T; | ||
|
||
procedure Init (X : access Record_T'Class; Spacing : Integer := 0) is null; | ||
end Foo; |
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,22 @@ | ||
with Foo; use Foo; | ||
|
||
package body Pkg is | ||
|
||
type Slot_Record_T is new Foo.Record_T with record | ||
Dummy : Integer; | ||
end record; | ||
type Slot_T is access all Slot_Record_T; | ||
|
||
type Record_T is tagged record | ||
Slot : Slot_T := null; | ||
end record; | ||
|
||
procedure P (X : access Record_T'Class; B : Boolean := False); | ||
|
||
procedure P (X : access Record_T'Class; B : Boolean := False) is | ||
begin | ||
X.Slot.Init (Spacing => 5); | ||
pragma Test_Statement; | ||
end P; | ||
|
||
end Pkg; |
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,3 @@ | ||
package Pkg is | ||
pragma Elaborate_Body; | ||
end Pkg; |
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,30 @@ | ||
procedure Region is | ||
task T; | ||
|
||
task body T is | ||
type P is tagged null record; | ||
procedure Not_Prim (Self : P) is null; | ||
O : P; | ||
begin | ||
O.Not_Prim; | ||
pragma Test_Statement; | ||
end T; | ||
begin | ||
declare | ||
type P2 is tagged null record; | ||
procedure Not_Prim (Self : P2) is null; | ||
O : P2; | ||
begin | ||
O.Not_Prim; | ||
pragma Test_Statement; | ||
end; | ||
|
||
declare | ||
type P2 is tagged null record; | ||
procedure Not_Prim (Self : P2'Class) is null; | ||
O : P2; | ||
begin | ||
O.Not_Prim; | ||
pragma Test_Statement; | ||
end; | ||
end Region; |
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, test_proc.adb, pkg.adb, region.adb] |
13 changes: 13 additions & 0 deletions
13
testsuite/tests/name_resolution/dottable_subp/test_proc.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,13 @@ | ||
procedure Test_Proc is | ||
type T12 is tagged record I : Integer; end record; | ||
subtype T1 is T12; | ||
|
||
procedure P (A : access T1'Class; B : Boolean := False) is null; | ||
|
||
type T2 is access all T1; | ||
|
||
X : T2 := null; | ||
begin | ||
X.P; | ||
pragma Test_Statement; | ||
end Test_Proc; |