Skip to content

Commit fc64b81

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

File tree

2 files changed

+48
-25
lines changed

2 files changed

+48
-25
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: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6267,7 +6267,7 @@ \subsection{Explicit Invocation of an Instance Member of an Extension}
62676267
\IndexCustom{instantiated \ON{} type}{extension!instantiated \ON{} type}
62686268
of $a$ as $[T_1/X_1, \ldots, T_s/X_s]T$.
62696269
We define the
6270-
\IndexCustom{instantiation-to-bound \ON{} type}{
6270+
\IndexCustom{instantiation-to-bound \ON{} type}{%
62716271
extension!instantiation-to-bound \ON{} type}
62726272
of $a$ as $[U_1/X_1, \ldots, U_s/X_s]T$,
62736273
where \List{U}{1}{s} is the result of instantiation to bound
@@ -6342,7 +6342,7 @@ \subsection{Explicit Invocation of an Instance Member of an Extension}
63426342

63436343
\LMHash{}%
63446344
The member signature $s_1$ is called the
6345-
\IndexCustom{invocation member signature}{
6345+
\IndexCustom{invocation member signature}{%
63466346
extension!invocation member signature}
63476347
of $i$.
63486348
The static type of $i$ is the return type of
@@ -13953,7 +13953,7 @@ \subsection{Member Invocations}
1395313953
expression $r$ is an expression of
1395413954
one of the forms shown in Fig.~\ref{fig:memberInvocations}.
1395513955
Each member invocation has a
13956-
\IndexCustom{corresponding member name}{
13956+
\IndexCustom{corresponding member name}{%
1395713957
member invocation!corresponding member name}
1395813958
as shown in the figure.
1395913959

@@ -14557,7 +14557,7 @@ \subsubsection{Superinvocations}
1455714557

1455814558
\LMHash{}%
1455914559
An
14560-
\IndexCustom{implicit \CALL{} superinvocation}{
14560+
\IndexCustom{implicit \CALL{} superinvocation}{%
1456114561
method superinvocation!implicit \CALL}
1456214562
has the form
1456314563

@@ -21663,7 +21663,7 @@ \subsection{Type Aliases}
2166321663
we say that the parameterized type $U$ of the form
2166421664
\code{$F$<\List{U}{1}{s}>}
2166521665
in a scope where $F$ resolves to $D$
21666-
\IndexCustom{alias expands in one step to}{
21666+
\IndexCustom{alias expands in one step to}{%
2166721667
type alias!alias expands in one step}
2166821668
$[U_1/X_1, \ldots, U_s/X_s]T$.
2166921669

@@ -21678,7 +21678,7 @@ \subsection{Type Aliases}
2167821678
by its alias expansion in one step
2167921679
(\commentary{including the non-generic case where there are no type arguments}).
2168021680
When no further steps are possible we say that the resulting type is the
21681-
\IndexCustom{transitive alias expansion}{
21681+
\IndexCustom{transitive alias expansion}{%
2168221682
type alias!transitive alias expansion}
2168321683
of $U$.
2168421684

@@ -22017,18 +22017,20 @@ \subsection{Subtypes}
2201722017
% ------------------------------------------------ Positional Function Type
2201822018
\RuleRawRaw{\SrnPositionalFunctionType}{%
2201922019
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22020+
\forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
2202022021
\Subtype{\Delta'}{S_0}{T_0} \\
2202122022
n_1 \leq n_2 &
2202222023
n_1 + k_1 \geq n_2 + k_2 &
2202322024
\forall j \in 1 .. n_2 + k_2\!:\;\Subtype{\Delta'}{T_j}{S_j}}{%
2202422025
\begin{array}{c}
2202522026
\Delta\vdash\RawFunctionTypePositional{S_0}{X}{B}{s}{S}{n_1}{k_1}\;<:\;\\
22026-
\RawFunctionTypePositional{T_0}{X}{B}{s}{T}{n_2}{k_2}
22027+
\RawFunctionTypePositional{T_0}{X}{B'\!}{s}{T}{n_2}{k_2}
2202722028
\end{array}}
2202822029
\ExtraVSP\ExtraVSP
2202922030
% ------------------------------------------------ Named Function Type
2203022031
\RuleRawRaw{\SrnNamedFunctionType}{
2203122032
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22033+
\forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
2203222034
\Subtype{\Delta'}{S_0}{T_0} &
2203322035
\forall j \in 1 .. n\!:\;\Subtype{\Delta'}{T_j}{S_j}\\
2203422036
\{\,\List{y}{n+1}{n+k_2}\,\} \subseteq \{\,\List{x}{n+1}{n+k_1}\,\}\\
@@ -22038,13 +22040,16 @@ \subsection{Subtypes}
2203822040
(r_{n+q} = \REQUIRED{} \Rightarrow r'_{n+p} = \REQUIRED)}{%
2203922041
\begin{array}{c}
2204022042
\Delta\vdash\RawFunctionTypeNamed{S_0}{X}{B}{s}{S}{n}{x}{k_1}{r}\;<:\;\\
22041-
\RawFunctionTypeNamed{T_0}{X}{B}{s}{T}{n}{y}{k_2}{r'}
22043+
\RawFunctionTypeNamed{T_0}{X}{B'\!}{s}{T}{n}{y}{k_2}{r'}
2204222044
\end{array}}
2204322045
%
2204422046
\ExtraVSP
2204522047
% ------------------------------------------------ Covariance
22048+
%% TODO(eernst): Type aliases have been expanded so there is no other
22049+
%% variance than covariance, but there will be in/out/inout in classes,
22050+
%% and then we'll need to handle variance here.
2204622051
\RuleRaw{\SrnCovariance}{%
22047-
\mbox{$C$ is an interface type with $s$ type parameters} &
22052+
\mbox{$C$ is an interface type with $s$ type parameters.} &
2204822053
\SubtypeStd{S_j}{T_j}\mbox{, for each $j \in 1..s$}}{%
2204922054
\code{$C$<\List{S}{1}{s}>}}{\code{$C$<\List{T}{1}{s}>}}
2205022055
\ExtraVSP
@@ -22209,7 +22214,8 @@ \subsubsection{Subtype Rules}
2220922214
In this specification we frequently refer to
2221022215
subtype relationships and assignability
2221122216
without mentioning the environment explicitly,
22212-
as in \Index{\SubtypeNE{S}{T}}.
22217+
as in
22218+
\IndexCustom{\SubtypeNE{S}{T}}{$<:$@\SubtypeNE{S}{T}}.
2221322219
This is only done when a specific location in code is in focus,
2221422220
and it means that the environment is that which is obtained
2221522221
by mapping each type variable in scope at that location
@@ -22243,7 +22249,7 @@ \subsubsection{Being a Subtype}
2224322249
A type $S$ is shown to be a \Index{subtype} of another type $T$
2224422250
in an environment $\Delta$ by providing
2224522251
an instantiation of a rule $R$ whose conclusion is
22246-
\IndexCustom{\SubtypeStd{S}{T}}{$\Delta$@\SubtypeStd{S}{T}},
22252+
\IndexCustom{\SubtypeStd{S}{T}}{$\Delta<:$@\SubtypeStd{S}{T}},
2224722253
along with rule instantiations showing
2224822254
each of the premises of $R$,
2224922255
continuing until a rule with no premises is reached.
@@ -22472,9 +22478,17 @@ \subsubsection{Additional Subtyping Concepts}
2247222478

2247322479
\LMHash{}%
2247422480
$S$ is a \Index{supertype} of $T$ in a given environment $\Delta$,
22475-
written \SupertypeStd{S}{T},
22481+
written
22482+
\IndexCustom{\SupertypeStd{S}{T}}{$\Delta:>$@\SupertypeStd{S}{T}},
2247622483
if{}f \SubtypeStd{T}{S}.
2247722484

22485+
\LMHash{}%
22486+
$S$ and $T$ are \Index{mutual subtypes} of each other
22487+
in a given environment $\Delta$,
22488+
written
22489+
\IndexCustom{\MutualSubtypeStd{S}{T}}{$\Delta<:>$@\MutualSubtypeStd{S}{T}},
22490+
if{}f both \SubtypeStd{T}{S} and \SubtypeStd{S}{T}.
22491+
2247822492
\LMHash{}%
2247922493
A type $T$
2248022494
\Index{may be assigned}
@@ -22632,7 +22646,8 @@ \subsection{Functions Dealing with Extreme Types}
2263222646
the first applicable case must be used.
2263322647

2263422648
\LMHash{}%
22635-
The \Index{\TopMergeTypeName} of two types computes
22649+
The \IndexCustom{\TopMergeTypeName}{topMergeType@\TopMergeTypeName}
22650+
of two types computes
2263622651
a canonical type which represents both of them,
2263722652
in the case where they are structurally identical
2263822653
modulo the choice among top types.
@@ -22697,7 +22712,8 @@ \subsection{Functions Dealing with Extreme Types}
2269722712
\commentary{The ordering of the arguments makes no difference.}
2269822713

2269922714
\LMHash{}%
22700-
The \Index{\IsTopTypeName} predicate is true for any type which is in
22715+
The \IndexCustom{\IsTopTypeName}{isTopType@\IsTopTypeName}
22716+
predicate is true for any type which is in
2270122717
the equivalence class of top types.
2270222718
It is a syntactic characterization of top types
2270322719
(\ref{superBoundedTypes}).
@@ -22711,8 +22727,9 @@ \subsection{Functions Dealing with Extreme Types}
2271122727
\end{itemize}
2271222728

2271322729
\noindent
22714-
The \Index{\IsObjectTypeName} predicate is true if{}f
22715-
the argument is a subtype and a supertype of \code{Object}.
22730+
The \IndexCustom{\IsObjectTypeName}{isObjectType@\IsObjectTypeName}
22731+
predicate is true if{}f the argument is
22732+
a subtype and a supertype of \code{Object}.
2271622733

2271722734
\begin{itemize}
2271822735
\item \DefEquals{\IsObjectType{Object}}{\metavar{true}}.
@@ -22721,8 +22738,8 @@ \subsection{Functions Dealing with Extreme Types}
2272122738
\end{itemize}
2272222739

2272322740
\noindent
22724-
The \Index{\IsBottomTypeName} predicate is true if{}f
22725-
the argument is a subtype of \code{Never}.
22741+
The \IndexCustom{\IsBottomTypeName}{isBottomType@\IsBottomTypeName}
22742+
predicate is true if{}f the argument is a subtype of \code{Never}.
2272622743

2272722744
\begin{itemize}
2272822745
\item \DefEquals{\IsBottomType{Never}}{\metavar{true}}.
@@ -22732,8 +22749,9 @@ \subsection{Functions Dealing with Extreme Types}
2273222749
\end{itemize}
2273322750

2273422751
\noindent
22735-
The \Index{\IsNullTypeName} predicate is true if{}f
22736-
the argument is a subtype and a supertype of \code{Null}.
22752+
The \IndexCustom{\IsNullTypeName}{isNullType@\IsNullTypeName}
22753+
predicate is true if{}f the argument is
22754+
a subtype and a supertype of \code{Null}.
2273722755

2273822756
\begin{itemize}
2273922757
\item \DefEquals{\IsNullType{Null}}{\metavar{true}}.
@@ -22742,8 +22760,8 @@ \subsection{Functions Dealing with Extreme Types}
2274222760
\end{itemize}
2274322761

2274422762
\noindent
22745-
The \Index{\IsMoreTopTypeName} predicate defines a total order on
22746-
top and \code{Object} types.
22763+
The \IndexCustom{\IsMoreTopTypeName}{isMoreTopType@\IsMoreTopTypeName}
22764+
predicate defines a total order on top and \code{Object} types.
2274722765

2274822766
\begin{itemize}
2274922767
\item \DefEquals{\IsMoreTopType{\VOID}{$T$}}{\metavar{true}}.
@@ -22760,8 +22778,8 @@ \subsection{Functions Dealing with Extreme Types}
2276022778
\end{itemize}
2276122779

2276222780
\noindent
22763-
The \Index{\IsMoreBottomTypeName} predicate defines an almost total order on
22764-
bottom and \code{Null} types.
22781+
The \IndexCustom{\IsMoreBottomTypeName}{isMoreBottomType@\IsMoreBottomTypeName}
22782+
predicate defines an almost total order on bottom and \code{Null} types.
2276522783
\commentary{%
2276622784
This does not consistently order
2276722785
two different type variables with the same bound.%
@@ -22840,7 +22858,9 @@ \subsection{Type Normalization}
2284022858
}
2284122859

2284222860
\LMHash{}%
22843-
The function \Index{\NormalizedTypeOfName} is then defined as follows:
22861+
The function
22862+
\IndexCustom{\NormalizedTypeOfName}{normalizedType@\NormalizedTypeOfName}
22863+
is then defined as follows:
2284422864
\BlindDefineSymbol{T_a, T_u, T_r}%
2284522865
Let $T_a$ be a type
2284622866
(\commentary{where `a' stands for `argument'}).

0 commit comments

Comments
 (0)