-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Description
I have encountered an issue where gnatformat incorrectly removes the whitespace between an Ada attribute (such as 'Length) and its argument list (the opening parenthesis).
While the formatter correctly handles the insertion of spaces before parentheses in other contexts (e.g., function calls), it seems to force the removal of the space when applied to attributes.
Steps to Reproduce
- Create a file with the following code (note the space between
'Lengthand(1)):
function Count_Pieces (Board : Board_Type; State : Square_State_Type) return Natural
with Ghost, Post => Count_Pieces'Result <= Board'Length (1) * Board'Length (2);- Run
gnatformaton this file.
Actual Behavior
The formatter removes the spaces, resulting in:
function Count_Pieces (Board : Board_Type; State : Square_State_Type) return Natural
with Ghost, Post => Count_Pieces'Result <= Board'Length(1) * Board'Length(2);Expected Behavior
The formatter should preserve (or insert) the space before the opening parenthesis to maintain consistency with the rest of the code style, looking like this:
function Count_Pieces (Board : Board_Type; State : Square_State_Type) return Natural
with Ghost, Post => Count_Pieces'Result <= Board'Length (1) * Board'Length (2);Additional Context
This issue seems specific to attributes. In other scenarios, the rule regarding "space before parenthesis" appears to be applied correctly.
Metadata
Metadata
Assignees
Labels
No labels