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.3 required=5.0 tests=BAYES_00,INVALID_MSGID, T_FILL_THIS_FORM_SHORT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e546de6de24f54e0,start X-Google-Attributes: gid103376,public From: Simon Wright Subject: Visibility for operations of formal private extensions Date: 2000/07/28 Message-ID: #1/1 X-Deja-AN: 651921682 X-NNTP-Posting-Host: pogner.demon.co.uk:158.152.70.98 X-Trace: news.demon.co.uk 964812255 nnrp-08:14171 NO-IDENT pogner.demon.co.uk:158.152.70.98 Organization: At Home Newsgroups: comp.lang.ada X-Complaints-To: abuse@demon.net Date: 2000-07-28T00:00:00+00:00 List-Id: The code below gives compilation errors when compiling the view conversion in P.Q.R.Proc's body, both in GNAT (3.13a1) and Apex 3.2.0b. They say that there's no visible interpretation: GNAT says /home/simon/tmp/demo.ada:33:09: no candidate interpretations match the actuals: /home/simon/tmp/demo.ada:33:15: expected type "New_T" defined at /home/simon/tmp/demo.ada:26 /home/simon/tmp/demo.ada:33:15: found private type "Base" defined at /home/simon/tmp/demo.ada:22 /home/simon/tmp/demo.ada:33:15: ==> in call to "Proc" at /home/simon/tmp/demo.ada:27 /home/simon/tmp/demo.ada:33:15: ==> in call to "Proc" at /home/simon/tmp/demo.ada:18(inherited) /home/simon/tmp/demo.ada:33:15: ==> in call to "Proc" at /home/simon/tmp/demo.ada:5 If I make P.Proc publicly visible, the compilation goes fine. I believe we are somewhere near 12.5.1(21) here. My belief that it should have compiled is based on the following: * we know that P.Q.R.Base is a P.Q.Q_T * a P.Q.Q_T (privately) inherits P.Proc * P.Q.R's body has visiblity of the private part of P and therefore should be able to see that P.Q.Q_T inherits P.Proc Note that P.Q.S's body _can_ see P.Proc. I tried adding a private component to P.Q.Q_T, P.Q.R.Proc can see it quite happily .. OK, the LRM reference above is about operations not data, still! ================================================================== package P is type T is tagged private; private type T is tagged null record; procedure Proc (The_T : in out T); end P; package body P is procedure Proc (The_T : in out T) is begin null; end Proc; end P; package P.Q is type Q_T is new P.T with private; private type Q_T is new T with null record; end P.Q; generic type Base is new Q_T with private; package P.Q.R is type New_T is new Base with private; private type New_T is new Base with null record; procedure Proc (The_T : in out New_T); end P.Q.R; package body P.Q.R is procedure Proc (The_T : in out New_T) is begin Proc (Base (The_T)); end Proc; end P.Q.R; package P.Q.S is type S_T is new Q_T with private; private type S_T is new Q_T with null record; procedure Proc (The_T : in out S_T); end P.Q.S; package body P.Q.S is procedure Proc (The_T : in out S_T) is begin Proc (Q_T (The_T)); end Proc; end P.Q.S; with P.Q.R; with P.Q.S; package U is package U_P is new P.Q.R (Base => P.Q.S.S_T); end U;