Skip to content

Commit a3f4e9e

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

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
@@ -381,6 +381,9 @@
381381
\newcommand{\SubtypeStd}[2]{\Subtype{\Delta}{#1}{#2}}
382382
% Subtype judgment where the environment is omitted (NE: "no environment").
383383
\newcommand{\SubtypeNE}[2]{\ensuremath{{#1}\,<:\,{#2}}}
384+
\newcommand{\MutualSubtype}[3]{\ensuremath{{#1}\vdash{#2}\,<:>\,{#3}}}
385+
\newcommand{\MutualSubtypeStd}[2]{\MutualSubtype{\Delta}{#1}{#2}}
386+
\newcommand{\MutualSubtypeNE}[2]{\ensuremath{{#1}\,<:>\,{#2}}}
384387

385388
% Judgment expressing that a supertype relation exists.
386389
\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
@@ -22108,18 +22108,20 @@ \subsection{Subtypes}
2210822108
% ------------------------------------------------ Positional Function Type
2210922109
\RuleRawRaw{\SrnPositionalFunctionType}{%
2211022110
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22111+
\forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
2211122112
\Subtype{\Delta'}{S_0}{T_0} \\
2211222113
n_1 \leq n_2 &
2211322114
n_1 + k_1 \geq n_2 + k_2 &
2211422115
\forall j \in 1 .. n_2 + k_2\!:\;\Subtype{\Delta'}{T_j}{S_j}}{%
2211522116
\begin{array}{c}
2211622117
\Delta\vdash\RawFunctionTypePositional{S_0}{X}{B}{s}{S}{n_1}{k_1}\;<:\;\\
22117-
\RawFunctionTypePositional{T_0}{X}{B}{s}{T}{n_2}{k_2}
22118+
\RawFunctionTypePositional{T_0}{X}{B'\!}{s}{T}{n_2}{k_2}
2211822119
\end{array}}
2211922120
\ExtraVSP\ExtraVSP
2212022121
% ------------------------------------------------ Named Function Type
2212122122
\RuleRawRaw{\SrnNamedFunctionType}{%
2212222123
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22124+
\forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
2212322125
\Subtype{\Delta'}{S_0}{T_0} &
2212422126
\forall j \in 1 .. n\!:\;\Subtype{\Delta'}{T_j}{S_j}\\
2212522127
\{\,\List{y}{n+1}{n+k_2}\,\} \subseteq \{\,\List{x}{n+1}{n+k_1}\,\}\\
@@ -22129,13 +22131,16 @@ \subsection{Subtypes}
2212922131
(r_{n+q} = \REQUIRED{} \Rightarrow r'_{n+p} = \REQUIRED)}{%
2213022132
\begin{array}{c}
2213122133
\Delta\vdash\RawFunctionTypeNamed{S_0}{X}{B}{s}{S}{n}{x}{k_1}{r}\;<:\;\\
22132-
\RawFunctionTypeNamed{T_0}{X}{B}{s}{T}{n}{y}{k_2}{r'}
22134+
\RawFunctionTypeNamed{T_0}{X}{B'\!}{s}{T}{n}{y}{k_2}{r'}
2213322135
\end{array}}
2213422136
%
2213522137
\ExtraVSP
2213622138
% ------------------------------------------------ Covariance
22139+
%% TODO(eernst): Type aliases have been expanded so there is no other
22140+
%% variance than covariance, but there will be in/out/inout in classes,
22141+
%% and then we'll need to handle variance here.
2213722142
\RuleRaw{\SrnCovariance}{%
22138-
\mbox{$C$ is an interface type with $s$ type parameters} &
22143+
\mbox{$C$ is an interface type with $s$ type parameters.} &
2213922144
\SubtypeStd{S_j}{T_j}\mbox{, for each $j \in 1..s$}}{%
2214022145
\code{$C$<\List{S}{1}{s}>}}{\code{$C$<\List{T}{1}{s}>}}
2214122146
\ExtraVSP
@@ -22300,7 +22305,8 @@ \subsubsection{Subtype Rules}
2230022305
In this specification we frequently refer to
2230122306
subtype relationships and assignability
2230222307
without mentioning the environment explicitly,
22303-
as in \Index{\SubtypeNE{S}{T}}.
22308+
as in
22309+
\IndexCustom{\SubtypeNE{S}{T}}{$<:$@\SubtypeNE{S}{T}}.
2230422310
This is only done when a specific location in code is in focus,
2230522311
and it means that the environment is that which is obtained
2230622312
by mapping each type variable in scope at that location
@@ -22334,7 +22340,7 @@ \subsubsection{Being a Subtype}
2233422340
A type $S$ is shown to be a \Index{subtype} of another type $T$
2233522341
in an environment $\Delta$ by providing
2233622342
an instantiation of a rule $R$ whose conclusion is
22337-
\IndexCustom{\SubtypeStd{S}{T}}{$\Delta$@\SubtypeStd{S}{T}},
22343+
\IndexCustom{\SubtypeStd{S}{T}}{$\Delta<:$@\SubtypeStd{S}{T}},
2233822344
along with rule instantiations showing
2233922345
each of the premises of $R$,
2234022346
continuing until a rule with no premises is reached.
@@ -22563,9 +22569,17 @@ \subsubsection{Additional Subtyping Concepts}
2256322569

2256422570
\LMHash{}%
2256522571
$S$ is a \Index{supertype} of $T$ in a given environment $\Delta$,
22566-
written \SupertypeStd{S}{T},
22572+
written
22573+
\IndexCustom{\SupertypeStd{S}{T}}{$\Delta:>$@\SupertypeStd{S}{T}},
2256722574
if{}f \SubtypeStd{T}{S}.
2256822575

22576+
\LMHash{}%
22577+
$S$ and $T$ are \Index{mutual subtypes} of each other
22578+
in a given environment $\Delta$,
22579+
written
22580+
\IndexCustom{\MutualSubtypeStd{S}{T}}{$\Delta<:>$@\MutualSubtypeStd{S}{T}},
22581+
if{}f both \SubtypeStd{T}{S} and \SubtypeStd{S}{T}.
22582+
2256922583
\LMHash{}%
2257022584
A type $T$
2257122585
\Index{may be assigned}
@@ -22723,7 +22737,8 @@ \subsection{Functions Dealing with Extreme Types}
2272322737
the first applicable case must be used.
2272422738

2272522739
\LMHash{}%
22726-
The \Index{\TopMergeTypeName} of two types computes
22740+
The \IndexCustom{\TopMergeTypeName}{topMergeType@\TopMergeTypeName}
22741+
of two types computes
2272722742
a canonical type which represents both of them,
2272822743
in the case where they are structurally identical
2272922744
modulo the choice among top types.
@@ -22788,7 +22803,8 @@ \subsection{Functions Dealing with Extreme Types}
2278822803
\commentary{The ordering of the arguments makes no difference.}
2278922804

2279022805
\LMHash{}%
22791-
The \Index{\IsTopTypeName} predicate is true for any type which is in
22806+
The \IndexCustom{\IsTopTypeName}{isTopType@\IsTopTypeName}
22807+
predicate is true for any type which is in
2279222808
the equivalence class of top types.
2279322809
It is a syntactic characterization of top types
2279422810
(\ref{superBoundedTypes}).
@@ -22802,8 +22818,9 @@ \subsection{Functions Dealing with Extreme Types}
2280222818
\end{itemize}
2280322819

2280422820
\noindent
22805-
The \Index{\IsObjectTypeName} predicate is true if{}f
22806-
the argument is a subtype and a supertype of \code{Object}.
22821+
The \IndexCustom{\IsObjectTypeName}{isObjectType@\IsObjectTypeName}
22822+
predicate is true if{}f the argument is
22823+
a subtype and a supertype of \code{Object}.
2280722824

2280822825
\begin{itemize}
2280922826
\item \DefEquals{\IsObjectType{Object}}{\metavar{true}}.
@@ -22812,8 +22829,8 @@ \subsection{Functions Dealing with Extreme Types}
2281222829
\end{itemize}
2281322830

2281422831
\noindent
22815-
The \Index{\IsBottomTypeName} predicate is true if{}f
22816-
the argument is a subtype of \code{Never}.
22832+
The \IndexCustom{\IsBottomTypeName}{isBottomType@\IsBottomTypeName}
22833+
predicate is true if{}f the argument is a subtype of \code{Never}.
2281722834

2281822835
\begin{itemize}
2281922836
\item \DefEquals{\IsBottomType{Never}}{\metavar{true}}.
@@ -22823,8 +22840,9 @@ \subsection{Functions Dealing with Extreme Types}
2282322840
\end{itemize}
2282422841

2282522842
\noindent
22826-
The \Index{\IsNullTypeName} predicate is true if{}f
22827-
the argument is a subtype and a supertype of \code{Null}.
22843+
The \IndexCustom{\IsNullTypeName}{isNullType@\IsNullTypeName}
22844+
predicate is true if{}f the argument is
22845+
a subtype and a supertype of \code{Null}.
2282822846

2282922847
\begin{itemize}
2283022848
\item \DefEquals{\IsNullType{Null}}{\metavar{true}}.
@@ -22833,8 +22851,8 @@ \subsection{Functions Dealing with Extreme Types}
2283322851
\end{itemize}
2283422852

2283522853
\noindent
22836-
The \Index{\IsMoreTopTypeName} predicate defines a total order on
22837-
top and \code{Object} types.
22854+
The \IndexCustom{\IsMoreTopTypeName}{isMoreTopType@\IsMoreTopTypeName}
22855+
predicate defines a total order on top and \code{Object} types.
2283822856

2283922857
\begin{itemize}
2284022858
\item \DefEquals{\IsMoreTopType{\VOID}{$T$}}{\metavar{true}}.
@@ -22851,8 +22869,8 @@ \subsection{Functions Dealing with Extreme Types}
2285122869
\end{itemize}
2285222870

2285322871
\noindent
22854-
The \Index{\IsMoreBottomTypeName} predicate defines an almost total order on
22855-
bottom and \code{Null} types.
22872+
The \IndexCustom{\IsMoreBottomTypeName}{isMoreBottomType@\IsMoreBottomTypeName}
22873+
predicate defines an almost total order on bottom and \code{Null} types.
2285622874
\commentary{%
2285722875
This does not consistently order
2285822876
two different type variables with the same bound.%
@@ -22931,7 +22949,9 @@ \subsection{Type Normalization}
2293122949
}
2293222950

2293322951
\LMHash{}%
22934-
The function \Index{\NormalizedTypeOfName} is then defined as follows:
22952+
The function
22953+
\IndexCustom{\NormalizedTypeOfName}{normalizedType@\NormalizedTypeOfName}
22954+
is then defined as follows:
2293522955
\BlindDefineSymbol{T_a, T_u, T_r}%
2293622956
Let $T_a$ be a type
2293722957
(\commentary{where `a' stands for `argument'}).

0 commit comments

Comments
 (0)