@@ -22108,18 +22108,20 @@ \subsection{Subtypes}
22108
22108
% ------------------------------------------------ Positional Function Type
22109
22109
\RuleRawRaw{\SrnPositionalFunctionType}{%
22110
22110
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22111
+ \forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
22111
22112
\Subtype{\Delta'}{S_0}{T_0} \\
22112
22113
n_1 \leq n_2 &
22113
22114
n_1 + k_1 \geq n_2 + k_2 &
22114
22115
\forall j \in 1 .. n_2 + k_2\!:\;\Subtype{\Delta'}{T_j}{S_j}}{%
22115
22116
\begin{array}{c}
22116
22117
\Delta\vdash\RawFunctionTypePositional{S_0}{X}{B}{s}{S}{n_1}{k_1}\;<:\;\\
22117
- \RawFunctionTypePositional{T_0}{X}{B}{s}{T}{n_2}{k_2}
22118
+ \RawFunctionTypePositional{T_0}{X}{B'\! }{s}{T}{n_2}{k_2}
22118
22119
\end{array}}
22119
22120
\ExtraVSP\ExtraVSP
22120
22121
% ------------------------------------------------ Named Function Type
22121
22122
\RuleRawRaw{\SrnNamedFunctionType}{%
22122
22123
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22124
+ \forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
22123
22125
\Subtype{\Delta'}{S_0}{T_0} &
22124
22126
\forall j \in 1 .. n\!:\;\Subtype{\Delta'}{T_j}{S_j}\\
22125
22127
\{\,\List{y}{n+1}{n+k_2}\,\} \subseteq \{\,\List{x}{n+1}{n+k_1}\,\}\\
@@ -22129,13 +22131,16 @@ \subsection{Subtypes}
22129
22131
(r_{n+q} = \REQUIRED{} \Rightarrow r'_{n+p} = \REQUIRED)}{%
22130
22132
\begin{array}{c}
22131
22133
\Delta\vdash\RawFunctionTypeNamed{S_0}{X}{B}{s}{S}{n}{x}{k_1}{r}\;<:\;\\
22132
- \RawFunctionTypeNamed{T_0}{X}{B}{s}{T}{n}{y}{k_2}{r'}
22134
+ \RawFunctionTypeNamed{T_0}{X}{B'\! }{s}{T}{n}{y}{k_2}{r'}
22133
22135
\end{array}}
22134
22136
%
22135
22137
\ExtraVSP
22136
22138
% ------------------------------------------------ Covariance
22139
+ %% TODO(eernst): Type aliases have been expanded so there is no other
22140
+ %% variance than covariance, but there will be in/out/inout in classes,
22141
+ %% and then we'll need to handle variance here.
22137
22142
\RuleRaw{\SrnCovariance}{%
22138
- \mbox{$C$ is an interface type with $s$ type parameters} &
22143
+ \mbox{$C$ is an interface type with $s$ type parameters. } &
22139
22144
\SubtypeStd{S_j}{T_j}\mbox{, for each $j \in 1..s$}}{%
22140
22145
\code{$C$<\List{S}{1}{s}>}}{\code{$C$<\List{T}{1}{s}>}}
22141
22146
\ExtraVSP
@@ -22300,7 +22305,8 @@ \subsubsection{Subtype Rules}
22300
22305
In this specification we frequently refer to
22301
22306
subtype relationships and assignability
22302
22307
without mentioning the environment explicitly,
22303
- as in \Index{\SubtypeNE{S}{T}}.
22308
+ as in
22309
+ \IndexCustom{\SubtypeNE{S}{T}}{$<:$@\SubtypeNE{S}{T}}.
22304
22310
This is only done when a specific location in code is in focus,
22305
22311
and it means that the environment is that which is obtained
22306
22312
by mapping each type variable in scope at that location
@@ -22334,7 +22340,7 @@ \subsubsection{Being a Subtype}
22334
22340
A type $S$ is shown to be a \Index{subtype} of another type $T$
22335
22341
in an environment $\Delta$ by providing
22336
22342
an instantiation of a rule $R$ whose conclusion is
22337
- \IndexCustom{\SubtypeStd{S}{T}}{$\Delta$@\SubtypeStd{S}{T}},
22343
+ \IndexCustom{\SubtypeStd{S}{T}}{$\Delta<: $@\SubtypeStd{S}{T}},
22338
22344
along with rule instantiations showing
22339
22345
each of the premises of $R$,
22340
22346
continuing until a rule with no premises is reached.
@@ -22563,9 +22569,17 @@ \subsubsection{Additional Subtyping Concepts}
22563
22569
22564
22570
\LMHash{}%
22565
22571
$S$ is a \Index{supertype} of $T$ in a given environment $\Delta$,
22566
- written \SupertypeStd{S}{T},
22572
+ written
22573
+ \IndexCustom{\SupertypeStd{S}{T}}{$\Delta:>$@\SupertypeStd{S}{T}},
22567
22574
if{}f \SubtypeStd{T}{S}.
22568
22575
22576
+ \LMHash{}%
22577
+ $S$ and $T$ are \Index{mutual subtypes} of each other
22578
+ in a given environment $\Delta$,
22579
+ written
22580
+ \IndexCustom{\MutualSubtypeStd{S}{T}}{$\Delta<:>$@\MutualSubtypeStd{S}{T}},
22581
+ if{}f both \SubtypeStd{T}{S} and \SubtypeStd{S}{T}.
22582
+
22569
22583
\LMHash{}%
22570
22584
A type $T$
22571
22585
\Index{may be assigned}
@@ -22723,7 +22737,8 @@ \subsection{Functions Dealing with Extreme Types}
22723
22737
the first applicable case must be used.
22724
22738
22725
22739
\LMHash{}%
22726
- The \Index{\TopMergeTypeName} of two types computes
22740
+ The \IndexCustom{\TopMergeTypeName}{topMergeType@\TopMergeTypeName}
22741
+ of two types computes
22727
22742
a canonical type which represents both of them,
22728
22743
in the case where they are structurally identical
22729
22744
modulo the choice among top types.
@@ -22788,7 +22803,8 @@ \subsection{Functions Dealing with Extreme Types}
22788
22803
\commentary{The ordering of the arguments makes no difference.}
22789
22804
22790
22805
\LMHash{}%
22791
- The \Index{\IsTopTypeName} predicate is true for any type which is in
22806
+ The \IndexCustom{\IsTopTypeName}{isTopType@\IsTopTypeName}
22807
+ predicate is true for any type which is in
22792
22808
the equivalence class of top types.
22793
22809
It is a syntactic characterization of top types
22794
22810
(\ref{superBoundedTypes}).
@@ -22802,8 +22818,9 @@ \subsection{Functions Dealing with Extreme Types}
22802
22818
\end{itemize}
22803
22819
22804
22820
\noindent
22805
- The \Index{\IsObjectTypeName} predicate is true if{}f
22806
- the argument is a subtype and a supertype of \code{Object}.
22821
+ The \IndexCustom{\IsObjectTypeName}{isObjectType@\IsObjectTypeName}
22822
+ predicate is true if{}f the argument is
22823
+ a subtype and a supertype of \code{Object}.
22807
22824
22808
22825
\begin{itemize}
22809
22826
\item \DefEquals{\IsObjectType{Object}}{\metavar{true}}.
@@ -22812,8 +22829,8 @@ \subsection{Functions Dealing with Extreme Types}
22812
22829
\end{itemize}
22813
22830
22814
22831
\noindent
22815
- The \Index {\IsBottomTypeName} predicate is true if{}f
22816
- the argument is a subtype of \code{Never}.
22832
+ The \IndexCustom {\IsBottomTypeName}{isBottomType@\IsBottomTypeName}
22833
+ predicate is true if{}f the argument is a subtype of \code{Never}.
22817
22834
22818
22835
\begin{itemize}
22819
22836
\item \DefEquals{\IsBottomType{Never}}{\metavar{true}}.
@@ -22823,8 +22840,9 @@ \subsection{Functions Dealing with Extreme Types}
22823
22840
\end{itemize}
22824
22841
22825
22842
\noindent
22826
- The \Index{\IsNullTypeName} predicate is true if{}f
22827
- the argument is a subtype and a supertype of \code{Null}.
22843
+ The \IndexCustom{\IsNullTypeName}{isNullType@\IsNullTypeName}
22844
+ predicate is true if{}f the argument is
22845
+ a subtype and a supertype of \code{Null}.
22828
22846
22829
22847
\begin{itemize}
22830
22848
\item \DefEquals{\IsNullType{Null}}{\metavar{true}}.
@@ -22833,8 +22851,8 @@ \subsection{Functions Dealing with Extreme Types}
22833
22851
\end{itemize}
22834
22852
22835
22853
\noindent
22836
- The \Index {\IsMoreTopTypeName} predicate defines a total order on
22837
- top and \code{Object} types.
22854
+ The \IndexCustom {\IsMoreTopTypeName}{isMoreTopType@\IsMoreTopTypeName}
22855
+ predicate defines a total order on top and \code{Object} types.
22838
22856
22839
22857
\begin{itemize}
22840
22858
\item \DefEquals{\IsMoreTopType{\VOID}{$T$}}{\metavar{true}}.
@@ -22851,8 +22869,8 @@ \subsection{Functions Dealing with Extreme Types}
22851
22869
\end{itemize}
22852
22870
22853
22871
\noindent
22854
- The \Index {\IsMoreBottomTypeName} predicate defines an almost total order on
22855
- bottom and \code{Null} types.
22872
+ The \IndexCustom {\IsMoreBottomTypeName}{isMoreBottomType@\IsMoreBottomTypeName}
22873
+ predicate defines an almost total order on bottom and \code{Null} types.
22856
22874
\commentary{%
22857
22875
This does not consistently order
22858
22876
two different type variables with the same bound.%
@@ -22931,7 +22949,9 @@ \subsection{Type Normalization}
22931
22949
}
22932
22950
22933
22951
\LMHash{}%
22934
- The function \Index{\NormalizedTypeOfName} is then defined as follows:
22952
+ The function
22953
+ \IndexCustom{\NormalizedTypeOfName}{normalizedType@\NormalizedTypeOfName}
22954
+ is then defined as follows:
22935
22955
\BlindDefineSymbol{T_a, T_u, T_r}%
22936
22956
Let $T_a$ be a type
22937
22957
(\commentary{where `a' stands for `argument'}).
0 commit comments