@@ -22169,18 +22169,20 @@ \subsection{Subtypes}
22169
22169
% ------------------------------------------------ Positional Function Type
22170
22170
\RuleRawRaw{\SrnPositionalFunctionType}{%
22171
22171
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22172
+ \forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
22172
22173
\Subtype{\Delta'}{S_0}{T_0} \\
22173
22174
n_1 \leq n_2 &
22174
22175
n_1 + k_1 \geq n_2 + k_2 &
22175
22176
\forall j \in 1 .. n_2 + k_2\!:\;\Subtype{\Delta'}{T_j}{S_j}}{%
22176
22177
\begin{array}{c}
22177
22178
\Delta\vdash\RawFunctionTypePositional{S_0}{X}{B}{s}{S}{n_1}{k_1}\;<:\;\\
22178
- \RawFunctionTypePositional{T_0}{X}{B}{s}{T}{n_2}{k_2}
22179
+ \RawFunctionTypePositional{T_0}{X}{B'\! }{s}{T}{n_2}{k_2}
22179
22180
\end{array}}
22180
22181
\ExtraVSP\ExtraVSP
22181
22182
% ------------------------------------------------ Named Function Type
22182
22183
\RuleRawRaw{\SrnNamedFunctionType}{%
22183
22184
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22185
+ \forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
22184
22186
\Subtype{\Delta'}{S_0}{T_0} &
22185
22187
\forall j \in 1 .. n\!:\;\Subtype{\Delta'}{T_j}{S_j}\\
22186
22188
\{\,\List{y}{n+1}{n+k_2}\,\} \subseteq \{\,\List{x}{n+1}{n+k_1}\,\}\\
@@ -22190,13 +22192,16 @@ \subsection{Subtypes}
22190
22192
(r_{n+q} = \REQUIRED{} \Rightarrow r'_{n+p} = \REQUIRED)}{%
22191
22193
\begin{array}{c}
22192
22194
\Delta\vdash\RawFunctionTypeNamed{S_0}{X}{B}{s}{S}{n}{x}{k_1}{r}\;<:\;\\
22193
- \RawFunctionTypeNamed{T_0}{X}{B}{s}{T}{n}{y}{k_2}{r'}
22195
+ \RawFunctionTypeNamed{T_0}{X}{B'\! }{s}{T}{n}{y}{k_2}{r'}
22194
22196
\end{array}}
22195
22197
%
22196
22198
\ExtraVSP
22197
22199
% ------------------------------------------------ Covariance
22200
+ %% TODO(eernst): Type aliases have been expanded so there is no other
22201
+ %% variance than covariance, but there will be in/out/inout in classes,
22202
+ %% and then we'll need to handle variance here.
22198
22203
\RuleRaw{\SrnCovariance}{%
22199
- \mbox{$C$ is an interface type with $s$ type parameters} &
22204
+ \mbox{$C$ is an interface type with $s$ type parameters. } &
22200
22205
\SubtypeStd{S_j}{T_j}\mbox{, for each $j \in 1..s$}}{%
22201
22206
\code{$C$<\List{S}{1}{s}>}}{\code{$C$<\List{T}{1}{s}>}}
22202
22207
\ExtraVSP
@@ -22361,7 +22366,8 @@ \subsubsection{Subtype Rules}
22361
22366
In this specification we frequently refer to
22362
22367
subtype relationships and assignability
22363
22368
without mentioning the environment explicitly,
22364
- as in \Index{\SubtypeNE{S}{T}}.
22369
+ as in
22370
+ \IndexCustom{\SubtypeNE{S}{T}}{$<:$@\SubtypeNE{S}{T}}.
22365
22371
This is only done when a specific location in code is in focus,
22366
22372
and it means that the environment is that which is obtained
22367
22373
by mapping each type variable in scope at that location
@@ -22395,7 +22401,7 @@ \subsubsection{Being a Subtype}
22395
22401
A type $S$ is shown to be a \Index{subtype} of another type $T$
22396
22402
in an environment $\Delta$ by providing
22397
22403
an instantiation of a rule $R$ whose conclusion is
22398
- \IndexCustom{\SubtypeStd{S}{T}}{$\Delta$@\SubtypeStd{S}{T}},
22404
+ \IndexCustom{\SubtypeStd{S}{T}}{$\Delta<: $@\SubtypeStd{S}{T}},
22399
22405
along with rule instantiations showing
22400
22406
each of the premises of $R$,
22401
22407
continuing until a rule with no premises is reached.
@@ -22624,9 +22630,17 @@ \subsubsection{Additional Subtyping Concepts}
22624
22630
22625
22631
\LMHash{}%
22626
22632
$S$ is a \Index{supertype} of $T$ in a given environment $\Delta$,
22627
- written \SupertypeStd{S}{T},
22633
+ written
22634
+ \IndexCustom{\SupertypeStd{S}{T}}{$\Delta:>$@\SupertypeStd{S}{T}},
22628
22635
if{}f \SubtypeStd{T}{S}.
22629
22636
22637
+ \LMHash{}%
22638
+ $S$ and $T$ are \Index{mutual subtypes} of each other
22639
+ in a given environment $\Delta$,
22640
+ written
22641
+ \IndexCustom{\MutualSubtypeStd{S}{T}}{$\Delta<:>$@\MutualSubtypeStd{S}{T}},
22642
+ if{}f both \SubtypeStd{T}{S} and \SubtypeStd{S}{T}.
22643
+
22630
22644
\LMHash{}%
22631
22645
A type $T$
22632
22646
\Index{may be assigned}
@@ -22784,7 +22798,8 @@ \subsection{Functions Dealing with Extreme Types}
22784
22798
the first applicable case must be used.
22785
22799
22786
22800
\LMHash{}%
22787
- The \Index{\TopMergeTypeName} of two types computes
22801
+ The \IndexCustom{\TopMergeTypeName}{topMergeType@\TopMergeTypeName}
22802
+ of two types computes
22788
22803
a canonical type which represents both of them,
22789
22804
in the case where they are structurally identical
22790
22805
modulo the choice among top types.
@@ -22849,7 +22864,8 @@ \subsection{Functions Dealing with Extreme Types}
22849
22864
\commentary{The ordering of the arguments makes no difference.}
22850
22865
22851
22866
\LMHash{}%
22852
- The \Index{\IsTopTypeName} predicate is true for any type which is in
22867
+ The \IndexCustom{\IsTopTypeName}{isTopType@\IsTopTypeName}
22868
+ predicate is true for any type which is in
22853
22869
the equivalence class of top types.
22854
22870
It is a syntactic characterization of top types
22855
22871
(\ref{superBoundedTypes}).
@@ -22863,8 +22879,9 @@ \subsection{Functions Dealing with Extreme Types}
22863
22879
\end{itemize}
22864
22880
22865
22881
\noindent
22866
- The \Index{\IsObjectTypeName} predicate is true if{}f
22867
- the argument is a subtype and a supertype of \code{Object}.
22882
+ The \IndexCustom{\IsObjectTypeName}{isObjectType@\IsObjectTypeName}
22883
+ predicate is true if{}f the argument is
22884
+ a subtype and a supertype of \code{Object}.
22868
22885
22869
22886
\begin{itemize}
22870
22887
\item \DefEquals{\IsObjectType{Object}}{\metavar{true}}.
@@ -22873,8 +22890,8 @@ \subsection{Functions Dealing with Extreme Types}
22873
22890
\end{itemize}
22874
22891
22875
22892
\noindent
22876
- The \Index {\IsBottomTypeName} predicate is true if{}f
22877
- the argument is a subtype of \code{Never}.
22893
+ The \IndexCustom {\IsBottomTypeName}{isBottomType@\IsBottomTypeName}
22894
+ predicate is true if{}f the argument is a subtype of \code{Never}.
22878
22895
22879
22896
\begin{itemize}
22880
22897
\item \DefEquals{\IsBottomType{Never}}{\metavar{true}}.
@@ -22884,8 +22901,9 @@ \subsection{Functions Dealing with Extreme Types}
22884
22901
\end{itemize}
22885
22902
22886
22903
\noindent
22887
- The \Index{\IsNullTypeName} predicate is true if{}f
22888
- the argument is a subtype and a supertype of \code{Null}.
22904
+ The \IndexCustom{\IsNullTypeName}{isNullType@\IsNullTypeName}
22905
+ predicate is true if{}f the argument is
22906
+ a subtype and a supertype of \code{Null}.
22889
22907
22890
22908
\begin{itemize}
22891
22909
\item \DefEquals{\IsNullType{Null}}{\metavar{true}}.
@@ -22894,8 +22912,8 @@ \subsection{Functions Dealing with Extreme Types}
22894
22912
\end{itemize}
22895
22913
22896
22914
\noindent
22897
- The \Index {\IsMoreTopTypeName} predicate defines a total order on
22898
- top and \code{Object} types.
22915
+ The \IndexCustom {\IsMoreTopTypeName}{isMoreTopType@\IsMoreTopTypeName}
22916
+ predicate defines a total order on top and \code{Object} types.
22899
22917
22900
22918
\begin{itemize}
22901
22919
\item \DefEquals{\IsMoreTopType{\VOID}{$T$}}{\metavar{true}}.
@@ -22912,8 +22930,8 @@ \subsection{Functions Dealing with Extreme Types}
22912
22930
\end{itemize}
22913
22931
22914
22932
\noindent
22915
- The \Index {\IsMoreBottomTypeName} predicate defines an almost total order on
22916
- bottom and \code{Null} types.
22933
+ The \IndexCustom {\IsMoreBottomTypeName}{isMoreBottomType@\IsMoreBottomTypeName}
22934
+ predicate defines an almost total order on bottom and \code{Null} types.
22917
22935
\commentary{%
22918
22936
This does not consistently order
22919
22937
two different type variables with the same bound.%
@@ -22992,7 +23010,9 @@ \subsection{Type Normalization}
22992
23010
}
22993
23011
22994
23012
\LMHash{}%
22995
- The function \Index{\NormalizedTypeOfName} is then defined as follows:
23013
+ The function
23014
+ \IndexCustom{\NormalizedTypeOfName}{normalizedType@\NormalizedTypeOfName}
23015
+ is then defined as follows:
22996
23016
\BlindDefineSymbol{T_a, T_u, T_r}%
22997
23017
Let $T_a$ be a type
22998
23018
(\commentary{where `a' stands for `argument'}).
0 commit comments