@@ -22235,18 +22235,20 @@ \subsection{Subtypes}
22235
22235
% ------------------------------------------------ Positional Function Type
22236
22236
\RuleRawRaw{\SrnPositionalFunctionType}{%
22237
22237
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22238
+ \forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
22238
22239
\Subtype{\Delta'}{S_0}{T_0} \\
22239
22240
n_1 \leq n_2 &
22240
22241
n_1 + k_1 \geq n_2 + k_2 &
22241
22242
\forall j \in 1 .. n_2 + k_2\!:\;\Subtype{\Delta'}{T_j}{S_j}}{%
22242
22243
\begin{array}{c}
22243
22244
\Delta\vdash\RawFunctionTypePositional{S_0}{X}{B}{s}{S}{n_1}{k_1}\;<:\;\\
22244
- \RawFunctionTypePositional{T_0}{X}{B}{s}{T}{n_2}{k_2}
22245
+ \RawFunctionTypePositional{T_0}{X}{B'\! }{s}{T}{n_2}{k_2}
22245
22246
\end{array}}
22246
22247
\ExtraVSP\ExtraVSP
22247
22248
% ------------------------------------------------ Named Function Type
22248
22249
\RuleRawRaw{\SrnNamedFunctionType}{%
22249
22250
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22251
+ \forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
22250
22252
\Subtype{\Delta'}{S_0}{T_0} &
22251
22253
\forall j \in 1 .. n\!:\;\Subtype{\Delta'}{T_j}{S_j}\\
22252
22254
\{\,\List{y}{n+1}{n+k_2}\,\} \subseteq \{\,\List{x}{n+1}{n+k_1}\,\}\\
@@ -22256,13 +22258,16 @@ \subsection{Subtypes}
22256
22258
(r_{n+q} = \REQUIRED{} \Rightarrow r'_{n+p} = \REQUIRED)}{%
22257
22259
\begin{array}{c}
22258
22260
\Delta\vdash\RawFunctionTypeNamed{S_0}{X}{B}{s}{S}{n}{x}{k_1}{r}\;<:\;\\
22259
- \RawFunctionTypeNamed{T_0}{X}{B}{s}{T}{n}{y}{k_2}{r'}
22261
+ \RawFunctionTypeNamed{T_0}{X}{B'\! }{s}{T}{n}{y}{k_2}{r'}
22260
22262
\end{array}}
22261
22263
%
22262
22264
\ExtraVSP
22263
22265
% ------------------------------------------------ Covariance
22266
+ %% TODO(eernst): Type aliases have been expanded so there is no other
22267
+ %% variance than covariance, but there will be in/out/inout in classes,
22268
+ %% and then we'll need to handle variance here.
22264
22269
\RuleRaw{\SrnCovariance}{%
22265
- \mbox{$C$ is an interface type with $s$ type parameters} &
22270
+ \mbox{$C$ is an interface type with $s$ type parameters. } &
22266
22271
\SubtypeStd{S_j}{T_j}\mbox{, for each $j \in 1..s$}}{%
22267
22272
\code{$C$<\List{S}{1}{s}>}}{\code{$C$<\List{T}{1}{s}>}}
22268
22273
\ExtraVSP
@@ -22427,7 +22432,8 @@ \subsubsection{Subtype Rules}
22427
22432
In this specification we frequently refer to
22428
22433
subtype relationships and assignability
22429
22434
without mentioning the environment explicitly,
22430
- as in \Index{\SubtypeNE{S}{T}}.
22435
+ as in
22436
+ \IndexCustom{\SubtypeNE{S}{T}}{$<:$@\SubtypeNE{S}{T}}.
22431
22437
This is only done when a specific location in code is in focus,
22432
22438
and it means that the environment is that which is obtained
22433
22439
by mapping each type variable in scope at that location
@@ -22461,7 +22467,7 @@ \subsubsection{Being a Subtype}
22461
22467
A type $S$ is shown to be a \Index{subtype} of another type $T$
22462
22468
in an environment $\Delta$ by providing
22463
22469
an instantiation of a rule $R$ whose conclusion is
22464
- \IndexCustom{\SubtypeStd{S}{T}}{$\Delta$@\SubtypeStd{S}{T}},
22470
+ \IndexCustom{\SubtypeStd{S}{T}}{$\Delta<: $@\SubtypeStd{S}{T}},
22465
22471
along with rule instantiations showing
22466
22472
each of the premises of $R$,
22467
22473
continuing until a rule with no premises is reached.
@@ -22690,9 +22696,17 @@ \subsubsection{Additional Subtyping Concepts}
22690
22696
22691
22697
\LMHash{}%
22692
22698
$S$ is a \Index{supertype} of $T$ in a given environment $\Delta$,
22693
- written \SupertypeStd{S}{T},
22699
+ written
22700
+ \IndexCustom{\SupertypeStd{S}{T}}{$\Delta:>$@\SupertypeStd{S}{T}},
22694
22701
if{}f \SubtypeStd{T}{S}.
22695
22702
22703
+ \LMHash{}%
22704
+ $S$ and $T$ are \Index{mutual subtypes} of each other
22705
+ in a given environment $\Delta$,
22706
+ written
22707
+ \IndexCustom{\MutualSubtypeStd{S}{T}}{$\Delta<:>$@\MutualSubtypeStd{S}{T}},
22708
+ if{}f both \SubtypeStd{T}{S} and \SubtypeStd{S}{T}.
22709
+
22696
22710
\LMHash{}%
22697
22711
A type $T$
22698
22712
\Index{may be assigned}
@@ -22850,7 +22864,8 @@ \subsection{Functions Dealing with Extreme Types}
22850
22864
the first applicable case must be used.
22851
22865
22852
22866
\LMHash{}%
22853
- The \Index{\TopMergeTypeName} of two types computes
22867
+ The \IndexCustom{\TopMergeTypeName}{topMergeType@\TopMergeTypeName}
22868
+ of two types computes
22854
22869
a canonical type which represents both of them,
22855
22870
in the case where they are structurally identical
22856
22871
modulo the choice among top types.
@@ -22915,7 +22930,8 @@ \subsection{Functions Dealing with Extreme Types}
22915
22930
\commentary{The ordering of the arguments makes no difference.}
22916
22931
22917
22932
\LMHash{}%
22918
- The \Index{\IsTopTypeName} predicate is true for any type which is in
22933
+ The \IndexCustom{\IsTopTypeName}{isTopType@\IsTopTypeName}
22934
+ predicate is true for any type which is in
22919
22935
the equivalence class of top types.
22920
22936
It is a syntactic characterization of top types
22921
22937
(\ref{superBoundedTypes}).
@@ -22929,8 +22945,9 @@ \subsection{Functions Dealing with Extreme Types}
22929
22945
\end{itemize}
22930
22946
22931
22947
\noindent
22932
- The \Index{\IsObjectTypeName} predicate is true if{}f
22933
- the argument is a subtype and a supertype of \code{Object}.
22948
+ The \IndexCustom{\IsObjectTypeName}{isObjectType@\IsObjectTypeName}
22949
+ predicate is true if{}f the argument is
22950
+ a subtype and a supertype of \code{Object}.
22934
22951
22935
22952
\begin{itemize}
22936
22953
\item \DefEquals{\IsObjectType{Object}}{\metavar{true}}.
@@ -22939,8 +22956,8 @@ \subsection{Functions Dealing with Extreme Types}
22939
22956
\end{itemize}
22940
22957
22941
22958
\noindent
22942
- The \Index {\IsBottomTypeName} predicate is true if{}f
22943
- the argument is a subtype of \code{Never}.
22959
+ The \IndexCustom {\IsBottomTypeName}{isBottomType@\IsBottomTypeName}
22960
+ predicate is true if{}f the argument is a subtype of \code{Never}.
22944
22961
22945
22962
\begin{itemize}
22946
22963
\item \DefEquals{\IsBottomType{Never}}{\metavar{true}}.
@@ -22950,8 +22967,9 @@ \subsection{Functions Dealing with Extreme Types}
22950
22967
\end{itemize}
22951
22968
22952
22969
\noindent
22953
- The \Index{\IsNullTypeName} predicate is true if{}f
22954
- the argument is a subtype and a supertype of \code{Null}.
22970
+ The \IndexCustom{\IsNullTypeName}{isNullType@\IsNullTypeName}
22971
+ predicate is true if{}f the argument is
22972
+ a subtype and a supertype of \code{Null}.
22955
22973
22956
22974
\begin{itemize}
22957
22975
\item \DefEquals{\IsNullType{Null}}{\metavar{true}}.
@@ -22960,8 +22978,8 @@ \subsection{Functions Dealing with Extreme Types}
22960
22978
\end{itemize}
22961
22979
22962
22980
\noindent
22963
- The \Index {\IsMoreTopTypeName} predicate defines a total order on
22964
- top and \code{Object} types.
22981
+ The \IndexCustom {\IsMoreTopTypeName}{isMoreTopType@\IsMoreTopTypeName}
22982
+ predicate defines a total order on top and \code{Object} types.
22965
22983
22966
22984
\begin{itemize}
22967
22985
\item \DefEquals{\IsMoreTopType{\VOID}{$T$}}{\metavar{true}}.
@@ -22978,8 +22996,8 @@ \subsection{Functions Dealing with Extreme Types}
22978
22996
\end{itemize}
22979
22997
22980
22998
\noindent
22981
- The \Index {\IsMoreBottomTypeName} predicate defines an almost total order on
22982
- bottom and \code{Null} types.
22999
+ The \IndexCustom {\IsMoreBottomTypeName}{isMoreBottomType@\IsMoreBottomTypeName}
23000
+ predicate defines an almost total order on bottom and \code{Null} types.
22983
23001
\commentary{%
22984
23002
This does not consistently order
22985
23003
two different type variables with the same bound.%
@@ -23058,7 +23076,9 @@ \subsection{Type Normalization}
23058
23076
}
23059
23077
23060
23078
\LMHash{}%
23061
- The function \Index{\NormalizedTypeOfName} is then defined as follows:
23079
+ The function
23080
+ \IndexCustom{\NormalizedTypeOfName}{normalizedType@\NormalizedTypeOfName}
23081
+ is then defined as follows:
23062
23082
\BlindDefineSymbol{T_a, T_u, T_r}%
23063
23083
Let $T_a$ be a type
23064
23084
(\commentary{where `a' stands for `argument'}).
0 commit comments