From 83cb99141594c018066c9218d9cf7fed84677990 Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Tue, 16 Jul 2024 10:40:28 +0000 Subject: [PATCH] properties/complete: be resilient with incomplete lists Rework a couple of checks so that we do not assume that, for invalid source code, trailing list separators are included in the range of tokens for their list node. when M | -- '|' may not be part of the AlternativesList node for this -- CaseStmtAlternative node, so "node" may be the -- CaseStmtAlternative node here. procedure P (D: B; -- ';' may not be part of the ParamSpecList node, so "node" may -- be the Id node for 'B'. --- testsuite/tests/properties/complete/case.adb | 2 +- .../tests/properties/complete/subtype_indication.adb | 4 ++-- testsuite/tests/properties/complete/test.out | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/testsuite/tests/properties/complete/case.adb b/testsuite/tests/properties/complete/case.adb index 25faa8e35..82ab57a37 100644 --- a/testsuite/tests/properties/complete/case.adb +++ b/testsuite/tests/properties/complete/case.adb @@ -21,8 +21,8 @@ procedure Pcase is begin case D is when M | - --% list(node.p_complete) end case; + --% list(node.f_alternatives[0].f_choices.p_complete) end P3; procedure P4 (D : Week) is diff --git a/testsuite/tests/properties/complete/subtype_indication.adb b/testsuite/tests/properties/complete/subtype_indication.adb index e15d613e8..f91493222 100644 --- a/testsuite/tests/properties/complete/subtype_indication.adb +++ b/testsuite/tests/properties/complete/subtype_indication.adb @@ -27,8 +27,8 @@ procedure Subtype_Indication is F : Ba; --% list(node.f_type_expr.f_name.p_complete) - procedure P (D: B; - --% list(node[0].f_type_expr.f_name.p_complete) + procedure P (D: B + --% list(node.p_complete) type T is record A : B; diff --git a/testsuite/tests/properties/complete/test.out b/testsuite/tests/properties/complete/test.out index 9672e66b8..bc255b8a3 100644 --- a/testsuite/tests/properties/complete/test.out +++ b/testsuite/tests/properties/complete/test.out @@ -110,10 +110,10 @@ Result: [ is_dot_call is_dot_call=False is_visible=True weight=0>, is_dot_call=False is_visible=True weight=0>] -Working on node -======================================================= +Working on node +============================================= -Eval 'list(node.p_complete)' +Eval 'list(node.f_alternatives[0].f_choices.p_complete)' Result: [ is_dot_call=False is_visible=True weight=0>, is_dot_call=False is_visible=True weight=100>, is_dot_call=False is_visible=True weight=100>, @@ -943,10 +943,10 @@ Result: [ is_dot_call=False is_visible=True weight=100>, is_dot_call=False is_visible=True weight=50>] -Working on node -================================================================== +Working on node +=========================================================== -Eval 'list(node[0].f_type_expr.f_name.p_complete)' +Eval 'list(node.p_complete)' Result: [ is_dot_call=False is_visible=True weight=0>, is_dot_call=False is_visible=True weight=0>, is_dot_call=False is_visible=True weight=0>,