Skip to content

Commit 54291f5

Browse files
committed
Corrected function type subtype rule (bounds); corrected "math" index entries
1 parent d20051a commit 54291f5

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
@@ -465,6 +465,9 @@
465465
\newcommand{\SubtypeStd}[2]{\Subtype{\Delta}{#1}{#2}}
466466
% Subtype judgment where the environment is omitted (NE: "no environment").
467467
\newcommand{\SubtypeNE}[2]{\ensuremath{{#1}\,<:\,{#2}}}
468+
\newcommand{\MutualSubtype}[3]{\ensuremath{{#1}\vdash{#2}\,<:>\,{#3}}}
469+
\newcommand{\MutualSubtypeStd}[2]{\MutualSubtype{\Delta}{#1}{#2}}
470+
\newcommand{\MutualSubtypeNE}[2]{\ensuremath{{#1}\,<:>\,{#2}}}
468471

469472
% Judgment expressing that a supertype relation exists.
470473
\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
@@ -22545,18 +22545,20 @@ \subsection{Subtypes}
2254522545
% ------------------------------------------------ Positional Function Type
2254622546
\RuleRawRaw{\SrnPositionalFunctionType}{%
2254722547
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22548+
\forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
2254822549
\Subtype{\Delta'}{S_0}{T_0} \\
2254922550
n_1 \leq n_2 &
2255022551
n_1 + k_1 \geq n_2 + k_2 &
2255122552
\forall j \in 1 .. n_2 + k_2\!:\;\Subtype{\Delta'}{T_j}{S_j}}{%
2255222553
\begin{array}{c}
2255322554
\Delta\vdash\RawFunctionTypePositional{S_0}{X}{B}{s}{S}{n_1}{k_1}\;<:\;\\
22554-
\RawFunctionTypePositional{T_0}{X}{B}{s}{T}{n_2}{k_2}
22555+
\RawFunctionTypePositional{T_0}{X}{B'\!}{s}{T}{n_2}{k_2}
2255522556
\end{array}}
2255622557
\ExtraVSP\ExtraVSP
2255722558
% ------------------------------------------------ Named Function Type
2255822559
\RuleRawRaw{\SrnNamedFunctionType}{%
2255922560
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22561+
\forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
2256022562
\Subtype{\Delta'}{S_0}{T_0} &
2256122563
\forall j \in 1 .. n\!:\;\Subtype{\Delta'}{T_j}{S_j}\\
2256222564
\{\,\List{y}{n+1}{n+k_2}\,\} \subseteq \{\,\List{x}{n+1}{n+k_1}\,\}\\
@@ -22566,13 +22568,16 @@ \subsection{Subtypes}
2256622568
(r_{n+q} = \REQUIRED{} \Rightarrow r'_{n+p} = \REQUIRED)}{%
2256722569
\begin{array}{c}
2256822570
\Delta\vdash\RawFunctionTypeNamed{S_0}{X}{B}{s}{S}{n}{x}{k_1}{r}\;<:\;\\
22569-
\RawFunctionTypeNamed{T_0}{X}{B}{s}{T}{n}{y}{k_2}{r'}
22571+
\RawFunctionTypeNamed{T_0}{X}{B'\!}{s}{T}{n}{y}{k_2}{r'}
2257022572
\end{array}}
2257122573
%
2257222574
\ExtraVSP
2257322575
% ------------------------------------------------ Covariance
22576+
%% TODO(eernst): Type aliases have been expanded so there is no other
22577+
%% variance than covariance, but there will be in/out/inout in classes,
22578+
%% and then we'll need to handle variance here.
2257422579
\RuleRaw{\SrnCovariance}{%
22575-
\mbox{$C$ is an interface type with $s$ type parameters} &
22580+
\mbox{$C$ is an interface type with $s$ type parameters.} &
2257622581
\SubtypeStd{S_j}{T_j}\mbox{, for each $j \in 1..s$}}{%
2257722582
\code{$C$<\List{S}{1}{s}>}}{\code{$C$<\List{T}{1}{s}>}}
2257822583
\ExtraVSP
@@ -22737,7 +22742,8 @@ \subsubsection{Subtype Rules}
2273722742
In this specification we frequently refer to
2273822743
subtype relationships and assignability
2273922744
without mentioning the environment explicitly,
22740-
as in \Index{\SubtypeNE{S}{T}}.
22745+
as in
22746+
\IndexCustom{\SubtypeNE{S}{T}}{$<:$@\SubtypeNE{S}{T}}.
2274122747
This is only done when a specific location in code is in focus,
2274222748
and it means that the environment is that which is obtained
2274322749
by mapping each type variable in scope at that location
@@ -22771,7 +22777,7 @@ \subsubsection{Being a Subtype}
2277122777
A type $S$ is shown to be a \Index{subtype} of another type $T$
2277222778
in an environment $\Delta$ by providing
2277322779
an instantiation of a rule $R$ whose conclusion is
22774-
\IndexCustom{\SubtypeStd{S}{T}}{$\Delta$@\SubtypeStd{S}{T}},
22780+
\IndexCustom{\SubtypeStd{S}{T}}{$\Delta<:$@\SubtypeStd{S}{T}},
2277522781
along with rule instantiations showing
2277622782
each of the premises of $R$,
2277722783
continuing until a rule with no premises is reached.
@@ -23000,9 +23006,17 @@ \subsubsection{Additional Subtyping Concepts}
2300023006

2300123007
\LMHash{}%
2300223008
$S$ is a \Index{supertype} of $T$ in a given environment $\Delta$,
23003-
written \SupertypeStd{S}{T},
23009+
written
23010+
\IndexCustom{\SupertypeStd{S}{T}}{$\Delta:>$@\SupertypeStd{S}{T}},
2300423011
if{}f \SubtypeStd{T}{S}.
2300523012

23013+
\LMHash{}%
23014+
$S$ and $T$ are \Index{mutual subtypes} of each other
23015+
in a given environment $\Delta$,
23016+
written
23017+
\IndexCustom{\MutualSubtypeStd{S}{T}}{$\Delta<:>$@\MutualSubtypeStd{S}{T}},
23018+
if{}f both \SubtypeStd{T}{S} and \SubtypeStd{S}{T}.
23019+
2300623020
\LMHash{}%
2300723021
A type $T$
2300823022
\Index{may be assigned}
@@ -23160,7 +23174,8 @@ \subsection{Functions Dealing with Extreme Types}
2316023174
the first applicable case must be used.
2316123175

2316223176
\LMHash{}%
23163-
The \Index{\TopMergeTypeName} of two types computes
23177+
The \IndexCustom{\TopMergeTypeName}{topMergeType@\TopMergeTypeName}
23178+
of two types computes
2316423179
a canonical type which represents both of them,
2316523180
in the case where they are structurally identical
2316623181
modulo the choice among top types.
@@ -23225,7 +23240,8 @@ \subsection{Functions Dealing with Extreme Types}
2322523240
\commentary{The ordering of the arguments makes no difference.}
2322623241

2322723242
\LMHash{}%
23228-
The \Index{\IsTopTypeName} predicate is true for any type which is in
23243+
The \IndexCustom{\IsTopTypeName}{isTopType@\IsTopTypeName}
23244+
predicate is true for any type which is in
2322923245
the equivalence class of top types.
2323023246
It is a syntactic characterization of top types
2323123247
(\ref{superBoundedTypes}).
@@ -23239,8 +23255,9 @@ \subsection{Functions Dealing with Extreme Types}
2323923255
\end{itemize}
2324023256

2324123257
\noindent
23242-
The \Index{\IsObjectTypeName} predicate is true if{}f
23243-
the argument is a subtype and a supertype of \code{Object}.
23258+
The \IndexCustom{\IsObjectTypeName}{isObjectType@\IsObjectTypeName}
23259+
predicate is true if{}f the argument is
23260+
a subtype and a supertype of \code{Object}.
2324423261

2324523262
\begin{itemize}
2324623263
\item \DefEquals{\IsObjectType{Object}}{\metavar{true}}.
@@ -23249,8 +23266,8 @@ \subsection{Functions Dealing with Extreme Types}
2324923266
\end{itemize}
2325023267

2325123268
\noindent
23252-
The \Index{\IsBottomTypeName} predicate is true if{}f
23253-
the argument is a subtype of \code{Never}.
23269+
The \IndexCustom{\IsBottomTypeName}{isBottomType@\IsBottomTypeName}
23270+
predicate is true if{}f the argument is a subtype of \code{Never}.
2325423271

2325523272
\begin{itemize}
2325623273
\item \DefEquals{\IsBottomType{Never}}{\metavar{true}}.
@@ -23260,8 +23277,9 @@ \subsection{Functions Dealing with Extreme Types}
2326023277
\end{itemize}
2326123278

2326223279
\noindent
23263-
The \Index{\IsNullTypeName} predicate is true if{}f
23264-
the argument is a subtype and a supertype of \code{Null}.
23280+
The \IndexCustom{\IsNullTypeName}{isNullType@\IsNullTypeName}
23281+
predicate is true if{}f the argument is
23282+
a subtype and a supertype of \code{Null}.
2326523283

2326623284
\begin{itemize}
2326723285
\item \DefEquals{\IsNullType{Null}}{\metavar{true}}.
@@ -23270,8 +23288,8 @@ \subsection{Functions Dealing with Extreme Types}
2327023288
\end{itemize}
2327123289

2327223290
\noindent
23273-
The \Index{\IsMoreTopTypeName} predicate defines a total order on
23274-
top and \code{Object} types.
23291+
The \IndexCustom{\IsMoreTopTypeName}{isMoreTopType@\IsMoreTopTypeName}
23292+
predicate defines a total order on top and \code{Object} types.
2327523293

2327623294
\begin{itemize}
2327723295
\item \DefEquals{\IsMoreTopType{\VOID}{$T$}}{\metavar{true}}.
@@ -23288,8 +23306,8 @@ \subsection{Functions Dealing with Extreme Types}
2328823306
\end{itemize}
2328923307

2329023308
\noindent
23291-
The \Index{\IsMoreBottomTypeName} predicate defines an almost total order on
23292-
bottom and \code{Null} types.
23309+
The \IndexCustom{\IsMoreBottomTypeName}{isMoreBottomType@\IsMoreBottomTypeName}
23310+
predicate defines an almost total order on bottom and \code{Null} types.
2329323311
\commentary{%
2329423312
This does not consistently order
2329523313
two different type variables with the same bound.%
@@ -23368,7 +23386,9 @@ \subsection{Type Normalization}
2336823386
}
2336923387

2337023388
\LMHash{}%
23371-
The function \Index{\NormalizedTypeOfName} is then defined as follows:
23389+
The function
23390+
\IndexCustom{\NormalizedTypeOfName}{normalizedType@\NormalizedTypeOfName}
23391+
is then defined as follows:
2337223392
\BlindDefineSymbol{T_a, T_u, T_r}%
2337323393
Let $T_a$ be a type
2337423394
(\commentary{where `a' stands for `argument'}).

0 commit comments

Comments
 (0)