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