AdaCore / AdaCore/gnatformat

Formatting of generic discrete type disagrees with GNAT warning

Open
#4 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ada
Stars
21
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Noticed in this code snippet, autoformat in VS Code (with GNATformat) results in this:

generic
   type My_Enum is(<>);
package Example is
   My_Values : array (My_Enum) of Boolean;
end Example;

GNATformat removed the space between is and (<>) and building with GNAT then gives a (style) space required warning between is and (<>).

This is also duplicated when running GNATformat directly, like with gnatformat --project my_example.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the formatting discrepancy with the generic Ada snippet in the issue, both through VS Code with GNATformat and with gnatformat --project my_example. Trace the formatter’s handling of is (<>);; done means the space is preserved and GNAT no longer reports the (style) space required warning.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.