OSDN Git Service

2009-10-19 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / sem_type.ads
index d40f441..307674f 100644 (file)
@@ -6,18 +6,17 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2007, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
--- ware  Foundation;  either version 2,  or (at your option) any later ver- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
 -- for  more details.  You should have  received  a copy of the GNU General --
--- Public License  distributed with GNAT;  see file COPYING.  If not, write --
--- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
--- Boston, MA 02110-1301, USA.                                              --
+-- Public License  distributed with GNAT; see file COPYING3.  If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license.          --
 --                                                                          --
 -- GNAT was originally developed  by the GNAT team at  New York University. --
 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
@@ -56,12 +55,12 @@ package Sem_Type is
    --  Corresponding to the set of interpretations for a given overloadable
    --  identifier, there is a set of possible types corresponding to the types
    --  that the overloaded call may return. We keep a 1-to-1 correspondence
-   --  between interpretations and types: for user-defined subprograms the
-   --  type is the declared return type. For operators, the type is determined
-   --  by the type of the arguments. If the arguments themselves are
-   --  overloaded, we enter the operator name in the names table for each
-   --  possible result type. In most cases, arguments are not overloaded and
-   --  only one interpretation is present anyway.
+   --  between interpretations and types: for user-defined subprograms the type
+   --  is the declared return type. For operators, the type is determined by
+   --  the type of the arguments. If the arguments themselves are overloaded,
+   --  we enter the operator name in the names table for each possible result
+   --  type. In most cases, arguments are not overloaded and only one
+   --  interpretation is present anyway.
 
    type Interp is record
       Nam         : Entity_Id;
@@ -98,23 +97,19 @@ package Sem_Type is
    --  Invoked by gnatf when processing multiple files
 
    procedure Collect_Interps (N : Node_Id);
-   --  Invoked when the name N has more than one visible interpretation.
-   --  This is the high level routine which accumulates the possible
-   --  interpretations of the node. The first meaning and type of N have
-   --  already been stored in N. If the name is an expanded name, the homonyms
-   --  are only those that belong to the same scope.
-
-   function Is_Invisible_Operator
-     (N    : Node_Id;
-      T    : Entity_Id)
-      return Boolean;
-   --  Check whether a predefined operation with universal operands appears
-   --  in a context in which the operators of the expected type are not
-   --  visible.
+   --  Invoked when the name N has more than one visible interpretation. This
+   --  is the high level routine which accumulates the possible interpretations
+   --  of the node. The first meaning and type of N have already been stored
+   --  in N. If the name is an expanded name, the homonyms are only those that
+   --  belong to the same scope.
+
+   function Is_Invisible_Operator (N : Node_Id; T : Entity_Id) return Boolean;
+   --  Check whether a predefined operation with universal operands appears in
+   --  a context in which the operators of the expected type are not visible.
 
    procedure List_Interps (Nam : Node_Id; Err : Node_Id);
-   --  List candidate interpretations of an overloaded name. Used for
-   --  various error reports.
+   --  List candidate interpretations of an overloaded name. Used for various
+   --  error reports.
 
    procedure Add_One_Interp
      (N         : Node_Id;
@@ -122,13 +117,13 @@ package Sem_Type is
       T         : Entity_Id;
       Opnd_Type : Entity_Id := Empty);
    --  Add (E, T) to the list of interpretations of the node being resolved.
-   --  For calls and operators, i.e. for nodes that have a name field,
-   --  E is an overloadable entity, and T is its type. For constructs such
-   --  as indexed expressions, the caller sets E equal to T, because the
-   --  overloading comes from other fields, and the node itself has no name
-   --  to resolve. Hidden denotes whether an interpretation has been disabled
-   --  by an abstract operator. Add_One_Interp includes semantic processing to
-   --  deal with adding entries that hide one another etc.
+   --  For calls and operators, i.e. for nodes that have a name field, E is an
+   --  overloadable entity, and T is its type. For constructs such as indexed
+   --  expressions, the caller sets E equal to T, because the overloading comes
+   --  from other fields, and the node itself has no name to resolve. Hidden
+   --  denotes whether an interpretation has been disabled by an abstract
+   --  operator. Add_One_Interp includes semantic processing to deal with
+   --  adding entries that hide one another etc.
 
    --  For operators, the legality of the operation depends on the visibility
    --  of T and its scope. If the operator is an equality or comparison, T is
@@ -167,16 +162,14 @@ package Sem_Type is
    --  New_N, its new copy. It has no effect in the non-overloaded case.
 
    function Covers (T1, T2 : Entity_Id) return Boolean;
-   --  This is the basic type compatibility routine. T1 is the expected
-   --  type, imposed by context, and T2 is the actual type. The processing
-   --  reflects both the definition of type coverage and the rules
-   --  for operand matching.
+   --  This is the basic type compatibility routine. T1 is the expected type,
+   --  imposed by context, and T2 is the actual type. The processing reflects
+   --  both the definition of type coverage and the rules for operand matching.
 
    function Disambiguate
      (N      : Node_Id;
       I1, I2 : Interp_Index;
-      Typ    : Entity_Id)
-      return   Interp;
+      Typ    : Entity_Id) return Interp;
    --  If more than one interpretation of a name in a call is legal, apply
    --  preference rules (universal types first) and operator visibility in
    --  order to remove ambiguity. I1 and I2 are the first two interpretations
@@ -189,24 +182,21 @@ package Sem_Type is
    --  opposed to an operator, type and mode conformance are required.
 
    function Find_Unique_Type (L : Node_Id; R : Node_Id) return Entity_Id;
-   --  Used in second pass of resolution,  for equality and comparison nodes.
-   --  L is the left operand, whose type is known to be correct, and R is
-   --  the right operand,  which has one interpretation compatible with that
-   --  of L. Return the type intersection of the two.
-
-   function Has_Compatible_Type
-     (N    : Node_Id;
-      Typ  : Entity_Id)
-      return Boolean;
-   --  Verify that some interpretation of the node N has a type compatible
-   --  with Typ. If N is not overloaded, then its unique type must be
-   --  compatible with Typ. Otherwise iterate through the interpretations
-   --  of N looking for a compatible one.
+   --  Used in second pass of resolution, for equality and comparison nodes. L
+   --  is the left operand, whose type is known to be correct, and R is the
+   --  right operand, which has one interpretation compatible with that of L.
+   --  Return the type intersection of the two.
+
+   function Has_Compatible_Type (N : Node_Id; Typ : Entity_Id) return Boolean;
+   --  Verify that some interpretation of the node N has a type compatible with
+   --  Typ. If N is not overloaded, then its unique type must be compatible
+   --  with Typ. Otherwise iterate through the interpretations of N looking for
+   --  a compatible one.
 
    function Hides_Op (F : Entity_Id; Op : Entity_Id) return Boolean;
-   --  A user-defined function hides a predefined operator if it is
-   --  matches the signature of the operator, and is declared in an
-   --  open scope, or in the scope of the result type.
+   --  A user-defined function hides a predefined operator if it is matches the
+   --  signature of the operator, and is declared in an open scope, or in the
+   --  scope of the result type.
 
    function Interface_Present_In_Ancestor
      (Typ   : Entity_Id;
@@ -221,13 +211,19 @@ package Sem_Type is
    --  interpretations is universal, choose the non-universal one. If either
    --  node is overloaded, find single common interpretation.
 
+   function In_Generic_Actual (Exp : Node_Id) return Boolean;
+   --  Determine whether the expression is part of a generic actual. At the
+   --  time the actual is resolved the scope is already that of the instance,
+   --  but conceptually the resolution of the actual takes place in the
+   --  enclosing context and no special disambiguation rules should be applied.
+
    function Is_Ancestor (T1, T2 : Entity_Id) return Boolean;
    --  T1 is a tagged type (not class-wide). Verify that it is one of the
-   --  ancestors of type T2 (which may or not be class-wide)
+   --  ancestors of type T2 (which may or not be class-wide).
 
    function Is_Subtype_Of (T1 : Entity_Id; T2 : Entity_Id) return Boolean;
    --  Checks whether T1 is any subtype of T2 directly or indirectly. Applies
-   --  only to scalar subtypes ???
+   --  only to scalar subtypes???
 
    function Operator_Matches_Spec (Op, New_S : Entity_Id) return Boolean;
    --  Used to resolve subprograms renaming operators, and calls to user
@@ -242,15 +238,15 @@ package Sem_Type is
    --  real type, or a one dimensional array with a discrete component type.
 
    function Valid_Boolean_Arg (T : Entity_Id) return Boolean;
-   --  A valid argument of a boolean operator is either some boolean type,
-   --  or a one-dimensional array of boolean type.
+   --  A valid argument of a boolean operator is either some boolean type, or a
+   --  one-dimensional array of boolean type.
 
    procedure Write_Interp_Ref (Map_Ptr : Int);
-   --  Debugging procedure to display entry in Interp_Map. Would not be
-   --  needed if it were possible to debug instantiations of Table.
+   --  Debugging procedure to display entry in Interp_Map. Would not be needed
+   --  if it were possible to debug instantiations of Table.
 
    procedure Write_Overloads (N : Node_Id);
-   --  Debugging procedure to output info on possibly overloaded entities
-   --  for specified node.
+   --  Debugging procedure to output info on possibly overloaded entities for
+   --  specified node.
 
 end Sem_Type;