Skip to content

Commit

Permalink
Merge branch 'topic/1083' into 'master'
Browse files Browse the repository at this point in the history
Support get_primitives on TaskTypeDecl

Closes #1083

See merge request eng/libadalang/libadalang!1446
  • Loading branch information
thvnx committed Dec 11, 2023
2 parents 709e248 + f5e0cbd commit 5871e0b
Show file tree
Hide file tree
Showing 8 changed files with 379 additions and 264 deletions.
536 changes: 273 additions & 263 deletions ada/ast.py

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions testsuite/tests/name_resolution/task_primitive/ptask.adb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
procedure Ptask is
package Pkg is
task type Parent is
entry E (I : in out Integer);
end Parent;

function Id (X : Parent) return Integer;
end Pkg;

use Pkg;

type T is new Parent;

X : T;

package body Pkg is
task body Parent is
begin
null;
end Parent;

function Id (X : Parent) return Integer is (4);
end pkg;

I : Integer := 8;
begin
I := Id (X);
pragma Test_Statement;
end Ptask;
25 changes: 25 additions & 0 deletions testsuite/tests/name_resolution/task_primitive/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Analyzing ptask.adb
###################

Resolving xrefs for node <AssignStmt ptask.adb:27:4-27:16>
**********************************************************

Expr: <Id "I" ptask.adb:27:4-27:5>
references: <DefiningName "I" ptask.adb:25:4-25:5>
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54>
expected type: None
Expr: <CallExpr ptask.adb:27:9-27:15>
references: <DefiningName "Id" ptask.adb:7:16-7:18>
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54>
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54>
Expr: <Id "Id" ptask.adb:27:9-27:11>
references: <DefiningName "Id" ptask.adb:7:16-7:18>
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54>
expected type: None
Expr: <Id "X" ptask.adb:27:13-27:14>
references: <DefiningName "X" ptask.adb:14:4-14:5>
type: <ConcreteTypeDecl ["T"] ptask.adb:12:4-12:25>
expected type: <ConcreteTypeDecl ["T"] ptask.adb:12:4-12:25>


Done.
2 changes: 2 additions & 0 deletions testsuite/tests/name_resolution/task_primitive/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
driver: name-resolution
input_sources: [ptask.adb]
29 changes: 29 additions & 0 deletions testsuite/tests/properties/get_primitives/ptask.adb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
procedure Ptask is
package Pkg is
task type Parent is
entry E (I : in out Integer);
end Parent;
--% node.p_get_primitives()

function Id (X : Parent) return Integer;
end Pkg;

use Pkg;

type T is new Parent;
--% node.p_get_primitives()

X : T;

package body Pkg is
task body Parent is
begin
null;
end Parent;

function Id (X : Parent) return Integer is (4);
end pkg;

begin
null;
end Ptask;
12 changes: 12 additions & 0 deletions testsuite/tests/properties/get_primitives/test.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
Working on node <TaskTypeDecl ["Parent"] ptask.adb:3:7-5:18>
============================================================

Eval 'node.p_get_primitives()'
Result: [<SubpDecl ["Id"] ptask.adb:8:7-8:47>]

Working on node <ConcreteTypeDecl ["T"] ptask.adb:13:4-13:25>
=============================================================

Eval 'node.p_get_primitives()'
Result: [<SubpDecl ["Id"] ptask.adb:8:7-8:47>]

Working on node <ConcreteTypeDecl ["I_5_7"] test.adb:19:4-19:42>
================================================================

Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/properties/get_primitives/test.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
driver: inline-playground
input_sources: [test.adb]
input_sources: [test.adb, ptask.adb]
8 changes: 8 additions & 0 deletions user_manual/changes/libadalang/1083.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
type: api-change
title: Move P_Get_Primitives from Type_Decl to Base_Type_Decl
short_title: Move P_Get_Primitives in Base_Type_Decl
description: |
This change moves the `P_Get_Primitives` from the `Ada_Type_Decl` type to
the `Ada_Base_Type_Decl` type. This allows to call `P_Get_Primitives` on
the `Ada_Task_Type_Decl` type for example.
date: 2023-10-26

0 comments on commit 5871e0b

Please sign in to comment.