From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.uzoreto.com!news.neodome.net!neodomea5yrhcabc.onion!.POSTED!not-for-mail From: yoehoduv@protonmail.com Newsgroups: comp.lang.ada Subject: use type does not seem to work for types in generic package instantiations Date: Tue, 18 Feb 2020 01:37:57 +0000 Organization: Neodome Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 18 Feb 2020 01:38:09 -0000 (UTC) Injection-Info: neodomea5yrhcabc.onion; mail-complaints-to="abuse@neodome.net" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 X-Mozilla-News-Host: news://neodomea5yrhcabc.onion:119 Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:58089 Date: 2020-02-18T01:37:57+00:00 List-Id: It looks like use type has no effect when the type is from a package declared in the same region as the use type statement. I can make the primitive subprograms of a type directly visible with `use all type` like this: package Type_Package is type T is null record; procedure Action(X: T) is null; end Type_Package; with Type_Package; procedure Use_Type is use all type Type_Package.T; X: Type_Package.T; begin Action(X); end Use_Type; However, it does not seem to work when I move `Type_Package` inside `Use_Type`. procedure Use_Type is package Type_Package is type T is null record; procedure Action(X: T) is null; end Type_Package; use all type Type_Package.T; X: Type_Package.T; begin Action(X); end Use_Type; I get gcc -c use_type.adb use_type.adb:9:04: "Action" is not visible use_type.adb:9:04: non-visible declaration at line 4 gnatmake: "use_type.adb" compilation error The same thing occurs when I instantiate a generic package. For example, when I want to use the data types in `Ada.Containers`. package Element_Set is new Ada.Containers.Hashed_Sets(Element_Type, Hash, "="); use all type Element_Set.Set; The `use type` clause here seems to have no effect. Does anyone know why? I originally posted this at