-
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/1034' into 'master'
Fixed lower bounds for array types and subtypes (gnatX) Closes #1034 See merge request eng/libadalang/libadalang!1456
- Loading branch information
Showing
7 changed files
with
311 additions
and
13 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
40 changes: 40 additions & 0 deletions
40
testsuite/tests/name_resolution/fixed_lower_bound/test.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,40 @@ | ||
-- Check that the following experimental GNAT feature: | ||
-- Fixed lower bounds for array types and subtypes | ||
-- is correctly supported. | ||
|
||
-- https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-fixed-lower-bound.rst | ||
pragma Extensions_Allowed (On); | ||
|
||
procedure Test is | ||
type A is array (Integer range 1 .. <>) of Integer; | ||
pragma Test_Block; | ||
|
||
type String_1 is array (Positive range 1 .. <>) of Character; | ||
pragma Test_Block; | ||
|
||
subtype Fixed_String is String (1 .. <>); | ||
pragma Test_Statement; | ||
|
||
subtype Fixed_String_2 is String (Integer range 1 .. <>); | ||
pragma Test_Statement; | ||
|
||
type Int_Matrix_1 is array (Positive range 1 .. <>, | ||
Positive range <>) of Integer; | ||
pragma Test_Block; | ||
type Int_Matrix_2 is array (Positive range <>, | ||
Positive range 1 .. <>) of Integer; | ||
pragma Test_Block; | ||
type Int_Matrix_3 is array (Positive range 1 .. <>, | ||
Positive range 1 .. <>) of Integer; | ||
pragma Test_Block; | ||
|
||
type Matrix is array (Positive range <>, Positive range <>) of Integer; | ||
pragma Test_Block; | ||
|
||
subtype SMatrix is Matrix (2 .. <>, 2 .. <>); | ||
pragma Test_Statement; | ||
subtype SMatrix2 is Matrix (Integer range 2 .. <>, Integer range 2 .. <>); | ||
pragma Test_Statement; | ||
begin | ||
null; | ||
end Test; |
245 changes: 245 additions & 0 deletions
245
testsuite/tests/name_resolution/fixed_lower_bound/test.out
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,245 @@ | ||
Analyzing test.adb | ||
################## | ||
|
||
Resolving xrefs for node <ArrayTypeDef test.adb:9:14-9:54> | ||
********************************************************** | ||
|
||
Expr: <Id "Integer" test.adb:9:21-9:28> | ||
references: <DefiningName "Integer" __standard:4:8-4:15> | ||
type: None | ||
expected type: None | ||
Expr: <Int test.adb:9:35-9:36> | ||
references: None | ||
type: <ConcreteTypeDecl ["Universal_Int_Type_"] __standard:116:3-116:45> | ||
expected type: None | ||
Expr: <Id "Integer" test.adb:9:47-9:54> | ||
references: <DefiningName "Integer" __standard:4:8-4:15> | ||
type: None | ||
expected type: None | ||
|
||
Resolving xrefs for node <ArrayTypeDef test.adb:12:21-12:64> | ||
************************************************************ | ||
|
||
Expr: <Id "Positive" test.adb:12:28-12:36> | ||
references: <DefiningName "Positive" __standard:6:11-6:19> | ||
type: None | ||
expected type: None | ||
Expr: <Int test.adb:12:43-12:44> | ||
references: None | ||
type: <ConcreteTypeDecl ["Universal_Int_Type_"] __standard:116:3-116:45> | ||
expected type: None | ||
Expr: <Id "Character" test.adb:12:55-12:64> | ||
references: <DefiningName "Character" __standard:21:8-21:17> | ||
type: None | ||
expected type: None | ||
|
||
Resolving xrefs for node <SubtypeDecl ["Fixed_String"] test.adb:15:4-15:45> | ||
*************************************************************************** | ||
|
||
Expr: <Id "String" test.adb:15:28-15:34> | ||
references: <DefiningName "String" __standard:105:8-105:14> | ||
type: None | ||
expected type: None | ||
Expr: <BinOp test.adb:15:36-15:43> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <Int test.adb:15:36-15:37> | ||
references: None | ||
type: <ConcreteTypeDecl ["Universal_Int_Type_"] __standard:116:3-116:45> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <OpDoubleDot ".." test.adb:15:38-15:40> | ||
references: None | ||
type: None | ||
expected type: None | ||
Expr: <BoxExpr test.adb:15:41-15:43> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
|
||
Resolving xrefs for node <SubtypeDecl ["Fixed_String_2"] test.adb:18:4-18:61> | ||
***************************************************************************** | ||
|
||
Expr: <Id "String" test.adb:18:30-18:36> | ||
references: <DefiningName "String" __standard:105:8-105:14> | ||
type: None | ||
expected type: None | ||
Expr: <Id "Integer" test.adb:18:38-18:45> | ||
references: <DefiningName "Integer" __standard:4:8-4:15> | ||
type: None | ||
expected type: None | ||
Expr: <BinOp test.adb:18:52-18:59> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <Int test.adb:18:52-18:53> | ||
references: None | ||
type: <ConcreteTypeDecl ["Universal_Int_Type_"] __standard:116:3-116:45> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <OpDoubleDot ".." test.adb:18:54-18:56> | ||
references: None | ||
type: None | ||
expected type: None | ||
Expr: <BoxExpr test.adb:18:57-18:59> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
|
||
Resolving xrefs for node <ArrayTypeDef test.adb:21:25-22:61> | ||
************************************************************ | ||
|
||
Expr: <Id "Positive" test.adb:21:32-21:40> | ||
references: <DefiningName "Positive" __standard:6:11-6:19> | ||
type: None | ||
expected type: None | ||
Expr: <Int test.adb:21:47-21:48> | ||
references: None | ||
type: <ConcreteTypeDecl ["Universal_Int_Type_"] __standard:116:3-116:45> | ||
expected type: None | ||
Expr: <Id "Positive" test.adb:22:32-22:40> | ||
references: <DefiningName "Positive" __standard:6:11-6:19> | ||
type: None | ||
expected type: None | ||
Expr: <Id "Integer" test.adb:22:54-22:61> | ||
references: <DefiningName "Integer" __standard:4:8-4:15> | ||
type: None | ||
expected type: None | ||
|
||
Resolving xrefs for node <ArrayTypeDef test.adb:24:25-25:66> | ||
************************************************************ | ||
|
||
Expr: <Id "Positive" test.adb:24:32-24:40> | ||
references: <DefiningName "Positive" __standard:6:11-6:19> | ||
type: None | ||
expected type: None | ||
Expr: <Id "Positive" test.adb:25:32-25:40> | ||
references: <DefiningName "Positive" __standard:6:11-6:19> | ||
type: None | ||
expected type: None | ||
Expr: <Int test.adb:25:47-25:48> | ||
references: None | ||
type: <ConcreteTypeDecl ["Universal_Int_Type_"] __standard:116:3-116:45> | ||
expected type: None | ||
Expr: <Id "Integer" test.adb:25:59-25:66> | ||
references: <DefiningName "Integer" __standard:4:8-4:15> | ||
type: None | ||
expected type: None | ||
|
||
Resolving xrefs for node <ArrayTypeDef test.adb:27:25-28:66> | ||
************************************************************ | ||
|
||
Expr: <Id "Positive" test.adb:27:32-27:40> | ||
references: <DefiningName "Positive" __standard:6:11-6:19> | ||
type: None | ||
expected type: None | ||
Expr: <Int test.adb:27:47-27:48> | ||
references: None | ||
type: <ConcreteTypeDecl ["Universal_Int_Type_"] __standard:116:3-116:45> | ||
expected type: None | ||
Expr: <Id "Positive" test.adb:28:32-28:40> | ||
references: <DefiningName "Positive" __standard:6:11-6:19> | ||
type: None | ||
expected type: None | ||
Expr: <Int test.adb:28:47-28:48> | ||
references: None | ||
type: <ConcreteTypeDecl ["Universal_Int_Type_"] __standard:116:3-116:45> | ||
expected type: None | ||
Expr: <Id "Integer" test.adb:28:59-28:66> | ||
references: <DefiningName "Integer" __standard:4:8-4:15> | ||
type: None | ||
expected type: None | ||
|
||
Resolving xrefs for node <ArrayTypeDef test.adb:31:19-31:74> | ||
************************************************************ | ||
|
||
Expr: <Id "Positive" test.adb:31:26-31:34> | ||
references: <DefiningName "Positive" __standard:6:11-6:19> | ||
type: None | ||
expected type: None | ||
Expr: <Id "Positive" test.adb:31:45-31:53> | ||
references: <DefiningName "Positive" __standard:6:11-6:19> | ||
type: None | ||
expected type: None | ||
Expr: <Id "Integer" test.adb:31:67-31:74> | ||
references: <DefiningName "Integer" __standard:4:8-4:15> | ||
type: None | ||
expected type: None | ||
|
||
Resolving xrefs for node <SubtypeDecl ["SMatrix"] test.adb:34:4-34:49> | ||
********************************************************************** | ||
|
||
Expr: <Id "Matrix" test.adb:34:23-34:29> | ||
references: <DefiningName "Matrix" test.adb:31:9-31:15> | ||
type: None | ||
expected type: None | ||
Expr: <BinOp test.adb:34:31-34:38> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <Int test.adb:34:31-34:32> | ||
references: None | ||
type: <ConcreteTypeDecl ["Universal_Int_Type_"] __standard:116:3-116:45> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <OpDoubleDot ".." test.adb:34:33-34:35> | ||
references: None | ||
type: None | ||
expected type: None | ||
Expr: <BoxExpr test.adb:34:36-34:38> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <BinOp test.adb:34:40-34:47> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <Int test.adb:34:40-34:41> | ||
references: None | ||
type: <ConcreteTypeDecl ["Universal_Int_Type_"] __standard:116:3-116:45> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <OpDoubleDot ".." test.adb:34:42-34:44> | ||
references: None | ||
type: None | ||
expected type: None | ||
Expr: <BoxExpr test.adb:34:45-34:47> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
|
||
Resolving xrefs for node <SubtypeDecl ["SMatrix2"] test.adb:36:4-36:78> | ||
*********************************************************************** | ||
|
||
Expr: <Id "Matrix" test.adb:36:24-36:30> | ||
references: <DefiningName "Matrix" test.adb:31:9-31:15> | ||
type: None | ||
expected type: None | ||
Expr: <Id "Integer" test.adb:36:32-36:39> | ||
references: <DefiningName "Integer" __standard:4:8-4:15> | ||
type: None | ||
expected type: None | ||
Expr: <BinOp test.adb:36:46-36:53> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <Int test.adb:36:46-36:47> | ||
references: None | ||
type: <ConcreteTypeDecl ["Universal_Int_Type_"] __standard:116:3-116:45> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <OpDoubleDot ".." test.adb:36:48-36:50> | ||
references: None | ||
type: None | ||
expected type: None | ||
Expr: <BoxExpr test.adb:36:51-36:53> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <Id "Integer" test.adb:36:55-36:62> | ||
references: <DefiningName "Integer" __standard:4:8-4:15> | ||
type: None | ||
expected type: None | ||
Expr: <BinOp test.adb:36:69-36:76> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <Int test.adb:36:69-36:70> | ||
references: None | ||
type: <ConcreteTypeDecl ["Universal_Int_Type_"] __standard:116:3-116:45> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <OpDoubleDot ".." test.adb:36:71-36:73> | ||
references: None | ||
type: None | ||
expected type: None | ||
Expr: <BoxExpr test.adb:36:74-36:76> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
|
||
|
||
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] |
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,6 @@ | ||
type: new-feature | ||
title: Fixed lower bounds for array types and subtypes | ||
description: | | ||
This change adds support for the GNAT experimental feature allowing fixed | ||
lower bounds for array types and subtypes. | ||
date: 2023-11-07 |