Skip to content

Commit 85db2ad

Browse files
committed
Corrected function type subtype rule (bounds); corrected "math" index entries
1 parent 65f04d2 commit 85db2ad

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
@@ -22373,18 +22373,20 @@ \subsection{Subtypes}
2237322373
% ------------------------------------------------ Positional Function Type
2237422374
\RuleRawRaw{\SrnPositionalFunctionType}{%
2237522375
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22376+
\forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
2237622377
\Subtype{\Delta'}{S_0}{T_0} \\
2237722378
n_1 \leq n_2 &
2237822379
n_1 + k_1 \geq n_2 + k_2 &
2237922380
\forall j \in 1 .. n_2 + k_2\!:\;\Subtype{\Delta'}{T_j}{S_j}}{%
2238022381
\begin{array}{c}
2238122382
\Delta\vdash\RawFunctionTypePositional{S_0}{X}{B}{s}{S}{n_1}{k_1}\;<:\;\\
22382-
\RawFunctionTypePositional{T_0}{X}{B}{s}{T}{n_2}{k_2}
22383+
\RawFunctionTypePositional{T_0}{X}{B'\!}{s}{T}{n_2}{k_2}
2238322384
\end{array}}
2238422385
\ExtraVSP\ExtraVSP
2238522386
% ------------------------------------------------ Named Function Type
2238622387
\RuleRawRaw{\SrnNamedFunctionType}{%
2238722388
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22389+
\forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
2238822390
\Subtype{\Delta'}{S_0}{T_0} &
2238922391
\forall j \in 1 .. n\!:\;\Subtype{\Delta'}{T_j}{S_j}\\
2239022392
\{\,\List{y}{n+1}{n+k_2}\,\} \subseteq \{\,\List{x}{n+1}{n+k_1}\,\}\\
@@ -22394,13 +22396,16 @@ \subsection{Subtypes}
2239422396
(r_{n+q} = \REQUIRED{} \Rightarrow r'_{n+p} = \REQUIRED)}{%
2239522397
\begin{array}{c}
2239622398
\Delta\vdash\RawFunctionTypeNamed{S_0}{X}{B}{s}{S}{n}{x}{k_1}{r}\;<:\;\\
22397-
\RawFunctionTypeNamed{T_0}{X}{B}{s}{T}{n}{y}{k_2}{r'}
22399+
\RawFunctionTypeNamed{T_0}{X}{B'\!}{s}{T}{n}{y}{k_2}{r'}
2239822400
\end{array}}
2239922401
%
2240022402
\ExtraVSP
2240122403
% ------------------------------------------------ Covariance
22404+
%% TODO(eernst): Type aliases have been expanded so there is no other
22405+
%% variance than covariance, but there will be in/out/inout in classes,
22406+
%% and then we'll need to handle variance here.
2240222407
\RuleRaw{\SrnCovariance}{%
22403-
\mbox{$C$ is an interface type with $s$ type parameters} &
22408+
\mbox{$C$ is an interface type with $s$ type parameters.} &
2240422409
\SubtypeStd{S_j}{T_j}\mbox{, for each $j \in 1..s$}}{%
2240522410
\code{$C$<\List{S}{1}{s}>}}{\code{$C$<\List{T}{1}{s}>}}
2240622411
\ExtraVSP
@@ -22565,7 +22570,8 @@ \subsubsection{Subtype Rules}
2256522570
In this specification we frequently refer to
2256622571
subtype relationships and assignability
2256722572
without mentioning the environment explicitly,
22568-
as in \Index{\SubtypeNE{S}{T}}.
22573+
as in
22574+
\IndexCustom{\SubtypeNE{S}{T}}{$<:$@\SubtypeNE{S}{T}}.
2256922575
This is only done when a specific location in code is in focus,
2257022576
and it means that the environment is that which is obtained
2257122577
by mapping each type variable in scope at that location
@@ -22599,7 +22605,7 @@ \subsubsection{Being a Subtype}
2259922605
A type $S$ is shown to be a \Index{subtype} of another type $T$
2260022606
in an environment $\Delta$ by providing
2260122607
an instantiation of a rule $R$ whose conclusion is
22602-
\IndexCustom{\SubtypeStd{S}{T}}{$\Delta$@\SubtypeStd{S}{T}},
22608+
\IndexCustom{\SubtypeStd{S}{T}}{$\Delta<:$@\SubtypeStd{S}{T}},
2260322609
along with rule instantiations showing
2260422610
each of the premises of $R$,
2260522611
continuing until a rule with no premises is reached.
@@ -22828,9 +22834,17 @@ \subsubsection{Additional Subtyping Concepts}
2282822834

2282922835
\LMHash{}%
2283022836
$S$ is a \Index{supertype} of $T$ in a given environment $\Delta$,
22831-
written \SupertypeStd{S}{T},
22837+
written
22838+
\IndexCustom{\SupertypeStd{S}{T}}{$\Delta:>$@\SupertypeStd{S}{T}},
2283222839
if{}f \SubtypeStd{T}{S}.
2283322840

22841+
\LMHash{}%
22842+
$S$ and $T$ are \Index{mutual subtypes} of each other
22843+
in a given environment $\Delta$,
22844+
written
22845+
\IndexCustom{\MutualSubtypeStd{S}{T}}{$\Delta<:>$@\MutualSubtypeStd{S}{T}},
22846+
if{}f both \SubtypeStd{T}{S} and \SubtypeStd{S}{T}.
22847+
2283422848
\LMHash{}%
2283522849
A type $T$
2283622850
\Index{may be assigned}
@@ -22988,7 +23002,8 @@ \subsection{Functions Dealing with Extreme Types}
2298823002
the first applicable case must be used.
2298923003

2299023004
\LMHash{}%
22991-
The \Index{\TopMergeTypeName} of two types computes
23005+
The \IndexCustom{\TopMergeTypeName}{topMergeType@\TopMergeTypeName}
23006+
of two types computes
2299223007
a canonical type which represents both of them,
2299323008
in the case where they are structurally identical
2299423009
modulo the choice among top types.
@@ -23053,7 +23068,8 @@ \subsection{Functions Dealing with Extreme Types}
2305323068
\commentary{The ordering of the arguments makes no difference.}
2305423069

2305523070
\LMHash{}%
23056-
The \Index{\IsTopTypeName} predicate is true for any type which is in
23071+
The \IndexCustom{\IsTopTypeName}{isTopType@\IsTopTypeName}
23072+
predicate is true for any type which is in
2305723073
the equivalence class of top types.
2305823074
It is a syntactic characterization of top types
2305923075
(\ref{superBoundedTypes}).
@@ -23067,8 +23083,9 @@ \subsection{Functions Dealing with Extreme Types}
2306723083
\end{itemize}
2306823084

2306923085
\noindent
23070-
The \Index{\IsObjectTypeName} predicate is true if{}f
23071-
the argument is a subtype and a supertype of \code{Object}.
23086+
The \IndexCustom{\IsObjectTypeName}{isObjectType@\IsObjectTypeName}
23087+
predicate is true if{}f the argument is
23088+
a subtype and a supertype of \code{Object}.
2307223089

2307323090
\begin{itemize}
2307423091
\item \DefEquals{\IsObjectType{Object}}{\metavar{true}}.
@@ -23077,8 +23094,8 @@ \subsection{Functions Dealing with Extreme Types}
2307723094
\end{itemize}
2307823095

2307923096
\noindent
23080-
The \Index{\IsBottomTypeName} predicate is true if{}f
23081-
the argument is a subtype of \code{Never}.
23097+
The \IndexCustom{\IsBottomTypeName}{isBottomType@\IsBottomTypeName}
23098+
predicate is true if{}f the argument is a subtype of \code{Never}.
2308223099

2308323100
\begin{itemize}
2308423101
\item \DefEquals{\IsBottomType{Never}}{\metavar{true}}.
@@ -23088,8 +23105,9 @@ \subsection{Functions Dealing with Extreme Types}
2308823105
\end{itemize}
2308923106

2309023107
\noindent
23091-
The \Index{\IsNullTypeName} predicate is true if{}f
23092-
the argument is a subtype and a supertype of \code{Null}.
23108+
The \IndexCustom{\IsNullTypeName}{isNullType@\IsNullTypeName}
23109+
predicate is true if{}f the argument is
23110+
a subtype and a supertype of \code{Null}.
2309323111

2309423112
\begin{itemize}
2309523113
\item \DefEquals{\IsNullType{Null}}{\metavar{true}}.
@@ -23098,8 +23116,8 @@ \subsection{Functions Dealing with Extreme Types}
2309823116
\end{itemize}
2309923117

2310023118
\noindent
23101-
The \Index{\IsMoreTopTypeName} predicate defines a total order on
23102-
top and \code{Object} types.
23119+
The \IndexCustom{\IsMoreTopTypeName}{isMoreTopType@\IsMoreTopTypeName}
23120+
predicate defines a total order on top and \code{Object} types.
2310323121

2310423122
\begin{itemize}
2310523123
\item \DefEquals{\IsMoreTopType{\VOID}{$T$}}{\metavar{true}}.
@@ -23116,8 +23134,8 @@ \subsection{Functions Dealing with Extreme Types}
2311623134
\end{itemize}
2311723135

2311823136
\noindent
23119-
The \Index{\IsMoreBottomTypeName} predicate defines an almost total order on
23120-
bottom and \code{Null} types.
23137+
The \IndexCustom{\IsMoreBottomTypeName}{isMoreBottomType@\IsMoreBottomTypeName}
23138+
predicate defines an almost total order on bottom and \code{Null} types.
2312123139
\commentary{%
2312223140
This does not consistently order
2312323141
two different type variables with the same bound.%
@@ -23196,7 +23214,9 @@ \subsection{Type Normalization}
2319623214
}
2319723215

2319823216
\LMHash{}%
23199-
The function \Index{\NormalizedTypeOfName} is then defined as follows:
23217+
The function
23218+
\IndexCustom{\NormalizedTypeOfName}{normalizedType@\NormalizedTypeOfName}
23219+
is then defined as follows:
2320023220
\BlindDefineSymbol{T_a, T_u, T_r}%
2320123221
Let $T_a$ be a type
2320223222
(\commentary{where `a' stands for `argument'}).

0 commit comments

Comments
 (0)