@@ -22987,18 +22987,20 @@ \subsection{Subtypes}
22987
22987
% ------------------------------------------------ Positional Function Type
22988
22988
\RuleRawRaw{\SrnPositionalFunctionType}{%
22989
22989
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22990
+ \forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
22990
22991
\Subtype{\Delta'}{S_0}{T_0} \\
22991
22992
n_1 \leq n_2 &
22992
22993
n_1 + k_1 \geq n_2 + k_2 &
22993
22994
\forall j \in 1 .. n_2 + k_2\!:\;\Subtype{\Delta'}{T_j}{S_j}}{%
22994
22995
\begin{array}{c}
22995
22996
\Delta\vdash\RawFunctionTypePositional{S_0}{X}{B}{s}{S}{n_1}{k_1}\;<:\;\\
22996
- \RawFunctionTypePositional{T_0}{X}{B}{s}{T}{n_2}{k_2}
22997
+ \RawFunctionTypePositional{T_0}{X}{B'\! }{s}{T}{n_2}{k_2}
22997
22998
\end{array}}
22998
22999
\ExtraVSP\ExtraVSP
22999
23000
% ------------------------------------------------ Named Function Type
23000
23001
\RuleRawRaw{\SrnNamedFunctionType}{%
23001
23002
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
23003
+ \forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
23002
23004
\Subtype{\Delta'}{S_0}{T_0} &
23003
23005
\forall j \in 1 .. n\!:\;\Subtype{\Delta'}{T_j}{S_j}\\
23004
23006
\{\,\List{y}{n+1}{n+k_2}\,\} \subseteq \{\,\List{x}{n+1}{n+k_1}\,\}\\
@@ -23008,13 +23010,16 @@ \subsection{Subtypes}
23008
23010
(r_{n+q} = \REQUIRED{} \Rightarrow r'_{n+p} = \REQUIRED)}{%
23009
23011
\begin{array}{c}
23010
23012
\Delta\vdash\RawFunctionTypeNamed{S_0}{X}{B}{s}{S}{n}{x}{k_1}{r}\;<:\;\\
23011
- \RawFunctionTypeNamed{T_0}{X}{B}{s}{T}{n}{y}{k_2}{r'}
23013
+ \RawFunctionTypeNamed{T_0}{X}{B'\! }{s}{T}{n}{y}{k_2}{r'}
23012
23014
\end{array}}
23013
23015
%
23014
23016
\ExtraVSP
23015
23017
% ------------------------------------------------ Covariance
23018
+ %% TODO(eernst): Type aliases have been expanded so there is no other
23019
+ %% variance than covariance, but there will be in/out/inout in classes,
23020
+ %% and then we'll need to handle variance here.
23016
23021
\RuleRaw{\SrnCovariance}{%
23017
- \mbox{$C$ is an interface type with $s$ type parameters} &
23022
+ \mbox{$C$ is an interface type with $s$ type parameters. } &
23018
23023
\SubtypeStd{S_j}{T_j}\mbox{, for each $j \in 1..s$}}{%
23019
23024
\code{$C$<\List{S}{1}{s}>}}{\code{$C$<\List{T}{1}{s}>}}
23020
23025
\ExtraVSP
@@ -23181,7 +23186,8 @@ \subsubsection{Subtype Rules}
23181
23186
In this specification we frequently refer to
23182
23187
subtype relationships and assignability
23183
23188
without mentioning the environment explicitly,
23184
- as in \Index{\SubtypeNE{S}{T}}.
23189
+ as in
23190
+ \IndexCustom{\SubtypeNE{S}{T}}{$<:$@\SubtypeNE{S}{T}}.
23185
23191
This is only done when a specific location in code is in focus,
23186
23192
and it means that the environment is that which is obtained
23187
23193
by mapping each type variable in scope at that location
@@ -23215,7 +23221,7 @@ \subsubsection{Being a Subtype}
23215
23221
A type $S$ is shown to be a \Index{subtype} of another type $T$
23216
23222
in an environment $\Delta$ by providing
23217
23223
an instantiation of a rule $R$ whose conclusion is
23218
- \IndexCustom{\SubtypeStd{S}{T}}{$\Delta$@\SubtypeStd{S}{T}},
23224
+ \IndexCustom{\SubtypeStd{S}{T}}{$\Delta<: $@\SubtypeStd{S}{T}},
23219
23225
along with rule instantiations showing
23220
23226
each of the premises of $R$,
23221
23227
continuing until a rule with no premises is reached.
@@ -23444,9 +23450,17 @@ \subsubsection{Additional Subtyping Concepts}
23444
23450
23445
23451
\LMHash{}%
23446
23452
$S$ is a \Index{supertype} of $T$ in a given environment $\Delta$,
23447
- written \SupertypeStd{S}{T},
23453
+ written
23454
+ \IndexCustom{\SupertypeStd{S}{T}}{$\Delta:>$@\SupertypeStd{S}{T}},
23448
23455
if{}f \SubtypeStd{T}{S}.
23449
23456
23457
+ \LMHash{}%
23458
+ $S$ and $T$ are \Index{mutual subtypes} of each other
23459
+ in a given environment $\Delta$,
23460
+ written
23461
+ \IndexCustom{\MutualSubtypeStd{S}{T}}{$\Delta<:>$@\MutualSubtypeStd{S}{T}},
23462
+ if{}f both \SubtypeStd{T}{S} and \SubtypeStd{S}{T}.
23463
+
23450
23464
\LMHash{}%
23451
23465
A type $T$
23452
23466
\Index{may be assigned}
@@ -23604,7 +23618,8 @@ \subsection{Functions Dealing with Extreme Types}
23604
23618
the first applicable case must be used.
23605
23619
23606
23620
\LMHash{}%
23607
- The \Index{\TopMergeTypeName} of two types computes
23621
+ The \IndexCustom{\TopMergeTypeName}{topMergeType@\TopMergeTypeName}
23622
+ of two types computes
23608
23623
a canonical type which represents both of them,
23609
23624
in the case where they are structurally identical
23610
23625
modulo the choice among top types.
@@ -23669,7 +23684,8 @@ \subsection{Functions Dealing with Extreme Types}
23669
23684
\commentary{The ordering of the arguments makes no difference.}
23670
23685
23671
23686
\LMHash{}%
23672
- The \Index{\IsTopTypeName} predicate is true for any type which is in
23687
+ The \IndexCustom{\IsTopTypeName}{isTopType@\IsTopTypeName}
23688
+ predicate is true for any type which is in
23673
23689
the equivalence class of top types.
23674
23690
It is a syntactic characterization of top types
23675
23691
(\ref{superBoundedTypes}).
@@ -23683,8 +23699,9 @@ \subsection{Functions Dealing with Extreme Types}
23683
23699
\end{itemize}
23684
23700
23685
23701
\noindent
23686
- The \Index{\IsObjectTypeName} predicate is true if{}f
23687
- the argument is a subtype and a supertype of \code{Object}.
23702
+ The \IndexCustom{\IsObjectTypeName}{isObjectType@\IsObjectTypeName}
23703
+ predicate is true if{}f the argument is
23704
+ a subtype and a supertype of \code{Object}.
23688
23705
23689
23706
\begin{itemize}
23690
23707
\item \DefEquals{\IsObjectType{Object}}{\metavar{true}}.
@@ -23693,8 +23710,8 @@ \subsection{Functions Dealing with Extreme Types}
23693
23710
\end{itemize}
23694
23711
23695
23712
\noindent
23696
- The \Index {\IsBottomTypeName} predicate is true if{}f
23697
- the argument is a subtype of \code{Never}.
23713
+ The \IndexCustom {\IsBottomTypeName}{isBottomType@\IsBottomTypeName}
23714
+ predicate is true if{}f the argument is a subtype of \code{Never}.
23698
23715
23699
23716
\begin{itemize}
23700
23717
\item \DefEquals{\IsBottomType{Never}}{\metavar{true}}.
@@ -23704,8 +23721,9 @@ \subsection{Functions Dealing with Extreme Types}
23704
23721
\end{itemize}
23705
23722
23706
23723
\noindent
23707
- The \Index{\IsNullTypeName} predicate is true if{}f
23708
- the argument is a subtype and a supertype of \code{Null}.
23724
+ The \IndexCustom{\IsNullTypeName}{isNullType@\IsNullTypeName}
23725
+ predicate is true if{}f the argument is
23726
+ a subtype and a supertype of \code{Null}.
23709
23727
23710
23728
\begin{itemize}
23711
23729
\item \DefEquals{\IsNullType{Null}}{\metavar{true}}.
@@ -23714,8 +23732,8 @@ \subsection{Functions Dealing with Extreme Types}
23714
23732
\end{itemize}
23715
23733
23716
23734
\noindent
23717
- The \Index {\IsMoreTopTypeName} predicate defines a total order on
23718
- top and \code{Object} types.
23735
+ The \IndexCustom {\IsMoreTopTypeName}{isMoreTopType@\IsMoreTopTypeName}
23736
+ predicate defines a total order on top and \code{Object} types.
23719
23737
23720
23738
\begin{itemize}
23721
23739
\item \DefEquals{\IsMoreTopType{\VOID}{$T$}}{\metavar{true}}.
@@ -23732,8 +23750,8 @@ \subsection{Functions Dealing with Extreme Types}
23732
23750
\end{itemize}
23733
23751
23734
23752
\noindent
23735
- The \Index {\IsMoreBottomTypeName} predicate defines an almost total order on
23736
- bottom and \code{Null} types.
23753
+ The \IndexCustom {\IsMoreBottomTypeName}{isMoreBottomType@\IsMoreBottomTypeName}
23754
+ predicate defines an almost total order on bottom and \code{Null} types.
23737
23755
\commentary{%
23738
23756
This does not consistently order
23739
23757
two different type variables with the same bound.%
@@ -23812,7 +23830,9 @@ \subsection{Type Normalization}
23812
23830
}
23813
23831
23814
23832
\LMHash{}%
23815
- The function \Index{\NormalizedTypeOfName} is then defined as follows:
23833
+ The function
23834
+ \IndexCustom{\NormalizedTypeOfName}{normalizedType@\NormalizedTypeOfName}
23835
+ is then defined as follows:
23816
23836
\BlindDefineSymbol{T_a, T_u, T_r}%
23817
23837
Let $T_a$ be a type
23818
23838
\commentary{(where `a' stands for `argument')}.
0 commit comments