-
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.
Merge branch 'topic/1404' into 'master'
Add user-defined indexing support for ClasswideTypeDecl See merge request eng/libadalang/libadalang!1701
- Loading branch information
Showing
4 changed files
with
70 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,35 @@ | ||
procedure Test is | ||
package String_Vector is | ||
type Virtual_String_Vector is tagged private with | ||
Constant_Indexing => Element; | ||
|
||
function Element | ||
(Self : Virtual_String_Vector'Class; | ||
Index : Positive) return Character; | ||
private | ||
type Virtual_String_Vector is tagged record | ||
Data : Character; | ||
end record; | ||
end String_Vector; | ||
|
||
package body String_Vector is | ||
function Element | ||
(Self : Virtual_String_Vector'Class; | ||
Index : Positive) return Character is | ||
begin | ||
return 'x'; | ||
end; | ||
end String_Vector; | ||
|
||
use String_Vector; | ||
|
||
|
||
procedure P (X : Virtual_String_Vector'Class) is | ||
C : Character; | ||
begin | ||
C := X (1); | ||
pragma Test_Statement; | ||
end P; | ||
begin | ||
null; | ||
end; |
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,25 @@ | ||
Analyzing test.adb | ||
################## | ||
|
||
Resolving xrefs for node <AssignStmt test.adb:30:7-30:18> | ||
********************************************************* | ||
|
||
Expr: <Id "C" test.adb:30:7-30:8> | ||
references: <DefiningName "C" test.adb:28:7-28:8> | ||
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
expected type: None | ||
Expr: <CallExpr test.adb:30:12-30:17> | ||
references: <DefiningName "X" test.adb:27:17-27:18> | ||
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
expected type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
Expr: <Id "X" test.adb:30:12-30:13> | ||
references: <DefiningName "X" test.adb:27:17-27:18> | ||
type: <ClasswideTypeDecl ["Virtual_String_Vector"] test.adb:3:7-4:39> | ||
expected type: None | ||
Expr: <Int test.adb:30:15-30:16> | ||
references: None | ||
type: <ConcreteTypeDecl ["Universal_Int_Type_"] __standard:116:3-116:45> | ||
expected type: <SubtypeDecl ["Positive"] __standard:6:3-6:57> | ||
|
||
|
||
Done. |
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 @@ | ||
driver: name-resolution | ||
input_sources: [test.adb] |