If a package in a limited_with clause contains an incomplete type and its
completion, both of them have a limited view, and these may be visible at the
same time though intervening packages. These two limited views must be treated
as identical in conformance tests.
The following must build quietly;

   gnatmake -q -gnat05 main

---
with Uml.NamedElements;
procedure Main is
begin
   null;
end Main;
---
with Uml.INamedElements; use uml.INamedElements;
with Ada.Containers.Indefinite_Vectors;
package Uml.IDependencys is

   type IDependency is interface and INamedElement;
   type IDependency_Container is tagged;

   function client (Self : IDependency) return not null access
     INamedElements.INamedElement_Container'Class is abstract;

   package IDependency_Containers is new Ada.Containers.Indefinite_Vectors
        (Element_Type => IDependency'Class,
         Index_Type => Positive);
   type IDependency_Container is new IDependency_Containers.Vector
   with null record;
   type IDependency_Container_Access is access all IDependency_Container;
end Uml.IDependencys;
---
limited with Uml.IDependencys;
with Ada.Containers.Indefinite_Vectors;
package Uml.INamedElements is
   type INamedElement is interface;
   type INamedElement_Access is access all INamedElement'Class;
   type INamedElement_Container is tagged;

   function clientDependency (Self : INamedElement) return
   not null access IDependencys.IDependency_Container'Class is abstract;

    package INamedElement_Containers is new Ada.Containers.Indefinite_Vectors
     (Element_Type => INamedElement'Class,
      Index_Type => Positive);
   type INamedElement_Container is new INamedElement_Containers.Vector with 
null record;
end Uml.INamedElements;
---
with UML.IDependencys;
package body Uml.NamedElements is

   overriding function clientDependency
     (Self : NamedElement)
      return not null access IDependencys.IDependency_Container'Class
   is
   begin
      return new IDependencys.IDependency_Container;
   end clientDependency;
end Uml.NamedElements;
---
with Uml.INamedElements; use UML.INamedElements;
limited with UML.IDependencys;
package Uml.NamedElements is
   type NamedELement is new INamedElement with private;

   overriding
   function clientDependency (Self : NamedElement) return
   not null access IDependencys.IDependency_Container'Class;

private
   type NamedELement is new INamedElement with null record;
end Uml.NamedElements;
---
package UML is
end;

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-08-29  Ed Schonberg  <schonb...@adacore.com>

        * sem_ch6.adb (Matches_Limited_With_View): The limited views of an
        incomplete type and its completion match.

Index: sem_ch6.adb
===================================================================
--- sem_ch6.adb (revision 178222)
+++ sem_ch6.adb (working copy)
@@ -5669,6 +5669,12 @@
          then
             return True;
 
+         elsif From_With_Type (T1)
+           and then From_With_Type (T2)
+           and then Available_View (T1) = Available_View (T2)
+         then
+            return True;
+
          else
             return False;
          end if;

Reply via email to