if Subtypes_Statically_Match (T1, T2) then
return True;
- -- If either subtype is nonstatic then they're not compatible
+ -- A scalar subtype S1 is compatible with S2 if their bounds
+ -- are static and compatible, even if S1 has dynamic predicates
+ -- and is thus non-static. Predicate compatibility has been
+ -- checked above.
- elsif not Is_OK_Static_Subtype (T1)
- or else
- not Is_OK_Static_Subtype (T2)
+ elsif not Is_Static_Range (Scalar_Range (T1))
+ or else not Is_Static_Range (Scalar_Range (T2))
then
return False;
and then not (Can_Never_Be_Null (T2)
and then not Can_Never_Be_Null (T1));
+ -- Private types without discriminants can be handled specially.
+ -- Predicate matching has been checked above.
+
+ elsif Is_Private_Type (T1)
+ and then not Has_Discriminants (T1)
+ then
+ return not Has_Discriminants (T2);
+
-- All other cases
else