-
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.
Improve fixed-point subtype constraint definitions resolution
This patch fixes a bug where fixed-point digits and delta constraint xref equations were not sufficiently defined to properly handle some ranges resolution. This patch also adds more constraints in the xref equations to ensure that resolved type are matching expected ones (the new equations have been derived from the `OrdinaryFixedPointDef` one). A small API change is also introduced by this patch. The `digits` field of `DeltaConstraint` has been renamed to `delta`.
- Loading branch information
Showing
7 changed files
with
125 additions
and
14 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
11 changes: 11 additions & 0 deletions
11
testsuite/tests/name_resolution/fixed_point_subtype_constraints/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,11 @@ | ||
procedure Test is | ||
type Fix_Delta is delta 0.5 range -3.0 .. 3.0; | ||
subtype Sub_Delta is Fix_Delta delta 1.0 range 0.0 .. 2.0; | ||
pragma Test_Statement; | ||
|
||
type Fix_Digits is digits 5 range -50.0 .. 50.0; | ||
subtype Sub_Digits is Fix_Digits digits 1 range 0.0 .. 30.0; | ||
pragma Test_Statement; | ||
begin | ||
null; | ||
end Test; |
59 changes: 59 additions & 0 deletions
59
testsuite/tests/name_resolution/fixed_point_subtype_constraints/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,59 @@ | ||
Analyzing test.adb | ||
################## | ||
|
||
Resolving xrefs for node <SubtypeDecl ["Sub_Delta"] test.adb:3:4-3:62> | ||
********************************************************************** | ||
|
||
Expr: <Id "Fix_Delta" test.adb:3:25-3:34> | ||
references: <DefiningName "Fix_Delta" test.adb:2:9-2:18> | ||
type: None | ||
expected type: None | ||
Expr: <Real test.adb:3:41-3:44> | ||
references: None | ||
type: <ConcreteTypeDecl ["Universal_Real_Type_"] __standard:117:3-117:42> | ||
expected type: <ConcreteTypeDecl ["Universal_Real_Type_"] __standard:117:3-117:42> | ||
Expr: <BinOp test.adb:3:51-3:61> | ||
type: <ConcreteTypeDecl ["Universal_Real_Type_"] __standard:117:3-117:42> | ||
expected type: <ConcreteTypeDecl ["Universal_Real_Type_"] __standard:117:3-117:42> | ||
Expr: <Real test.adb:3:51-3:54> | ||
references: None | ||
type: <ConcreteTypeDecl ["Universal_Real_Type_"] __standard:117:3-117:42> | ||
expected type: <ConcreteTypeDecl ["Universal_Real_Type_"] __standard:117:3-117:42> | ||
Expr: <OpDoubleDot ".." test.adb:3:55-3:57> | ||
references: None | ||
type: None | ||
expected type: None | ||
Expr: <Real test.adb:3:58-3:61> | ||
references: None | ||
type: <ConcreteTypeDecl ["Universal_Real_Type_"] __standard:117:3-117:42> | ||
expected type: <ConcreteTypeDecl ["Universal_Real_Type_"] __standard:117:3-117:42> | ||
|
||
Resolving xrefs for node <SubtypeDecl ["Sub_Digits"] test.adb:7:4-7:64> | ||
*********************************************************************** | ||
|
||
Expr: <Id "Fix_Digits" test.adb:7:26-7:36> | ||
references: <DefiningName "Fix_Digits" test.adb:6:9-6:19> | ||
type: None | ||
expected type: None | ||
Expr: <Int test.adb:7:44-7:45> | ||
references: None | ||
type: <ConcreteTypeDecl ["Universal_Int_Type_"] __standard:116:3-116:45> | ||
expected type: <ConcreteTypeDecl ["Universal_Int_Type_"] __standard:116:3-116:45> | ||
Expr: <BinOp test.adb:7:52-7:63> | ||
type: <ConcreteTypeDecl ["Universal_Real_Type_"] __standard:117:3-117:42> | ||
expected type: <ConcreteTypeDecl ["Universal_Real_Type_"] __standard:117:3-117:42> | ||
Expr: <Real test.adb:7:52-7:55> | ||
references: None | ||
type: <ConcreteTypeDecl ["Universal_Real_Type_"] __standard:117:3-117:42> | ||
expected type: <ConcreteTypeDecl ["Universal_Real_Type_"] __standard:117:3-117:42> | ||
Expr: <OpDoubleDot ".." test.adb:7:56-7:58> | ||
references: None | ||
type: None | ||
expected type: None | ||
Expr: <Real test.adb:7:59-7:63> | ||
references: None | ||
type: <ConcreteTypeDecl ["Universal_Real_Type_"] __standard:117:3-117:42> | ||
expected type: <ConcreteTypeDecl ["Universal_Real_Type_"] __standard:117:3-117:42> | ||
|
||
|
||
Done. |
2 changes: 2 additions & 0 deletions
2
testsuite/tests/name_resolution/fixed_point_subtype_constraints/test.yaml
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,7 @@ | ||
type: api-change | ||
title: Rename ``F_Digits`` field of ``Ada_Delta_Constraint`` | ||
description: | | ||
The field `F_Digits` of the node `Ada_Delta_Constraint` has been renamed to | ||
`F_Delta` to correctly match the definition of a delta constraint (which | ||
doesn't specify `digits` but `delta`). | ||
date: 2023-09-20 |