@@ -22373,18 +22373,20 @@ \subsection{Subtypes}
22373
22373
% ------------------------------------------------ Positional Function Type
22374
22374
\RuleRawRaw{\SrnPositionalFunctionType}{%
22375
22375
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22376
+ \forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
22376
22377
\Subtype{\Delta'}{S_0}{T_0} \\
22377
22378
n_1 \leq n_2 &
22378
22379
n_1 + k_1 \geq n_2 + k_2 &
22379
22380
\forall j \in 1 .. n_2 + k_2\!:\;\Subtype{\Delta'}{T_j}{S_j}}{%
22380
22381
\begin{array}{c}
22381
22382
\Delta\vdash\RawFunctionTypePositional{S_0}{X}{B}{s}{S}{n_1}{k_1}\;<:\;\\
22382
- \RawFunctionTypePositional{T_0}{X}{B}{s}{T}{n_2}{k_2}
22383
+ \RawFunctionTypePositional{T_0}{X}{B'\! }{s}{T}{n_2}{k_2}
22383
22384
\end{array}}
22384
22385
\ExtraVSP\ExtraVSP
22385
22386
% ------------------------------------------------ Named Function Type
22386
22387
\RuleRawRaw{\SrnNamedFunctionType}{%
22387
22388
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22389
+ \forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
22388
22390
\Subtype{\Delta'}{S_0}{T_0} &
22389
22391
\forall j \in 1 .. n\!:\;\Subtype{\Delta'}{T_j}{S_j}\\
22390
22392
\{\,\List{y}{n+1}{n+k_2}\,\} \subseteq \{\,\List{x}{n+1}{n+k_1}\,\}\\
@@ -22394,13 +22396,16 @@ \subsection{Subtypes}
22394
22396
(r_{n+q} = \REQUIRED{} \Rightarrow r'_{n+p} = \REQUIRED)}{%
22395
22397
\begin{array}{c}
22396
22398
\Delta\vdash\RawFunctionTypeNamed{S_0}{X}{B}{s}{S}{n}{x}{k_1}{r}\;<:\;\\
22397
- \RawFunctionTypeNamed{T_0}{X}{B}{s}{T}{n}{y}{k_2}{r'}
22399
+ \RawFunctionTypeNamed{T_0}{X}{B'\! }{s}{T}{n}{y}{k_2}{r'}
22398
22400
\end{array}}
22399
22401
%
22400
22402
\ExtraVSP
22401
22403
% ------------------------------------------------ Covariance
22404
+ %% TODO(eernst): Type aliases have been expanded so there is no other
22405
+ %% variance than covariance, but there will be in/out/inout in classes,
22406
+ %% and then we'll need to handle variance here.
22402
22407
\RuleRaw{\SrnCovariance}{%
22403
- \mbox{$C$ is an interface type with $s$ type parameters} &
22408
+ \mbox{$C$ is an interface type with $s$ type parameters. } &
22404
22409
\SubtypeStd{S_j}{T_j}\mbox{, for each $j \in 1..s$}}{%
22405
22410
\code{$C$<\List{S}{1}{s}>}}{\code{$C$<\List{T}{1}{s}>}}
22406
22411
\ExtraVSP
@@ -22565,7 +22570,8 @@ \subsubsection{Subtype Rules}
22565
22570
In this specification we frequently refer to
22566
22571
subtype relationships and assignability
22567
22572
without mentioning the environment explicitly,
22568
- as in \Index{\SubtypeNE{S}{T}}.
22573
+ as in
22574
+ \IndexCustom{\SubtypeNE{S}{T}}{$<:$@\SubtypeNE{S}{T}}.
22569
22575
This is only done when a specific location in code is in focus,
22570
22576
and it means that the environment is that which is obtained
22571
22577
by mapping each type variable in scope at that location
@@ -22599,7 +22605,7 @@ \subsubsection{Being a Subtype}
22599
22605
A type $S$ is shown to be a \Index{subtype} of another type $T$
22600
22606
in an environment $\Delta$ by providing
22601
22607
an instantiation of a rule $R$ whose conclusion is
22602
- \IndexCustom{\SubtypeStd{S}{T}}{$\Delta$@\SubtypeStd{S}{T}},
22608
+ \IndexCustom{\SubtypeStd{S}{T}}{$\Delta<: $@\SubtypeStd{S}{T}},
22603
22609
along with rule instantiations showing
22604
22610
each of the premises of $R$,
22605
22611
continuing until a rule with no premises is reached.
@@ -22828,9 +22834,17 @@ \subsubsection{Additional Subtyping Concepts}
22828
22834
22829
22835
\LMHash{}%
22830
22836
$S$ is a \Index{supertype} of $T$ in a given environment $\Delta$,
22831
- written \SupertypeStd{S}{T},
22837
+ written
22838
+ \IndexCustom{\SupertypeStd{S}{T}}{$\Delta:>$@\SupertypeStd{S}{T}},
22832
22839
if{}f \SubtypeStd{T}{S}.
22833
22840
22841
+ \LMHash{}%
22842
+ $S$ and $T$ are \Index{mutual subtypes} of each other
22843
+ in a given environment $\Delta$,
22844
+ written
22845
+ \IndexCustom{\MutualSubtypeStd{S}{T}}{$\Delta<:>$@\MutualSubtypeStd{S}{T}},
22846
+ if{}f both \SubtypeStd{T}{S} and \SubtypeStd{S}{T}.
22847
+
22834
22848
\LMHash{}%
22835
22849
A type $T$
22836
22850
\Index{may be assigned}
@@ -22988,7 +23002,8 @@ \subsection{Functions Dealing with Extreme Types}
22988
23002
the first applicable case must be used.
22989
23003
22990
23004
\LMHash{}%
22991
- The \Index{\TopMergeTypeName} of two types computes
23005
+ The \IndexCustom{\TopMergeTypeName}{topMergeType@\TopMergeTypeName}
23006
+ of two types computes
22992
23007
a canonical type which represents both of them,
22993
23008
in the case where they are structurally identical
22994
23009
modulo the choice among top types.
@@ -23053,7 +23068,8 @@ \subsection{Functions Dealing with Extreme Types}
23053
23068
\commentary{The ordering of the arguments makes no difference.}
23054
23069
23055
23070
\LMHash{}%
23056
- The \Index{\IsTopTypeName} predicate is true for any type which is in
23071
+ The \IndexCustom{\IsTopTypeName}{isTopType@\IsTopTypeName}
23072
+ predicate is true for any type which is in
23057
23073
the equivalence class of top types.
23058
23074
It is a syntactic characterization of top types
23059
23075
(\ref{superBoundedTypes}).
@@ -23067,8 +23083,9 @@ \subsection{Functions Dealing with Extreme Types}
23067
23083
\end{itemize}
23068
23084
23069
23085
\noindent
23070
- The \Index{\IsObjectTypeName} predicate is true if{}f
23071
- the argument is a subtype and a supertype of \code{Object}.
23086
+ The \IndexCustom{\IsObjectTypeName}{isObjectType@\IsObjectTypeName}
23087
+ predicate is true if{}f the argument is
23088
+ a subtype and a supertype of \code{Object}.
23072
23089
23073
23090
\begin{itemize}
23074
23091
\item \DefEquals{\IsObjectType{Object}}{\metavar{true}}.
@@ -23077,8 +23094,8 @@ \subsection{Functions Dealing with Extreme Types}
23077
23094
\end{itemize}
23078
23095
23079
23096
\noindent
23080
- The \Index {\IsBottomTypeName} predicate is true if{}f
23081
- the argument is a subtype of \code{Never}.
23097
+ The \IndexCustom {\IsBottomTypeName}{isBottomType@\IsBottomTypeName}
23098
+ predicate is true if{}f the argument is a subtype of \code{Never}.
23082
23099
23083
23100
\begin{itemize}
23084
23101
\item \DefEquals{\IsBottomType{Never}}{\metavar{true}}.
@@ -23088,8 +23105,9 @@ \subsection{Functions Dealing with Extreme Types}
23088
23105
\end{itemize}
23089
23106
23090
23107
\noindent
23091
- The \Index{\IsNullTypeName} predicate is true if{}f
23092
- the argument is a subtype and a supertype of \code{Null}.
23108
+ The \IndexCustom{\IsNullTypeName}{isNullType@\IsNullTypeName}
23109
+ predicate is true if{}f the argument is
23110
+ a subtype and a supertype of \code{Null}.
23093
23111
23094
23112
\begin{itemize}
23095
23113
\item \DefEquals{\IsNullType{Null}}{\metavar{true}}.
@@ -23098,8 +23116,8 @@ \subsection{Functions Dealing with Extreme Types}
23098
23116
\end{itemize}
23099
23117
23100
23118
\noindent
23101
- The \Index {\IsMoreTopTypeName} predicate defines a total order on
23102
- top and \code{Object} types.
23119
+ The \IndexCustom {\IsMoreTopTypeName}{isMoreTopType@\IsMoreTopTypeName}
23120
+ predicate defines a total order on top and \code{Object} types.
23103
23121
23104
23122
\begin{itemize}
23105
23123
\item \DefEquals{\IsMoreTopType{\VOID}{$T$}}{\metavar{true}}.
@@ -23116,8 +23134,8 @@ \subsection{Functions Dealing with Extreme Types}
23116
23134
\end{itemize}
23117
23135
23118
23136
\noindent
23119
- The \Index {\IsMoreBottomTypeName} predicate defines an almost total order on
23120
- bottom and \code{Null} types.
23137
+ The \IndexCustom {\IsMoreBottomTypeName}{isMoreBottomType@\IsMoreBottomTypeName}
23138
+ predicate defines an almost total order on bottom and \code{Null} types.
23121
23139
\commentary{%
23122
23140
This does not consistently order
23123
23141
two different type variables with the same bound.%
@@ -23196,7 +23214,9 @@ \subsection{Type Normalization}
23196
23214
}
23197
23215
23198
23216
\LMHash{}%
23199
- The function \Index{\NormalizedTypeOfName} is then defined as follows:
23217
+ The function
23218
+ \IndexCustom{\NormalizedTypeOfName}{normalizedType@\NormalizedTypeOfName}
23219
+ is then defined as follows:
23200
23220
\BlindDefineSymbol{T_a, T_u, T_r}%
23201
23221
Let $T_a$ be a type
23202
23222
(\commentary{where `a' stands for `argument'}).
0 commit comments