Skip to content

Commit 6db12be

Browse files
committed
Corrected function type subtype rule (bounds); corrected "math" index entries
1 parent f71346a commit 6db12be

File tree

2 files changed

+42
-19
lines changed

2 files changed

+42
-19
lines changed

specification/dart.sty

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,9 @@
382382
\newcommand{\SubtypeStd}[2]{\Subtype{\Delta}{#1}{#2}}
383383
% Subtype judgment where the environment is omitted (NE: "no environment").
384384
\newcommand{\SubtypeNE}[2]{\ensuremath{{#1}\,<:\,{#2}}}
385+
\newcommand{\MutualSubtype}[3]{\ensuremath{{#1}\vdash{#2}\,<:>\,{#3}}}
386+
\newcommand{\MutualSubtypeStd}[2]{\MutualSubtype{\Delta}{#1}{#2}}
387+
\newcommand{\MutualSubtypeNE}[2]{\ensuremath{{#1}\,<:>\,{#2}}}
385388

386389
% Judgment expressing that a supertype relation exists.
387390
\newcommand{\Supertype}[3]{\ensuremath{{#1}\vdash{#2}\,:>\,{#3}}}

specification/dartLangSpec.tex

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22169,18 +22169,20 @@ \subsection{Subtypes}
2216922169
% ------------------------------------------------ Positional Function Type
2217022170
\RuleRawRaw{\SrnPositionalFunctionType}{%
2217122171
\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} &
2217222173
\Subtype{\Delta'}{S_0}{T_0} \\
2217322174
n_1 \leq n_2 &
2217422175
n_1 + k_1 \geq n_2 + k_2 &
2217522176
\forall j \in 1 .. n_2 + k_2\!:\;\Subtype{\Delta'}{T_j}{S_j}}{%
2217622177
\begin{array}{c}
2217722178
\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}
2217922180
\end{array}}
2218022181
\ExtraVSP\ExtraVSP
2218122182
% ------------------------------------------------ Named Function Type
2218222183
\RuleRawRaw{\SrnNamedFunctionType}{%
2218322184
\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} &
2218422186
\Subtype{\Delta'}{S_0}{T_0} &
2218522187
\forall j \in 1 .. n\!:\;\Subtype{\Delta'}{T_j}{S_j}\\
2218622188
\{\,\List{y}{n+1}{n+k_2}\,\} \subseteq \{\,\List{x}{n+1}{n+k_1}\,\}\\
@@ -22190,13 +22192,16 @@ \subsection{Subtypes}
2219022192
(r_{n+q} = \REQUIRED{} \Rightarrow r'_{n+p} = \REQUIRED)}{%
2219122193
\begin{array}{c}
2219222194
\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'}
2219422196
\end{array}}
2219522197
%
2219622198
\ExtraVSP
2219722199
% ------------------------------------------------ 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.
2219822203
\RuleRaw{\SrnCovariance}{%
22199-
\mbox{$C$ is an interface type with $s$ type parameters} &
22204+
\mbox{$C$ is an interface type with $s$ type parameters.} &
2220022205
\SubtypeStd{S_j}{T_j}\mbox{, for each $j \in 1..s$}}{%
2220122206
\code{$C$<\List{S}{1}{s}>}}{\code{$C$<\List{T}{1}{s}>}}
2220222207
\ExtraVSP
@@ -22361,7 +22366,8 @@ \subsubsection{Subtype Rules}
2236122366
In this specification we frequently refer to
2236222367
subtype relationships and assignability
2236322368
without mentioning the environment explicitly,
22364-
as in \Index{\SubtypeNE{S}{T}}.
22369+
as in
22370+
\IndexCustom{\SubtypeNE{S}{T}}{$<:$@\SubtypeNE{S}{T}}.
2236522371
This is only done when a specific location in code is in focus,
2236622372
and it means that the environment is that which is obtained
2236722373
by mapping each type variable in scope at that location
@@ -22395,7 +22401,7 @@ \subsubsection{Being a Subtype}
2239522401
A type $S$ is shown to be a \Index{subtype} of another type $T$
2239622402
in an environment $\Delta$ by providing
2239722403
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}},
2239922405
along with rule instantiations showing
2240022406
each of the premises of $R$,
2240122407
continuing until a rule with no premises is reached.
@@ -22624,9 +22630,17 @@ \subsubsection{Additional Subtyping Concepts}
2262422630

2262522631
\LMHash{}%
2262622632
$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}},
2262822635
if{}f \SubtypeStd{T}{S}.
2262922636

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+
2263022644
\LMHash{}%
2263122645
A type $T$
2263222646
\Index{may be assigned}
@@ -22784,7 +22798,8 @@ \subsection{Functions Dealing with Extreme Types}
2278422798
the first applicable case must be used.
2278522799

2278622800
\LMHash{}%
22787-
The \Index{\TopMergeTypeName} of two types computes
22801+
The \IndexCustom{\TopMergeTypeName}{topMergeType@\TopMergeTypeName}
22802+
of two types computes
2278822803
a canonical type which represents both of them,
2278922804
in the case where they are structurally identical
2279022805
modulo the choice among top types.
@@ -22849,7 +22864,8 @@ \subsection{Functions Dealing with Extreme Types}
2284922864
\commentary{The ordering of the arguments makes no difference.}
2285022865

2285122866
\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
2285322869
the equivalence class of top types.
2285422870
It is a syntactic characterization of top types
2285522871
(\ref{superBoundedTypes}).
@@ -22863,8 +22879,9 @@ \subsection{Functions Dealing with Extreme Types}
2286322879
\end{itemize}
2286422880

2286522881
\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}.
2286822885

2286922886
\begin{itemize}
2287022887
\item \DefEquals{\IsObjectType{Object}}{\metavar{true}}.
@@ -22873,8 +22890,8 @@ \subsection{Functions Dealing with Extreme Types}
2287322890
\end{itemize}
2287422891

2287522892
\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}.
2287822895

2287922896
\begin{itemize}
2288022897
\item \DefEquals{\IsBottomType{Never}}{\metavar{true}}.
@@ -22884,8 +22901,9 @@ \subsection{Functions Dealing with Extreme Types}
2288422901
\end{itemize}
2288522902

2288622903
\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}.
2288922907

2289022908
\begin{itemize}
2289122909
\item \DefEquals{\IsNullType{Null}}{\metavar{true}}.
@@ -22894,8 +22912,8 @@ \subsection{Functions Dealing with Extreme Types}
2289422912
\end{itemize}
2289522913

2289622914
\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.
2289922917

2290022918
\begin{itemize}
2290122919
\item \DefEquals{\IsMoreTopType{\VOID}{$T$}}{\metavar{true}}.
@@ -22912,8 +22930,8 @@ \subsection{Functions Dealing with Extreme Types}
2291222930
\end{itemize}
2291322931

2291422932
\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.
2291722935
\commentary{%
2291822936
This does not consistently order
2291922937
two different type variables with the same bound.%
@@ -22992,7 +23010,9 @@ \subsection{Type Normalization}
2299223010
}
2299323011

2299423012
\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:
2299623016
\BlindDefineSymbol{T_a, T_u, T_r}%
2299723017
Let $T_a$ be a type
2299823018
(\commentary{where `a' stands for `argument'}).

0 commit comments

Comments
 (0)