Skip to content

Commit acb243d

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

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
@@ -22556,18 +22556,20 @@ \subsection{Subtypes}
2255622556
% ------------------------------------------------ Positional Function Type
2255722557
\RuleRawRaw{\SrnPositionalFunctionType}{%
2255822558
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22559+
\forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
2255922560
\Subtype{\Delta'}{S_0}{T_0} \\
2256022561
n_1 \leq n_2 &
2256122562
n_1 + k_1 \geq n_2 + k_2 &
2256222563
\forall j \in 1 .. n_2 + k_2\!:\;\Subtype{\Delta'}{T_j}{S_j}}{%
2256322564
\begin{array}{c}
2256422565
\Delta\vdash\RawFunctionTypePositional{S_0}{X}{B}{s}{S}{n_1}{k_1}\;<:\;\\
22565-
\RawFunctionTypePositional{T_0}{X}{B}{s}{T}{n_2}{k_2}
22566+
\RawFunctionTypePositional{T_0}{X}{B'\!}{s}{T}{n_2}{k_2}
2256622567
\end{array}}
2256722568
\ExtraVSP\ExtraVSP
2256822569
% ------------------------------------------------ Named Function Type
2256922570
\RuleRawRaw{\SrnNamedFunctionType}{%
2257022571
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22572+
\forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
2257122573
\Subtype{\Delta'}{S_0}{T_0} &
2257222574
\forall j \in 1 .. n\!:\;\Subtype{\Delta'}{T_j}{S_j}\\
2257322575
\{\,\List{y}{n+1}{n+k_2}\,\} \subseteq \{\,\List{x}{n+1}{n+k_1}\,\}\\
@@ -22577,13 +22579,16 @@ \subsection{Subtypes}
2257722579
(r_{n+q} = \REQUIRED{} \Rightarrow r'_{n+p} = \REQUIRED)}{%
2257822580
\begin{array}{c}
2257922581
\Delta\vdash\RawFunctionTypeNamed{S_0}{X}{B}{s}{S}{n}{x}{k_1}{r}\;<:\;\\
22580-
\RawFunctionTypeNamed{T_0}{X}{B}{s}{T}{n}{y}{k_2}{r'}
22582+
\RawFunctionTypeNamed{T_0}{X}{B'\!}{s}{T}{n}{y}{k_2}{r'}
2258122583
\end{array}}
2258222584
%
2258322585
\ExtraVSP
2258422586
% ------------------------------------------------ Covariance
22587+
%% TODO(eernst): Type aliases have been expanded so there is no other
22588+
%% variance than covariance, but there will be in/out/inout in classes,
22589+
%% and then we'll need to handle variance here.
2258522590
\RuleRaw{\SrnCovariance}{%
22586-
\mbox{$C$ is an interface type with $s$ type parameters} &
22591+
\mbox{$C$ is an interface type with $s$ type parameters.} &
2258722592
\SubtypeStd{S_j}{T_j}\mbox{, for each $j \in 1..s$}}{%
2258822593
\code{$C$<\List{S}{1}{s}>}}{\code{$C$<\List{T}{1}{s}>}}
2258922594
\ExtraVSP
@@ -22748,7 +22753,8 @@ \subsubsection{Subtype Rules}
2274822753
In this specification we frequently refer to
2274922754
subtype relationships and assignability
2275022755
without mentioning the environment explicitly,
22751-
as in \Index{\SubtypeNE{S}{T}}.
22756+
as in
22757+
\IndexCustom{\SubtypeNE{S}{T}}{$<:$@\SubtypeNE{S}{T}}.
2275222758
This is only done when a specific location in code is in focus,
2275322759
and it means that the environment is that which is obtained
2275422760
by mapping each type variable in scope at that location
@@ -22782,7 +22788,7 @@ \subsubsection{Being a Subtype}
2278222788
A type $S$ is shown to be a \Index{subtype} of another type $T$
2278322789
in an environment $\Delta$ by providing
2278422790
an instantiation of a rule $R$ whose conclusion is
22785-
\IndexCustom{\SubtypeStd{S}{T}}{$\Delta$@\SubtypeStd{S}{T}},
22791+
\IndexCustom{\SubtypeStd{S}{T}}{$\Delta<:$@\SubtypeStd{S}{T}},
2278622792
along with rule instantiations showing
2278722793
each of the premises of $R$,
2278822794
continuing until a rule with no premises is reached.
@@ -23011,9 +23017,17 @@ \subsubsection{Additional Subtyping Concepts}
2301123017

2301223018
\LMHash{}%
2301323019
$S$ is a \Index{supertype} of $T$ in a given environment $\Delta$,
23014-
written \SupertypeStd{S}{T},
23020+
written
23021+
\IndexCustom{\SupertypeStd{S}{T}}{$\Delta:>$@\SupertypeStd{S}{T}},
2301523022
if{}f \SubtypeStd{T}{S}.
2301623023

23024+
\LMHash{}%
23025+
$S$ and $T$ are \Index{mutual subtypes} of each other
23026+
in a given environment $\Delta$,
23027+
written
23028+
\IndexCustom{\MutualSubtypeStd{S}{T}}{$\Delta<:>$@\MutualSubtypeStd{S}{T}},
23029+
if{}f both \SubtypeStd{T}{S} and \SubtypeStd{S}{T}.
23030+
2301723031
\LMHash{}%
2301823032
A type $T$
2301923033
\Index{may be assigned}
@@ -23171,7 +23185,8 @@ \subsection{Functions Dealing with Extreme Types}
2317123185
the first applicable case must be used.
2317223186

2317323187
\LMHash{}%
23174-
The \Index{\TopMergeTypeName} of two types computes
23188+
The \IndexCustom{\TopMergeTypeName}{topMergeType@\TopMergeTypeName}
23189+
of two types computes
2317523190
a canonical type which represents both of them,
2317623191
in the case where they are structurally identical
2317723192
modulo the choice among top types.
@@ -23236,7 +23251,8 @@ \subsection{Functions Dealing with Extreme Types}
2323623251
\commentary{The ordering of the arguments makes no difference.}
2323723252

2323823253
\LMHash{}%
23239-
The \Index{\IsTopTypeName} predicate is true for any type which is in
23254+
The \IndexCustom{\IsTopTypeName}{isTopType@\IsTopTypeName}
23255+
predicate is true for any type which is in
2324023256
the equivalence class of top types.
2324123257
It is a syntactic characterization of top types
2324223258
(\ref{superBoundedTypes}).
@@ -23250,8 +23266,9 @@ \subsection{Functions Dealing with Extreme Types}
2325023266
\end{itemize}
2325123267

2325223268
\noindent
23253-
The \Index{\IsObjectTypeName} predicate is true if{}f
23254-
the argument is a subtype and a supertype of \code{Object}.
23269+
The \IndexCustom{\IsObjectTypeName}{isObjectType@\IsObjectTypeName}
23270+
predicate is true if{}f the argument is
23271+
a subtype and a supertype of \code{Object}.
2325523272

2325623273
\begin{itemize}
2325723274
\item \DefEquals{\IsObjectType{Object}}{\metavar{true}}.
@@ -23260,8 +23277,8 @@ \subsection{Functions Dealing with Extreme Types}
2326023277
\end{itemize}
2326123278

2326223279
\noindent
23263-
The \Index{\IsBottomTypeName} predicate is true if{}f
23264-
the argument is a subtype of \code{Never}.
23280+
The \IndexCustom{\IsBottomTypeName}{isBottomType@\IsBottomTypeName}
23281+
predicate is true if{}f the argument is a subtype of \code{Never}.
2326523282

2326623283
\begin{itemize}
2326723284
\item \DefEquals{\IsBottomType{Never}}{\metavar{true}}.
@@ -23271,8 +23288,9 @@ \subsection{Functions Dealing with Extreme Types}
2327123288
\end{itemize}
2327223289

2327323290
\noindent
23274-
The \Index{\IsNullTypeName} predicate is true if{}f
23275-
the argument is a subtype and a supertype of \code{Null}.
23291+
The \IndexCustom{\IsNullTypeName}{isNullType@\IsNullTypeName}
23292+
predicate is true if{}f the argument is
23293+
a subtype and a supertype of \code{Null}.
2327623294

2327723295
\begin{itemize}
2327823296
\item \DefEquals{\IsNullType{Null}}{\metavar{true}}.
@@ -23281,8 +23299,8 @@ \subsection{Functions Dealing with Extreme Types}
2328123299
\end{itemize}
2328223300

2328323301
\noindent
23284-
The \Index{\IsMoreTopTypeName} predicate defines a total order on
23285-
top and \code{Object} types.
23302+
The \IndexCustom{\IsMoreTopTypeName}{isMoreTopType@\IsMoreTopTypeName}
23303+
predicate defines a total order on top and \code{Object} types.
2328623304

2328723305
\begin{itemize}
2328823306
\item \DefEquals{\IsMoreTopType{\VOID}{$T$}}{\metavar{true}}.
@@ -23299,8 +23317,8 @@ \subsection{Functions Dealing with Extreme Types}
2329923317
\end{itemize}
2330023318

2330123319
\noindent
23302-
The \Index{\IsMoreBottomTypeName} predicate defines an almost total order on
23303-
bottom and \code{Null} types.
23320+
The \IndexCustom{\IsMoreBottomTypeName}{isMoreBottomType@\IsMoreBottomTypeName}
23321+
predicate defines an almost total order on bottom and \code{Null} types.
2330423322
\commentary{%
2330523323
This does not consistently order
2330623324
two different type variables with the same bound.%
@@ -23379,7 +23397,9 @@ \subsection{Type Normalization}
2337923397
}
2338023398

2338123399
\LMHash{}%
23382-
The function \Index{\NormalizedTypeOfName} is then defined as follows:
23400+
The function
23401+
\IndexCustom{\NormalizedTypeOfName}{normalizedType@\NormalizedTypeOfName}
23402+
is then defined as follows:
2338323403
\BlindDefineSymbol{T_a, T_u, T_r}%
2338423404
Let $T_a$ be a type
2338523405
(\commentary{where `a' stands for `argument'}).

0 commit comments

Comments
 (0)