AdaCore / AdaCore/libadalang

Invalid bracket encoding reported when using square brackets around strings

Open
#977 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ada
Stars
171
Forks
48
PR merge metrics
No merged PRs in 30d

Description

Libadalang appears to treat any single string wrapped in square brackets as invalid, reporting "invalid bracket encoding". See the following valid code as an example:

pragma Ada_2022;

with Ada.Containers.Vectors;

procedure Example is
   type String_1 is new String (1 .. 1);

   package String_Vec is new Ada.Containers.Vectors (Positive, String_1);
   package Integer_Vec is new Ada.Containers.Vectors (Positive, Integer);

   V1 : String_Vec.Vector := ["a", "b"];
   V2 : Integer_Vec.Vector := [1];
   V3 : String_Vec.Vector := ["a"]; --  Error here
begin
   null;
end Example;

This has only been tested against the version of libadalang included in ALS 2026.0.202510141.

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

Start by reproducing the provided Ada 2022 example with the libadalang version included in ALS 2026.0.202510141, focusing on the V3 declaration and its reported error. The fix is complete when the valid single-string square-bracket aggregate is accepted without an "invalid bracket encoding" diagnostic.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.