Skip to content

Commit

Permalink
Merge branch 'topic/1166' into 'master'
Browse files Browse the repository at this point in the history
Fix accept statement xref_equation

Closes #1166

See merge request eng/libadalang/libadalang!1488
  • Loading branch information
thvnx committed Dec 6, 2023
2 parents c42c3e4 + 6dd4655 commit d65d56b
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ada/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -22398,7 +22398,13 @@ def xref_equation():
return And(
Bind(Self.body_decl.name.ref_var, Entity.designated_entry),
Entity.entry_index_expr.then(
lambda e: e.sub_equation,
lambda e:
# :rmlink:`9.5.2`: The expected type for entry_index_expr is
# that of the type defined by the definition of the
# corresponding entry declaration.
Bind(e.expected_type_var,
Entity.designated_entry.family_type)
& e.sub_equation,
default_val=LogicTrue()
)
)
Expand Down
15 changes: 15 additions & 0 deletions testsuite/tests/name_resolution/accept_stmt/test.adb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
procedure Test is
task t is
entry ent1 (character);
end t;

task body t is
begin
accept ent1 ('c') do
null;
end;
pragma Test_Statement;
end t;
begin
null;
end Test;
13 changes: 13 additions & 0 deletions testsuite/tests/name_resolution/accept_stmt/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Analyzing test.adb
##################

Resolving xrefs for node <AcceptStmtWithStmts test.adb:8:7-10:11>
*****************************************************************

Expr: <Chr "'c'" test.adb:8:20-8:23>
references: <SyntheticDefiningName "'c'" __standard:21:3-21:27>
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27>
expected type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27>


Done.
2 changes: 2 additions & 0 deletions testsuite/tests/name_resolution/accept_stmt/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
driver: name-resolution
input_sources: [test.adb]

0 comments on commit d65d56b

Please sign in to comment.