sem_ch4.adb (Try_Primitive_Operation): Code cleanup to ensure that we generate the...
authorEd Schonberg <schonberg@adacore.com>
Tue, 31 Oct 2006 18:07:13 +0000 (19:07 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Tue, 31 Oct 2006 18:07:13 +0000 (19:07 +0100)
commitb67a385c629b7a6c3fab21d1da2c2e7879951c30
tree1871b0662cc5ad20169a149435da0fc7989acdb0
parentaffbee12f4cd5c6eefd53f78dca2f2db313a06b7
sem_ch4.adb (Try_Primitive_Operation): Code cleanup to ensure that we generate the same errors compiling under -gnatc.

2006-10-31  Ed Schonberg  <schonberg@adacore.com>
    Javier Miranda  <miranda@adacore.com>
    Robert Dewar  <dewar@adacore.com>

* sem_ch4.adb (Try_Primitive_Operation): Code cleanup to ensure that we
generate the same errors compiling under -gnatc.
(Try_Object_Operation): If no candidate interpretation succeeds, but
there is at least one primitive operation with the right name, report
error in call rather than on a malformed selected component.
(Analyze_Selected_Component): If the prefix is an incomplete type from
a limited view, and the full view is available, use the full view to
determine whether this is a prefixed call to a primitive operation.
(Operator_Check): Verify that a candidate interpretation is a binary
operation before checking the type of its second formal.
(Analyze_Call): Add additional warnings for function call contexts not
yet supported.
(Analyze_Allocator): Move the check for "initialization not allowed for
limited types" after analyzing the expression. This is necessary,
because OK_For_Limited_Init looks at the structure of the expression.
Before analysis, we don't necessarily know what sort of expression it
is. For example, we don't know whether F(X) is a function call or an
indexed component; the former is legal in Ada 2005; the latter is not.
(Analyze_Allocator): Correct code for AI-287 -- extension aggregates
were missing. We also didn't handle qualified expressions. Now also
allow function calls. Use new common routine OK_For_Limited_Init.
(Analyze_Type_Conversion): Do not perform some legality checks in an
instance, because the error message will be redundant or spurious.
(Analyze_Overloaded_Selected_Component): Do not do style check when
setting an entity, since we do not know it is the right entity yet.
(Analyze_Selected_Component): Move Generate_Reference call to Sem_Res
(Analyze_Overloaded_Selected_Component): Same change
(Analyze_Selected_Component): Remove unnecessary prefix type retrieval
since regular incomplete subtypes are transformed into corresponding
subtypes of their full views.
(Complete_Object_Operation): Treat name of transformed subprogram call
as coming from source, for browsing purposes.
(Try_Primitive_Operation): If formal is an access parameter, compare
with base type of object to determine whether it is a primitive
operation.
(Operator_Check): If no interpretation of the operator matches, check
whether a use clause on any candidate might make the operation legal.
(Try_Class_Wide_Operation): Check whether the first parameter is an
access type whose designated type is class-wide.

From-SVN: r118302
gcc/ada/sem_ch4.adb