Contents Index Search Previous Next
4.9.1 Statically Matching Constraints and Subtypes
Static Semantics
1
{statically matching (for constraints)}
A constraint
statically matches another constraint
if both are null constraints, both are static and have equal corresponding
bounds or discriminant values, or both are nonstatic and result from
the same elaboration of a
constraint
of a
subtype_indication or the same
evaluation of a
range of a
discrete_subtype_definition.
2
{statically matching (for subtypes)}
A subtype
statically matches another subtype
of the same type if they have statically matching constraints. Two anonymous
access subtypes statically match if their designated subtypes statically
match.
2.a
Ramification: Statically
matching constraints and subtypes are the basis for subtype conformance
of profiles (see 6.3.1).
3
{statically matching (for ranges)}
Two ranges of the same type
statically match
if both result from the same evaluation of a
range,
or if both are static and have equal corresponding bounds.
3.a
Ramification: The notion
of static matching of ranges is used in 12.5.3,
``Formal Array Types''; the index ranges
of formal and actual constrained array subtypes have to statically match.
4
{statically compatible (for
a constraint and a scalar subtype)} A
constraint is
statically compatible with a scalar subtype if it
statically matches the constraint of the subtype, or if both are static
and the constraint is compatible with the subtype.
{statically
compatible (for a constraint and an access or composite subtype)}
A constraint is
statically compatible with
an access or composite subtype if it statically matches the constraint
of the subtype, or if the subtype is unconstrained.
{statically
compatible (for two subtypes)} One subtype
is
statically compatible with a second subtype if the constraint
of the first is statically compatible with the second subtype.
4.a
Discussion: Static compatibility
is required when constraining a parent subtype with a discriminant from
a new discriminant_part. See 3.7.
Static compatibility is also used in matching generic formal derived
types.
4.b
Note that statically compatible
with a subtype does not imply compatible with a type. It is OK since
the terms are used in different contexts.
Wording Changes from Ada 83
4.c
This subclause is new to Ada
95.
Contents Index Search Previous Next Legal