Commit 6ca9ec9c by Arnaud Charlet

[multiple changes]

2010-06-21  Robert Dewar  <dewar@adacore.com>

	* s-regpat.adb, s-tpoben.adb, sem_attr.adb, sem_util.adb, sem_util.ads,
	checks.adb, sem_res.adb: Minor reformatting. Add comments.

2010-06-21  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch6.adb (New_Overloaded_Entity): If the new entity is a
	rederivation associated with a full declaration in a private part, and
	there is a partial view that derives the same parent subprogram, the
	new entity does not become visible. This check must be applied to
	interface operations as well.

From-SVN: r161078
parent a548f9ff
2010-06-21 Robert Dewar <dewar@adacore.com>
* s-regpat.adb, s-tpoben.adb, sem_attr.adb, sem_util.adb, sem_util.ads,
checks.adb, sem_res.adb: Minor reformatting. Add comments.
2010-06-21 Ed Schonberg <schonberg@adacore.com>
* sem_ch6.adb (New_Overloaded_Entity): If the new entity is a
rederivation associated with a full declaration in a private part, and
there is a partial view that derives the same parent subprogram, the
new entity does not become visible. This check must be applied to
interface operations as well.
2010-06-21 Thomas Quinot <quinot@adacore.com>
* checks.adb: Add comments.
......
......@@ -6256,6 +6256,7 @@ package body Checks is
-- Returns an attribute reference
-- E'First or E'Last
-- with a source location of Loc.
--
-- Nam is Name_First or Name_Last, according to which attribute is
-- desired. If Indx is non-zero, it is passed as a literal in the
-- Expressions of the attribute reference (identifying the desired
......
......@@ -4906,17 +4906,18 @@ package body Sem_Attr is
-----------------------------------
procedure Check_Concurrent_Discriminant (Bound : Node_Id) is
Tsk : Entity_Id;
Tsk : Entity_Id;
-- The concurrent (task or protected) type
begin
if Nkind (Bound) = N_Identifier
and then Ekind (Entity (Bound)) = E_Discriminant
and then Is_Concurrent_Record_Type (Scope (Entity (Bound)))
then
Tsk := Corresponding_Concurrent_Type (Scope (Entity (Bound)));
if In_Open_Scopes (Tsk)
and then Has_Completion (Tsk)
then
if In_Open_Scopes (Tsk) and then Has_Completion (Tsk) then
-- Find discriminant of original concurrent type, and use
-- its current discriminal, which is the renaming within
-- the task/protected body.
......@@ -6015,6 +6016,7 @@ package body Sem_Attr is
else
Fold_Uint (N, Expr_Value (Lo_Bound), Static);
end if;
else
Check_Concurrent_Discriminant (Lo_Bound);
end if;
......@@ -6205,6 +6207,7 @@ package body Sem_Attr is
else
Fold_Uint (N, Expr_Value (Hi_Bound), Static);
end if;
else
Check_Concurrent_Discriminant (Hi_Bound);
end if;
......
......@@ -7526,9 +7526,11 @@ package body Sem_Ch6 is
-- E exists and is overloadable
else
-- Ada 2005 (AI-251): Derivation of abstract interface primitives
-- need no check against the homonym chain. They are directly added
-- to the list of primitive operations of Derived_Type.
-- Ada 2005 (AI-251): Derivation of abstract interface primitives.
-- They are directly added to the list of primitive operations of
-- Derived_Type, unless this is a rederivation in the private part
-- of an operation that was already derived in the visible part of
-- the current package.
if Ada_Version >= Ada_05
and then Present (Derived_Type)
......@@ -7536,7 +7538,16 @@ package body Sem_Ch6 is
and then Present (Find_Dispatching_Type (Alias (S)))
and then Is_Interface (Find_Dispatching_Type (Alias (S)))
then
goto Add_New_Entity;
if Type_Conformant (E, S)
and then Is_Package_Or_Generic_Package (Current_Scope)
and then In_Private_Part (Current_Scope)
and then Parent (E) /= Parent (S)
and then Alias (E) = Alias (S)
then
Check_Operation_From_Private_View (S, E);
else
goto Add_New_Entity;
end if;
end if;
Check_Synchronized_Overriding (S, Overridden_Subp);
......
......@@ -5929,6 +5929,12 @@ package body Sem_Res is
and then In_Open_Scopes (Tsk)
and then Nkind (Parent (Entry_Name)) = N_Requeue_Statement
then
-- Note: here Bound denotes a discriminant of the corresponding
-- record type tskV, whose discriminal is a formal of the
-- init-proc tskVIP. What we want is the body discriminal,
-- which is associated to the discriminant of the original
-- concurrent type tsk.
return New_Occurrence_Of
(Find_Body_Discriminal (Entity (Bound)), Loc);
......
......@@ -3070,9 +3070,11 @@ package body Sem_Util is
(Spec_Discriminant : Entity_Id) return Entity_Id
is
pragma Assert (Is_Concurrent_Record_Type (Scope (Spec_Discriminant)));
Tsk : constant Entity_Id :=
Corresponding_Concurrent_Type (Scope (Spec_Discriminant));
Disc : Entity_Id;
begin
-- Find discriminant of original concurrent type, and use its current
-- discriminal, which is the renaming within the task/protected body.
......
......@@ -331,7 +331,7 @@ package Sem_Util is
Typ : Entity_Id) return Entity_Id;
-- Because discriminants may have different names in a generic unit and in
-- an instance, they are resolved positionally when possible. A reference
-- to a discriminant carries the discriminant that it denotes when
-- to a discriminant carries the discriminant that it denotes when it is
-- analyzed. Subsequent uses of this id on a different type denotes the
-- discriminant at the same position in this new type.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment