Implicit Subclass Rule
Let
B = C#(S1; S2; ... ; Sn)P1,...,Pg
A = C#(T1; T2; ... ; Tm)Q1,...,Qh
be two simple classes. Class A is an implicit subclass of B, if
-
for each class parameter Si defined in B, there is a Tj in A, such that
-
if Si is a type name in the form Si=X, Tj is in the form Tj=Y,
and X is equivalent to Y;
-
if Si is a type name in the form Si:X, Tj is in the form Tj=Y,
and Y is subtype of X;
-
if Si is an object name in the form Si=X, Tj is in the form Tj=Y,
and X and Y are constants with equal value;
-
for each interface with list type Pi defined in B, there is an interface
with list type Qj in A, such that Pi is equivalent to Qj.
If A is an implicit subclass of B and B is an implicit subclass of A, A and B are equivalent simple classes.
Tuple Subtype Rule
Given two tuple types:
L1 = < S1:C1; S2:C2; ... ; Sn:Cn > (e1:E1; e2:E2; ... ; ep:Ep)
L2 = < T1; T2; ... ; Tm > (f1:F1; f2:F2; ... ; fq:Fq)
L2 is a subtype of L1 if and only if
-
m>=n and q>=p; and
-
for each Si in L1, Ti in L2 has the form either Si:Di or Si=Di where
Di is subtype of Ci;
-
for each element ei:
-
if it is a type name Ei is a subtype of Fi;
-
otherwise Ei is equivalent to Fi;