Skip to content

Commit

Permalink
Merge branch 'topic/1151' into 'master'
Browse files Browse the repository at this point in the history
Fix is_task_type for derived types and subtypes

Closes #1151

See merge request eng/libadalang/libadalang!1474
  • Loading branch information
thvnx committed Nov 27, 2023
2 parents 8eac42d + 40665ee commit 1b7b627
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 2 deletions.
4 changes: 3 additions & 1 deletion ada/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -4882,7 +4882,7 @@ def is_tagged_type():
"""
return False

is_task_type = Property(False)
is_task_type = Property(False, dynamic_vars=[default_origin()])

is_limited_type = Property(False)

Expand Down Expand Up @@ -8878,6 +8878,7 @@ class DerivedTypeDef(TypeDef):
Entity.interfaces.map(lambda i: i.name_designated_type)
)

is_task_type = Property(Entity.base_type.is_task_type)
is_int_type = Property(Entity.base_type.is_int_type)
is_access_type = Property(Self.as_bare_entity.base_type.is_access_type)
is_char_type = Property(Entity.base_type.is_char_type)
Expand Down Expand Up @@ -9310,6 +9311,7 @@ def get_type():
canonical_type = Property(Entity.get_type.canonical_type)
record_def = Property(Entity.get_type.record_def)
accessed_type = Property(Entity.get_type.accessed_type)
is_task_type = Property(Entity.get_type.is_task_type)
is_int_type = Property(Entity.get_type.is_int_type)
is_discrete_type = Property(Entity.get_type.is_discrete_type)

Expand Down
27 changes: 27 additions & 0 deletions testsuite/tests/name_resolution/abort_stmt/derived.adb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
procedure Derived is
task type T is
end T;

task body T is
begin
null;
end T;

subtype ST is T;
type NT is new T;

procedure Kill (X : ST) is
begin
abort X;
pragma Test_Statement;
end Kill;

procedure Kill (X : NT) is
begin
abort X;
pragma Test_Statement;
end Kill;

begin
null;
end Derived;
20 changes: 20 additions & 0 deletions testsuite/tests/name_resolution/abort_stmt/test.out
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,24 @@ Expr: <Id "T2" testabort.adb:38:10-38:12>
expected type: None


Analyzing derived.adb
#####################

Resolving xrefs for node <AbortStmt derived.adb:15:7-15:15>
***********************************************************

Expr: <Id "X" derived.adb:15:13-15:14>
references: <DefiningName "X" derived.adb:13:20-13:21>
type: <SubtypeDecl ["ST"] derived.adb:10:4-10:20>
expected type: None

Resolving xrefs for node <AbortStmt derived.adb:21:7-21:15>
***********************************************************

Expr: <Id "X" derived.adb:21:13-21:14>
references: <DefiningName "X" derived.adb:19:20-19:21>
type: <ConcreteTypeDecl ["NT"] derived.adb:11:4-11:21>
expected type: None


Done.
2 changes: 1 addition & 1 deletion testsuite/tests/name_resolution/abort_stmt/test.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
driver: name-resolution
input_sources: [testabort.adb]
input_sources: [testabort.adb, derived.adb]

0 comments on commit 1b7b627

Please sign in to comment.