# GNAT 16.1: fully qualified name resolved to the current package when instantiating a generic child — bug?

**URL:** <https://forum.ada-lang.io/t/gnat-16-1-fully-qualified-name-resolved-to-the-current-package-when-instantiating-a-generic-child-bug/4826>\
**Category:** General\
**Created:** [October 14, 2026, 4:38pm UTC](https://forum.ada-lang.io/t/gnat-16-1-fully-qualified-name-resolved-to-the-current-package-when-instantiating-a-generic-child-bug/4826 "2026-10-14T16:38:54Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![LionelDraghi](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/lioneldraghi/32/416_2.png) [@LionelDraghi](https://forum.ada-lang.io/u/LionelDraghi)\
**Post date:** [October 14, 2026, 4:38pm UTC](https://forum.ada-lang.io/t/gnat-16-1-fully-qualified-name-resolved-to-the-current-package-when-instantiating-a-generic-child-bug/4826/1 "2026-10-14T16:38:55Z")

</div>

Building OpenToken-based ArchiCheck with the freshly released GNAT 16.1.0 (via  
Alire), I hit a name resolution error that, as far as I can tell, should be  
legal Ada:

```ada
main.adb:15:04: error: instantiation error at opentoken-production-parser-lalr-parser.ads:4
main.adb:15:04: error: type "Parser.Instance" cannot be used before end of its declaration
main.adb:15:04: error: instantiation error at opentoken-production-parser-lalr-parser.ads:8
main.adb:15:04: error: subprogram "Parse" is not overriding

```

The structure below is distilled from OpenToken 6.0c; the generic formal  
parameters are removed, they are not needed to trigger the error:

```ada
-- opentoken.ads
package OpenToken is end OpenToken;

-- opentoken-production.ads
generic
package OpenToken.Production is
end OpenToken.Production;

-- opentoken-production-parser.ads
generic
package OpenToken.Production.Parser is
   type Instance is abstract tagged null record;
   procedure Parse (Parser : in out Instance) is abstract;
end OpenToken.Production.Parser;

-- opentoken-production-parser-lalr.ads
generic
package OpenToken.Production.Parser.LALR is
end OpenToken.Production.Parser.LALR;

-- opentoken-production-parser-lalr-parser.ads
generic
package OpenToken.Production.Parser.LALR.Parser is
   type Instance is new OpenToken.Production.Parser.Instance
     with null record;
   overriding
   procedure Parse (Parser : in out Instance) is null;
end OpenToken.Production.Parser.LALR.Parser;

```

```ada
-- main.adb
with OpenToken.Production;
with OpenToken.Production.Parser;
with OpenToken.Production.Parser.LALR;
with OpenToken.Production.Parser.LALR.Parser;

procedure Main is
   package Production is new OpenToken.Production;
   package Parser is new Production.Parser;
   package LALRs is new Parser.LALR;
   package LALR_Parser is new LALRs.Parser;
begin
   null;
end Main;

```

Observations, all verified on GNAT 16.1.0 (default switches, Windows):

1. The template compiles on its own (`gcc -c opentoken-production-parser-lalr-parser.ads`). The error appears only at the last instantiation, of a generic child through the parent’s instance.
2. **Renaming the grandchild to `OpenToken.Production.Parser.LALR.Lalr_Parser` — so it no longer shares its simple name with its grandparent `OpenToken.Production.Parser` — makes everything compile** , with the reference `OpenToken.Production.Parser.Instance` left unchanged. Which suggests a name resolution issue, not a legality rule.
3. Adding `package Grandparent renames OpenToken.Production.Parser;` in the grandchild and deriving from `Grandparent.Instance` does **not** work around it: the error becomes `type "Grandparent.Instance" cannot be used before end of its declaration`.

Real-world impact: OpenToken 6.0c (6.0.3 in the Alire index) no longer builds on GNAT 16.1. The same sources have been built fine with earlier GNAT releases for years. But maybe GNAT was wrong before, and is right now!

I searched GCC Bugzilla and this forum and found no report of this; the GNAT 16.1.0-rc1 call-for-testing thread doesn’t mention it either. If the consensus is “compiler bug”, I’ll file it in GCC Bugzilla with the repro.

(And this confirm once more that you don’t want to depend on an unmaintained lib).

---

<div class="post-metadata">

**Author:** ![dmitry-kazakov](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/dmitry-kazakov/32/522_2.png) [@dmitry-kazakov](https://forum.ada-lang.io/u/dmitry-kazakov)\
**Post date:** [October 14, 2026, 7:29pm UTC](https://forum.ada-lang.io/t/gnat-16-1-fully-qualified-name-resolved-to-the-current-package-when-instantiating-a-generic-child-bug/4826/2 "2026-10-14T19:29:43Z")

</div>

It is certainly a bug, at least in the error message: `type Parser.Instance` is impossible because `Parser.Instance` is not a _defining\_identifier_ purely syntactically.

As for reporting. Well, generics will likely never be fixed. They mend them in one place tearing in another. I would change the name. _Instance_ is an awful choice.  
(Using grammars is even worse 😀)

---

<div class="post-metadata">

**Author:** ![Nordic\_Dogsledding](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/nordic_dogsledding/32/547_2.png) [@Nordic\_Dogsledding](https://forum.ada-lang.io/u/Nordic_Dogsledding)\
**Post date:** [October 15, 2026, 3:15pm UTC](https://forum.ada-lang.io/t/gnat-16-1-fully-qualified-name-resolved-to-the-current-package-when-instantiating-a-generic-child-bug/4826/3 "2026-10-15T15:15:02Z")

</div>

> [@LionelDraghi](#):
>
> OpenToken 6.0c

Where can I find it? I’ve got only 6.0b. Googling only finds very old versions. GitHub null.

> **[Alire - Opentoken](https://alire.ada.dev/crates/opentoken.html)**
>
> A catalog of ready-to-use Ada libraries

No download found.

---

<div class="post-metadata">

**Author:** ![LionelDraghi](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/lioneldraghi/32/416_2.png) [@LionelDraghi](https://forum.ada-lang.io/u/LionelDraghi)\
**Post date:** [October 16, 2026, 8:43am UTC](https://forum.ada-lang.io/t/gnat-16-1-fully-qualified-name-resolved-to-the-current-package-when-instantiating-a-generic-child-bug/4826/4 "2026-10-16T08:43:01Z")

</div>

> [@Nordic\_Dogsledding](#):
>
> Where can I find it? I’ve got only 6.0b. Googling only finds very old versions. GitHub null.
> 
> [Alire - Opentoken](https://alire.ada.dev/crates/opentoken.html)

Long story, Stephen was no more maintaining it, and I had no answer from the maintainer of the Debian Ada port, so I forked it [here](https://github.com/LionelDraghi/opentoken-6.0c) to publish some fixes I did on the b version in 2018.

Here is the relevant part of the README:

**Note that OpenToken is no more maintained**

The successor of OpenToken is available on Stephen Leake home : [WisiToken](https://stephe-leake.org/ada/wisitoken.html)

This release was made available for the creation of a specific crates, when porting [archicheck](https://github.com/LionelDraghi/ArchiCheck) on ALire.

The modifications respect to the last official version (the 6.0b) are :

- [Fixed] Analyzer.Reset missing in Ada\_Lexer Set\_Input\_Feeder procedure
- [Added] Annotation support added in the Java\_Lexer (MetaData starting with @)
- [Changed] Buffer\_Size of the Tokenizer in Java\_Lexer increased to 8192
- [Changed] cosmetic modifications in comments to comply with gnat standards
- [Changed] some useless “with” removed

NB : Due to Alire using semantic versioning, 6.0c is named 6.0.3 in Alire

Lionel Draghi, april 2024

---

<div class="post-metadata">

**Author:** ![JC001](https://forum.ada-lang.io/letter_avatar_proxy/v4/letter/j/e56c9b/32.png) [@JC001](https://forum.ada-lang.io/u/JC001)\
**Post date:** [October 16, 2026, 9:58am UTC](https://forum.ada-lang.io/t/gnat-16-1-fully-qualified-name-resolved-to-the-current-package-when-instantiating-a-generic-child-bug/4826/5 "2026-10-16T09:58:20Z")

</div>

> [@LionelDraghi](#):
>
> OpenToken is no more maintained

> We are **no longer** the knights who say, “Ni!”

Monty Python and the Holy Grail (emphasis added)

---

<div class="post-metadata">

**Author:** ![LionelDraghi](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/lioneldraghi/32/416_2.png) [@LionelDraghi](https://forum.ada-lang.io/u/LionelDraghi)\
**Post date:** [October 16, 2026, 12:07pm UTC](https://forum.ada-lang.io/t/gnat-16-1-fully-qualified-name-resolved-to-the-current-package-when-instantiating-a-generic-child-bug/4826/6 "2026-10-16T12:07:54Z")

</div>

> [@JC001](#):
>
> We are **no longer** the knights who say, “Ni!”

Oops, that’s my native French showing! “No more maintained” may sound perfectly natural in French, but indeed it makes no sense in English. Thanks for the Monty Python lesson! 😄

---

<div class="post-metadata">

**Author:** ![Nordic\_Dogsledding](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/nordic_dogsledding/32/547_2.png) [@Nordic\_Dogsledding](https://forum.ada-lang.io/u/Nordic_Dogsledding)\
**Post date:** [October 16, 2026, 2:39pm UTC](https://forum.ada-lang.io/t/gnat-16-1-fully-qualified-name-resolved-to-the-current-package-when-instantiating-a-generic-child-bug/4826/7 "2026-10-16T14:39:21Z")

</div>

> [@LionelDraghi](#):
>
> so I forked it [here](https://github.com/LionelDraghi/opentoken-6.0c) to publish some fixes

Thanks for directing me to the sources.

Funny, I put “OpenToken” into the search field of GitHub as claimed by search tips, but found all kind of strings but not this one. **What a useless search implementation!**

BTW: The Java Lexer and the Ada Lexer were written by me. Also the very basic HTML Lexer.  
I even used OpenToken for a professional application. Long long ago.

Are 6.0c and 6.0.3 releases identical, they have different release dates?

The link to WisiToken in ReadMe is dead - the domain is gone.

---

<div class="post-metadata">

**Author:** ![LionelDraghi](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/lioneldraghi/32/416_2.png) [@LionelDraghi](https://forum.ada-lang.io/u/LionelDraghi)\
**Post date:** [October 16, 2026, 3:47pm UTC](https://forum.ada-lang.io/t/gnat-16-1-fully-qualified-name-resolved-to-the-current-package-when-instantiating-a-generic-child-bug/4826/8 "2026-10-16T15:47:23Z")

</div>

> [@Nordic\_Dogsledding](#):
>
> BTW: The Java Lexer and the Ada Lexer were written by me. Also the very basic HTML Lexer.  
> I even used OpenToken for a professional application. Long long ago.

I can forward the explanation I wrote to Stephen regarding the fixes, if your’re interested.

> [@Nordic\_Dogsledding](#):
>
> Are 6.0c and 6.0.3 releases identical, they have different release dates?

Yes, 6.0c was not compliant with Alire version scheme, so it’s just a rename.

---

<div class="post-metadata">

**Author:** ![Nordic\_Dogsledding](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/nordic_dogsledding/32/547_2.png) [@Nordic\_Dogsledding](https://forum.ada-lang.io/u/Nordic_Dogsledding)\
**Post date:** [October 16, 2026, 4:03pm UTC](https://forum.ada-lang.io/t/gnat-16-1-fully-qualified-name-resolved-to-the-current-package-when-instantiating-a-generic-child-bug/4826/9 "2026-10-16T16:03:25Z")

</div>

> [@LionelDraghi](#):
>
> I can forward the explanation I wrote to Stephen regarding the fixes, if your’re interested.

Oh yes, please…need 20 chars ☹

---

<div class="post-metadata">

**Author:** ![LionelDraghi](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/lioneldraghi/32/416_2.png) [@LionelDraghi](https://forum.ada-lang.io/u/LionelDraghi)\
**Post date:** [October 16, 2026, 8:44pm UTC](https://forum.ada-lang.io/t/gnat-16-1-fully-qualified-name-resolved-to-the-current-package-when-instantiating-a-generic-child-bug/4826/10 "2026-10-16T20:44:23Z")

</div>

## Annotation processing in Java\_Lexer (jan 2018)

Package: libopentoken6.1-dev  
Version: 6.0b-7  
Severity: normal

Dear Maintainer,

Java Annotation, that is identifier starting with @, are not processed by the current Java\_Lexer.

Here is an exemple of Java code :

```java
/\*\* 
 \* Test class for {@link PetTypeFormatter} 
 \* 
 \* @author Colin But 
 \*/ 
@RunWith(MockitoJUnitRunner.class) 
public class PetTypeFormatterTests { 

    @Mock 
    private PetRepository pets; 

    private PetTypeFormatter petTypeFormatter; 

    @Before 
    public void setup() { 
        this.petTypeFormatter = new PetTypeFormatter(pets); 
    } 
... 

} 

```

The Java lexer do not recognize @ character in code.

It’s Ok in comments, and so no problem with Javadoc tags, but it raises an OpenToken.Syntax\_Error exception when met in code.  
So, annotations like @Override cause the analysis interruption.

I added a new Annotation\_T token to the Java lexer, the patch file is joined.

(note that the last part of the patch is my proposal for bug Bug#886507, that is the buffer increase).

Best regards,

--

– Lionel

---

<div class="post-metadata">

**Author:** ![LionelDraghi](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/lioneldraghi/32/416_2.png) [@LionelDraghi](https://forum.ada-lang.io/u/LionelDraghi)\
**Post date:** [October 16, 2026, 8:48pm UTC](https://forum.ada-lang.io/t/gnat-16-1-fully-qualified-name-resolved-to-the-current-package-when-instantiating-a-generic-child-bug/4826/11 "2026-10-16T20:48:09Z")

</div>

## infinite loop in Tokenizer.Find\_Best\_Match

Package: libopentoken6.1-dev  
Version: 6.0b-7  
Severity: normal

Dear Maintainer,

When the size of a comment is close to Max\_Buffer\_Size (default = 1024),  
Find\_Best\_Match may enter an infinite loop or have an incoherent behavior.

The provided test case contains a comment ending with “123”.

- ending with “123”, the comment length is 1026 : bug, infinite loop.  
This is the behavior for Max\_Buffer\_Size + 2 or more longer comment.

- removing the “3”, length = 1025 : bug, it fails with the message :

- removing the “2”, length = 1024 :

- removing the “1”, length = 1023 :  
Normal behavior

I didn’t further investigate the bug (the code is quite complex).

Workarround :  
This size is a parameter of the Analyzer initialization (functions  
OpenToken.Token.Enumerated.Analyzer.Initialize).  
For the Java lexer, as the syntax is exposed in the spec, it’s possible to  
declare another Analyzer in user code with different defaults.

But, to avoid users a long investigation, I suggest to change the default size  
of the buffer to 4K, as lots of Java comments may be longer thant 1K.

Last line in java\_lexer.ads :

```ada
   Analyzer : constant Tokenizer.Handle := Tokenizer.Initialize (Syntax, 
Buffer_Size => 4096); 

```

Lionel

I joined : test main, gpr, Makefile and Java source

NodeEventTarget.java :

```java
public interface NodeEventTarget extends EventTarget { 

    EventSupport getEventSupport(); 
   // Comment size= 1023 
    /\*\* 
     \* This method allows the dispatch of events into the implementation's 
     \* event model. The event target of the event is the 
     \* <code>EventTarget</code> object on which <code>dispatchEvent</code> 
     \* is called. 
     \* @param evt The event to be dispatched. 
     \* @return Indicates whether any of the listeners which handled the 
     \* event called <code>Event.preventDefault()</code>. If 
     \* <code>Event.preventDefault()</code> was called the returned value 
     \* is <code>false</code>, else it is <code>true</code>. 
     \* @exception EventException 
     \* UNSPECIFIED_EVENT_TYPE_ERR: Raised if the <code>Event.type</code> 
     \* was not specified by initializing the event before 
     \* <code>dispatchEvent</code> was called. Specification of the 
     \* <code>Event.type</code> as <code>null</code> or an empty string 
     \* will also trigger this exception. 
     \* <br> DISPATCH_REQUEST_ERR: Raised if the <code>Event</code> object is 
     \* already being dispatched 
     \*/ 

    EventSupport getEventSupport(); 
   // Comment size= 1024 
    /\*\* 
     \* This method allows the dispatch of events into the implementation's 
     \* event model. The event target of the event is the 
     \* <code>EventTarget</code> object on which <code>dispatchEvent</code> 
     \* is called. 
     \* @param evt The event to be dispatched. 
     \* @return Indicates whether any of the listeners which handled the 
     \* event called <code>Event.preventDefault()</code>. If 
     \* <code>Event.preventDefault()</code> was called the returned value 
     \* is <code>false</code>, else it is <code>true</code>. 
     \* @exception EventException 
     \* UNSPECIFIED_EVENT_TYPE_ERR: Raised if the <code>Event.type</code> 
     \* was not specified by initializing the event before 
     \* <code>dispatchEvent</code> was called. Specification of the 
     \* <code>Event.type</code> as <code>null</code> or an empty string 
     \* will also trigger this exception. 
     \* <br> DISPATCH_REQUEST_ERR: Raised if the <code>Event</code> object is 
     \* already being dispatched1 
     \*/ 

    EventSupport getEventSupport(); 
    // Comment size= 1025 
    /\*\* 
     \* This method allows the dispatch of events into the implementation's 
     \* event model. The event target of the event is the 
     \* <code>EventTarget</code> object on which <code>dispatchEvent</code> 
     \* is called. 
     \* @param evt The event to be dispatched. 
     \* @return Indicates whether any of the listeners which handled the 
     \* event called <code>Event.preventDefault()</code>. If 
     \* <code>Event.preventDefault()</code> was called the returned value 
     \* is <code>false</code>, else it is <code>true</code>. 
     \* @exception EventException 
     \* UNSPECIFIED_EVENT_TYPE_ERR: Raised if the <code>Event.type</code> 
     \* was not specified by initializing the event before 
     \* <code>dispatchEvent</code> was called. Specification of the 
     \* <code>Event.type</code> as <code>null</code> or an empty string 
     \* will also trigger this exception. 
     \* <br> DISPATCH_REQUEST_ERR: Raised if the <code>Event</code> object is 
     \* already being dispatched12 
     \*/ 

    EventSupport getEventSupport(); 
    // Comment size= 1026 
    /\*\* 
     \* This method allows the dispatch of events into the implementation's 
     \* event model. The event target of the event is the 
     \* <code>EventTarget</code> object on which <code>dispatchEvent</code> 
     \* is called. 
     \* @param evt The event to be dispatched. 
     \* @return Indicates whether any of the listeners which handled the 
     \* event called <code>Event.preventDefault()</code>. If 
     \* <code>Event.preventDefault()</code> was called the returned value 
     \* is <code>false</code>, else it is <code>true</code>. 
     \* @exception EventException 
     \* UNSPECIFIED_EVENT_TYPE_ERR: Raised if the <code>Event.type</code> 
     \* was not specified by initializing the event before 
     \* <code>dispatchEvent</code> was called. Specification of the 
     \* <code>Event.type</code> as <code>null</code> or an empty string 
     \* will also trigger this exception. 
     \* <br> DISPATCH_REQUEST_ERR: Raised if the <code>Event</code> object is 
     \* already being dispatched123 
     \*/ 
} 

```

Makefile :

```makefile
all: build check 

build: 
        gprbuild -P run_java_lexer.gpr 

check: 
        obj/run_java_lexer NodeEventTarget.java 

```

run\_java\_lexer.adb :

```ada
with Java_Lexer; use Java_Lexer; 
with Ada.Text_IO; use Ada.Text_IO; 
with Ada.Command_Line; use Ada.Command_Line; 
with Ada.Exceptions; 
with OpenToken; 
with OpenToken.Text_Feeder.Text_IO; 

procedure Run_Java_Lexer is 
   File : File_Type; 

begin 
   Ada.Text_IO.Open (File, In_File, Argument (1)); 

   -- Set_Input_Feeder (File); 
   Ada.Text_IO.Set_Input (File); 
   Analyzer.Reset; 
   Analyzer.Set_Text_Feeder (OpenToken.Text_Feeder.Text_IO.Create 
(Ada.Text_IO.Current_Input)); 

   loop 
      exit when End_Of_File (File); 
      Analyzer.Find_Next; 

      Put_Line (Natural'Image (Analyzer.Line) 
                & ": " & Java_Token'Image (Analyzer.ID) 
                & ", " & Analyzer.Lexeme); 

   end loop; 

exception 
   when E : OpenToken.Syntax_Error => 
      Put_Line (Count'Image (Line (File)) & ": " & 
Ada.Exceptions.Exception_Message (E)); 

end Run_Java_Lexer; 

```

run\_java\_lexer.gpr :

```ada
-- with "../../patched_ot"; 

project run_java_lexer is 

   for Source_Dirs use ("./src"); 
   for Object_Dir use "./obj"; 
   for Main use ("run_java_lexer.adb"); 

   package Ide is 
      for Vcs_Kind use "Git"; 
      -- for Documentation_Dir use "./html"; 
   end Ide; 

   package Builder is 
      for Executable ("run_java_lexer.adb") use "run_java_lexer"; 
      for Default_Switches ("ada") use ("-j2"); 
   end Builder; 

   package Compiler is 
      Common_Switches := ("-gnat2012"); 
      Common_Debug_Switches := Common_Switches & 
      ("-g", "-O0", "-gnatQ", "-gnatf", "-gnato", "-fstack-check", "-gnata", 
"-gnateE", "-gnatVa", "-gnatwa", "-gnatyabefhiklnprtx"); 
      -- -gnatQ : Don't quit 
      -- -gnatf : Full errors 
      -- -gnato : Intermediate overflows to be handled in strict mode. 
      -- -fstack-check : stack checking 
      -- -gnata : assertions 
      -- -gnateE : extra infos in exception messages 
      -- -gnatVa : all validity checks 
      -- -gnatwa : activate most optional warning messages 
      -- 
      -- Style checking : 
      -- a : Check attribute casing 
      -- b : Blanks not allowed at statement end 
      -- e : Check end/exit labels 
      -- f : No form feeds or vertical tabs 
      -- h : No horizontal tabs 
      -- i : Check if-then layout 
      -- k : Check keyword casing 
      -- l : Check layout 
      -- n : Check casing of entities in Standard 
      -- p : Check pragma casing 
      -- r : Check references 
      -- t : Check token spacing 
      --removed M100 : Set maximum line length 
      -- x : Check extra parentheses. 

      for Switches ("ada") use Common_Debug_Switches; 

   end Compiler; 

   package Linker is 
      for Switches ("ada") use ("-g", "-lgcov"); 
   end Linker; 

   package Binder is 
      for Switches ("ada") use ("-Es"); 
   end Binder; 

   package Pretty_Printer is 
      for Switches ("ada") use ("-M100", "-l2", "-A1", "-A2", "-A3", "-A4"); 
   end Pretty_Printer; 

end run_java_lexer; 

```

– System Information:  
Debian Release: buster/sid  
APT prefers testing  
APT policy: (500, ‘testing’)  
Architecture: amd64 (x86\_64)

Kernel: Linux 4.14.0-2-amd64 (SMP w/2 CPU cores)  
Locale: LANG=fr\_FR.utf8, LC\_CTYPE=fr\_FR.utf8 (charmap=UTF-8), LANGUAGE=fr\_FR.utf8 (charmap=UTF-8)  
Shell: /bin/sh linked to /bin/dash  
Init: systemd (via /run/systemd/system)

Versions of packages libopentoken6.1-dev depends on:  
ii gnat 7  
ii gnat-7 7.2.0-18  
ii libopentoken9.1 6.0b-7

libopentoken6.1-dev recommends no packages.

Versions of packages libopentoken6.1-dev suggests:  
ii libopentoken-doc 6.0b-7

– no debconf information

--  
– Lionel

---

<div class="post-metadata">

**Author:** ![LionelDraghi](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/lioneldraghi/32/416_2.png) [@LionelDraghi](https://forum.ada-lang.io/u/LionelDraghi)\
**Post date:** [October 16, 2026, 8:50pm UTC](https://forum.ada-lang.io/t/gnat-16-1-fully-qualified-name-resolved-to-the-current-package-when-instantiating-a-generic-child-bug/4826/12 "2026-10-16T20:50:15Z")

</div>

## Ada lexer not well reset with a call to Set\_Text\_Feeder

Package: libopentoken6-dev  
Version: 6.0b-5+b2  
File: libopentoken6  
Severity: normal

Dear Maintainer,

while processing a bunch of Ada files, the OpenToken Ada Lexer is sometimes ignoring the call to Set\_Input\_Feeder, and continue to parse the previously opened Ada file.

I read this in OpenToken.Token.Enumerated.Analyzer :

```ada
-------------------------------------------------------------------- 
    -- Reset Analyzer, to start finding tokens. This is appropriate 
    -- when the Feeder text has been changed. 
-------------------------------------------------------------------- 
    procedure Reset (Analyzer : in out Instance); 

```

It seems appropriate, but it’s not done in the Ada lexer.

For the Java lexer, no problem, as the analyzer instantiation is exposed in the package spec, the user can add a call to Analyzer.Reset just before Analyzer.Set\_Text\_Feeder.

But, for the Ada lexer, as the analyzer instantiation is hidden in the body, and there no Reset procedure available in the spec, there is no solution on user side.

I suggest to patch Set\_Input\_Feeder in ada\_lexer.adb to do the same thing :

```ada
    procedure Set_Input_Feeder (File : in Ada.Text_IO.File_Type) is 
    begin 
       Ada.Text_IO.Set_Input (File); 
       Analyzer.Reset; --> added line 
       Analyzer.Set_Text_Feeder (OpenToken.Text_Feeder.Text_IO.Create (Ada.Text_IO.Current_Input)); 
    end Set_Input_Feeder; 

```

thanks,

–  
– Lionel

PS : unable to send something with reportbug!

– System Information:

Debian Release: 9.2  
APT prefers stable-updates  
APT policy: (500, ‘stable-updates’), (500, ‘stable’)  
Architecture: amd64 (x86\_64)

Kernel: Linux 4.9.0-4-amd64 (SMP w/2 CPU cores)  
Locale: LANG=fr\_FR.utf8, LC\_CTYPE=fr\_FR.utf8 (charmap=UTF-8), LANGUAGE=fr\_FR.utf8 (charmap=UTF-8)  
Shell: /bin/sh linked to /bin/dash  
Init: systemd (via /run/systemd/system)

Versions of packages libopentoken6-dev depends on:  
ii gnat 6.1  
ii gnat-6 6.3.0-18  
ii libopentoken9 6.0b-5+b2

libopentoken6-dev recommends no packages.

libopentoken6-dev suggests no packages.

– no debconf information

---

<div class="post-metadata">

**Author:** ![LionelDraghi](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/lioneldraghi/32/416_2.png) [@LionelDraghi](https://forum.ada-lang.io/u/LionelDraghi)\
**Post date:** [October 16, 2026, 8:53pm UTC](https://forum.ada-lang.io/t/gnat-16-1-fully-qualified-name-resolved-to-the-current-package-when-instantiating-a-generic-child-bug/4826/13 "2026-10-16T20:53:01Z")

</div>

On this one, Stephe answered:

> Yes. It’s unlikely there will be another release of OpenToken, at least by me; I’ve moved on to WisiToken, which has no release yet, but is a significant rewrite that simplifies a lot of things, and adds error correction.

It was in dec 2017.

---

<div class="post-metadata">

**Author:** ![LionelDraghi](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/lioneldraghi/32/416_2.png) [@LionelDraghi](https://forum.ada-lang.io/u/LionelDraghi)\
**Post date:** [October 22, 2026, 3:02pm UTC](https://forum.ada-lang.io/t/gnat-16-1-fully-qualified-name-resolved-to-the-current-package-when-instantiating-a-generic-child-bug/4826/14 "2026-10-22T15:02:36Z")

</div>

Interesting!

> **[128044 – \[16/17 regression\] fully qualified name resolved to current package...](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128044)**

— Comment #6 from Eric Botcazou —  
The resolution in the instance has always been incorrect, but it was salvaged  
by a kludge present in Sem\_Ch8.Premature\_Usage until r16-1214:  
[[gcc r16-1214] ada: Remove dead code](https://gcc.gnu.org/pipermail/gcc-cvs/2025-June/425125.html)

---

<div class="post-metadata">

**Author:** ![LionelDraghi](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/lioneldraghi/32/416_2.png) [@LionelDraghi](https://forum.ada-lang.io/u/LionelDraghi)\
**Post date:** [October 22, 2026, 6:57pm UTC](https://forum.ada-lang.io/t/gnat-16-1-fully-qualified-name-resolved-to-the-current-package-when-instantiating-a-generic-child-bug/4826/15 "2026-10-22T18:57:50Z")

</div>

Fixed in 16.3 and later.

Who said fixing that GCC bug was taking forever? 😀

---

<div class="post-metadata">

**Author:** ![system](https://forum.ada-lang.io/uploads/default/original/1X/e625e7957e269cbf6d3128dab48a9e54fe3a9bdc.png) [@system](https://forum.ada-lang.io/u/system)\
**Post date:** [October 24, 2026, 6:58pm UTC](https://forum.ada-lang.io/t/gnat-16-1-fully-qualified-name-resolved-to-the-current-package-when-instantiating-a-generic-child-bug/4826/16 "2026-10-24T18:58:30Z")

</div>

Closed on October 24, 2026, 6:58pm UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
