Skip to content

Commit 69dc80e

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

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
@@ -22536,18 +22536,20 @@ \subsection{Subtypes}
2253622536
% ------------------------------------------------ Positional Function Type
2253722537
\RuleRawRaw{\SrnPositionalFunctionType}{%
2253822538
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22539+
\forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
2253922540
\Subtype{\Delta'}{S_0}{T_0} \\
2254022541
n_1 \leq n_2 &
2254122542
n_1 + k_1 \geq n_2 + k_2 &
2254222543
\forall j \in 1 .. n_2 + k_2\!:\;\Subtype{\Delta'}{T_j}{S_j}}{%
2254322544
\begin{array}{c}
2254422545
\Delta\vdash\RawFunctionTypePositional{S_0}{X}{B}{s}{S}{n_1}{k_1}\;<:\;\\
22545-
\RawFunctionTypePositional{T_0}{X}{B}{s}{T}{n_2}{k_2}
22546+
\RawFunctionTypePositional{T_0}{X}{B'\!}{s}{T}{n_2}{k_2}
2254622547
\end{array}}
2254722548
\ExtraVSP\ExtraVSP
2254822549
% ------------------------------------------------ Named Function Type
2254922550
\RuleRawRaw{\SrnNamedFunctionType}{%
2255022551
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22552+
\forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
2255122553
\Subtype{\Delta'}{S_0}{T_0} &
2255222554
\forall j \in 1 .. n\!:\;\Subtype{\Delta'}{T_j}{S_j}\\
2255322555
\{\,\List{y}{n+1}{n+k_2}\,\} \subseteq \{\,\List{x}{n+1}{n+k_1}\,\}\\
@@ -22557,13 +22559,16 @@ \subsection{Subtypes}
2255722559
(r_{n+q} = \REQUIRED{} \Rightarrow r'_{n+p} = \REQUIRED)}{%
2255822560
\begin{array}{c}
2255922561
\Delta\vdash\RawFunctionTypeNamed{S_0}{X}{B}{s}{S}{n}{x}{k_1}{r}\;<:\;\\
22560-
\RawFunctionTypeNamed{T_0}{X}{B}{s}{T}{n}{y}{k_2}{r'}
22562+
\RawFunctionTypeNamed{T_0}{X}{B'\!}{s}{T}{n}{y}{k_2}{r'}
2256122563
\end{array}}
2256222564
%
2256322565
\ExtraVSP
2256422566
% ------------------------------------------------ Covariance
22567+
%% TODO(eernst): Type aliases have been expanded so there is no other
22568+
%% variance than covariance, but there will be in/out/inout in classes,
22569+
%% and then we'll need to handle variance here.
2256522570
\RuleRaw{\SrnCovariance}{%
22566-
\mbox{$C$ is an interface type with $s$ type parameters} &
22571+
\mbox{$C$ is an interface type with $s$ type parameters.} &
2256722572
\SubtypeStd{S_j}{T_j}\mbox{, for each $j \in 1..s$}}{%
2256822573
\code{$C$<\List{S}{1}{s}>}}{\code{$C$<\List{T}{1}{s}>}}
2256922574
\ExtraVSP
@@ -22728,7 +22733,8 @@ \subsubsection{Subtype Rules}
2272822733
In this specification we frequently refer to
2272922734
subtype relationships and assignability
2273022735
without mentioning the environment explicitly,
22731-
as in \Index{\SubtypeNE{S}{T}}.
22736+
as in
22737+
\IndexCustom{\SubtypeNE{S}{T}}{$<:$@\SubtypeNE{S}{T}}.
2273222738
This is only done when a specific location in code is in focus,
2273322739
and it means that the environment is that which is obtained
2273422740
by mapping each type variable in scope at that location
@@ -22762,7 +22768,7 @@ \subsubsection{Being a Subtype}
2276222768
A type $S$ is shown to be a \Index{subtype} of another type $T$
2276322769
in an environment $\Delta$ by providing
2276422770
an instantiation of a rule $R$ whose conclusion is
22765-
\IndexCustom{\SubtypeStd{S}{T}}{$\Delta$@\SubtypeStd{S}{T}},
22771+
\IndexCustom{\SubtypeStd{S}{T}}{$\Delta<:$@\SubtypeStd{S}{T}},
2276622772
along with rule instantiations showing
2276722773
each of the premises of $R$,
2276822774
continuing until a rule with no premises is reached.
@@ -22991,9 +22997,17 @@ \subsubsection{Additional Subtyping Concepts}
2299122997

2299222998
\LMHash{}%
2299322999
$S$ is a \Index{supertype} of $T$ in a given environment $\Delta$,
22994-
written \SupertypeStd{S}{T},
23000+
written
23001+
\IndexCustom{\SupertypeStd{S}{T}}{$\Delta:>$@\SupertypeStd{S}{T}},
2299523002
if{}f \SubtypeStd{T}{S}.
2299623003

23004+
\LMHash{}%
23005+
$S$ and $T$ are \Index{mutual subtypes} of each other
23006+
in a given environment $\Delta$,
23007+
written
23008+
\IndexCustom{\MutualSubtypeStd{S}{T}}{$\Delta<:>$@\MutualSubtypeStd{S}{T}},
23009+
if{}f both \SubtypeStd{T}{S} and \SubtypeStd{S}{T}.
23010+
2299723011
\LMHash{}%
2299823012
A type $T$
2299923013
\Index{may be assigned}
@@ -23151,7 +23165,8 @@ \subsection{Functions Dealing with Extreme Types}
2315123165
the first applicable case must be used.
2315223166

2315323167
\LMHash{}%
23154-
The \Index{\TopMergeTypeName} of two types computes
23168+
The \IndexCustom{\TopMergeTypeName}{topMergeType@\TopMergeTypeName}
23169+
of two types computes
2315523170
a canonical type which represents both of them,
2315623171
in the case where they are structurally identical
2315723172
modulo the choice among top types.
@@ -23216,7 +23231,8 @@ \subsection{Functions Dealing with Extreme Types}
2321623231
\commentary{The ordering of the arguments makes no difference.}
2321723232

2321823233
\LMHash{}%
23219-
The \Index{\IsTopTypeName} predicate is true for any type which is in
23234+
The \IndexCustom{\IsTopTypeName}{isTopType@\IsTopTypeName}
23235+
predicate is true for any type which is in
2322023236
the equivalence class of top types.
2322123237
It is a syntactic characterization of top types
2322223238
(\ref{superBoundedTypes}).
@@ -23230,8 +23246,9 @@ \subsection{Functions Dealing with Extreme Types}
2323023246
\end{itemize}
2323123247

2323223248
\noindent
23233-
The \Index{\IsObjectTypeName} predicate is true if{}f
23234-
the argument is a subtype and a supertype of \code{Object}.
23249+
The \IndexCustom{\IsObjectTypeName}{isObjectType@\IsObjectTypeName}
23250+
predicate is true if{}f the argument is
23251+
a subtype and a supertype of \code{Object}.
2323523252

2323623253
\begin{itemize}
2323723254
\item \DefEquals{\IsObjectType{Object}}{\metavar{true}}.
@@ -23240,8 +23257,8 @@ \subsection{Functions Dealing with Extreme Types}
2324023257
\end{itemize}
2324123258

2324223259
\noindent
23243-
The \Index{\IsBottomTypeName} predicate is true if{}f
23244-
the argument is a subtype of \code{Never}.
23260+
The \IndexCustom{\IsBottomTypeName}{isBottomType@\IsBottomTypeName}
23261+
predicate is true if{}f the argument is a subtype of \code{Never}.
2324523262

2324623263
\begin{itemize}
2324723264
\item \DefEquals{\IsBottomType{Never}}{\metavar{true}}.
@@ -23251,8 +23268,9 @@ \subsection{Functions Dealing with Extreme Types}
2325123268
\end{itemize}
2325223269

2325323270
\noindent
23254-
The \Index{\IsNullTypeName} predicate is true if{}f
23255-
the argument is a subtype and a supertype of \code{Null}.
23271+
The \IndexCustom{\IsNullTypeName}{isNullType@\IsNullTypeName}
23272+
predicate is true if{}f the argument is
23273+
a subtype and a supertype of \code{Null}.
2325623274

2325723275
\begin{itemize}
2325823276
\item \DefEquals{\IsNullType{Null}}{\metavar{true}}.
@@ -23261,8 +23279,8 @@ \subsection{Functions Dealing with Extreme Types}
2326123279
\end{itemize}
2326223280

2326323281
\noindent
23264-
The \Index{\IsMoreTopTypeName} predicate defines a total order on
23265-
top and \code{Object} types.
23282+
The \IndexCustom{\IsMoreTopTypeName}{isMoreTopType@\IsMoreTopTypeName}
23283+
predicate defines a total order on top and \code{Object} types.
2326623284

2326723285
\begin{itemize}
2326823286
\item \DefEquals{\IsMoreTopType{\VOID}{$T$}}{\metavar{true}}.
@@ -23279,8 +23297,8 @@ \subsection{Functions Dealing with Extreme Types}
2327923297
\end{itemize}
2328023298

2328123299
\noindent
23282-
The \Index{\IsMoreBottomTypeName} predicate defines an almost total order on
23283-
bottom and \code{Null} types.
23300+
The \IndexCustom{\IsMoreBottomTypeName}{isMoreBottomType@\IsMoreBottomTypeName}
23301+
predicate defines an almost total order on bottom and \code{Null} types.
2328423302
\commentary{%
2328523303
This does not consistently order
2328623304
two different type variables with the same bound.%
@@ -23359,7 +23377,9 @@ \subsection{Type Normalization}
2335923377
}
2336023378

2336123379
\LMHash{}%
23362-
The function \Index{\NormalizedTypeOfName} is then defined as follows:
23380+
The function
23381+
\IndexCustom{\NormalizedTypeOfName}{normalizedType@\NormalizedTypeOfName}
23382+
is then defined as follows:
2336323383
\BlindDefineSymbol{T_a, T_u, T_r}%
2336423384
Let $T_a$ be a type
2336523385
(\commentary{where `a' stands for `argument'}).

0 commit comments

Comments
 (0)