Formatting of `for T : Type of Container loop` disagrees with GNAT warning
Open
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 results in this:
function FNV_1A (S : String) return String_Hash is
begin
return Value : String_Hash := 14_695_981_039_346_656_037 do
for C:Character of S loop
Value := Value xor Character'Pos (C);
Value := Value * 1099511628211;
end loop;
end return;
end FNV_1A;
This triggers a GNAT warning: (style) space required [-gnatyt] between the C and : of the for loop.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the formatting shown for the Ada for C:Character of S loop example in VS Code and compare it with the GNAT style warning. Trace the formatting behavior in gnatformat and make the output include the required spacing between C and :. Confirm that the formatted loop no longer triggers this 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