Skip to content

Commit 38ea227

Browse files
committed
Corrected function type subtype rule (bounds); corrected "math" index entries
1 parent 4b411f9 commit 38ea227

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
@@ -22106,18 +22106,20 @@ \subsection{Subtypes}
2210622106
% ------------------------------------------------ Positional Function Type
2210722107
\RuleRawRaw{\SrnPositionalFunctionType}{%
2210822108
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22109+
\forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
2210922110
\Subtype{\Delta'}{S_0}{T_0} \\
2211022111
n_1 \leq n_2 &
2211122112
n_1 + k_1 \geq n_2 + k_2 &
2211222113
\forall j \in 1 .. n_2 + k_2\!:\;\Subtype{\Delta'}{T_j}{S_j}}{%
2211322114
\begin{array}{c}
2211422115
\Delta\vdash\RawFunctionTypePositional{S_0}{X}{B}{s}{S}{n_1}{k_1}\;<:\;\\
22115-
\RawFunctionTypePositional{T_0}{X}{B}{s}{T}{n_2}{k_2}
22116+
\RawFunctionTypePositional{T_0}{X}{B'\!}{s}{T}{n_2}{k_2}
2211622117
\end{array}}
2211722118
\ExtraVSP\ExtraVSP
2211822119
% ------------------------------------------------ Named Function Type
2211922120
\RuleRawRaw{\SrnNamedFunctionType}{%
2212022121
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22122+
\forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
2212122123
\Subtype{\Delta'}{S_0}{T_0} &
2212222124
\forall j \in 1 .. n\!:\;\Subtype{\Delta'}{T_j}{S_j}\\
2212322125
\{\,\List{y}{n+1}{n+k_2}\,\} \subseteq \{\,\List{x}{n+1}{n+k_1}\,\}\\
@@ -22127,13 +22129,16 @@ \subsection{Subtypes}
2212722129
(r_{n+q} = \REQUIRED{} \Rightarrow r'_{n+p} = \REQUIRED)}{%
2212822130
\begin{array}{c}
2212922131
\Delta\vdash\RawFunctionTypeNamed{S_0}{X}{B}{s}{S}{n}{x}{k_1}{r}\;<:\;\\
22130-
\RawFunctionTypeNamed{T_0}{X}{B}{s}{T}{n}{y}{k_2}{r'}
22132+
\RawFunctionTypeNamed{T_0}{X}{B'\!}{s}{T}{n}{y}{k_2}{r'}
2213122133
\end{array}}
2213222134
%
2213322135
\ExtraVSP
2213422136
% ------------------------------------------------ Covariance
22137+
%% TODO(eernst): Type aliases have been expanded so there is no other
22138+
%% variance than covariance, but there will be in/out/inout in classes,
22139+
%% and then we'll need to handle variance here.
2213522140
\RuleRaw{\SrnCovariance}{%
22136-
\mbox{$C$ is an interface type with $s$ type parameters} &
22141+
\mbox{$C$ is an interface type with $s$ type parameters.} &
2213722142
\SubtypeStd{S_j}{T_j}\mbox{, for each $j \in 1..s$}}{%
2213822143
\code{$C$<\List{S}{1}{s}>}}{\code{$C$<\List{T}{1}{s}>}}
2213922144
\ExtraVSP
@@ -22298,7 +22303,8 @@ \subsubsection{Subtype Rules}
2229822303
In this specification we frequently refer to
2229922304
subtype relationships and assignability
2230022305
without mentioning the environment explicitly,
22301-
as in \Index{\SubtypeNE{S}{T}}.
22306+
as in
22307+
\IndexCustom{\SubtypeNE{S}{T}}{$<:$@\SubtypeNE{S}{T}}.
2230222308
This is only done when a specific location in code is in focus,
2230322309
and it means that the environment is that which is obtained
2230422310
by mapping each type variable in scope at that location
@@ -22332,7 +22338,7 @@ \subsubsection{Being a Subtype}
2233222338
A type $S$ is shown to be a \Index{subtype} of another type $T$
2233322339
in an environment $\Delta$ by providing
2233422340
an instantiation of a rule $R$ whose conclusion is
22335-
\IndexCustom{\SubtypeStd{S}{T}}{$\Delta$@\SubtypeStd{S}{T}},
22341+
\IndexCustom{\SubtypeStd{S}{T}}{$\Delta<:$@\SubtypeStd{S}{T}},
2233622342
along with rule instantiations showing
2233722343
each of the premises of $R$,
2233822344
continuing until a rule with no premises is reached.
@@ -22561,9 +22567,17 @@ \subsubsection{Additional Subtyping Concepts}
2256122567

2256222568
\LMHash{}%
2256322569
$S$ is a \Index{supertype} of $T$ in a given environment $\Delta$,
22564-
written \SupertypeStd{S}{T},
22570+
written
22571+
\IndexCustom{\SupertypeStd{S}{T}}{$\Delta:>$@\SupertypeStd{S}{T}},
2256522572
if{}f \SubtypeStd{T}{S}.
2256622573

22574+
\LMHash{}%
22575+
$S$ and $T$ are \Index{mutual subtypes} of each other
22576+
in a given environment $\Delta$,
22577+
written
22578+
\IndexCustom{\MutualSubtypeStd{S}{T}}{$\Delta<:>$@\MutualSubtypeStd{S}{T}},
22579+
if{}f both \SubtypeStd{T}{S} and \SubtypeStd{S}{T}.
22580+
2256722581
\LMHash{}%
2256822582
A type $T$
2256922583
\Index{may be assigned}
@@ -22721,7 +22735,8 @@ \subsection{Functions Dealing with Extreme Types}
2272122735
the first applicable case must be used.
2272222736

2272322737
\LMHash{}%
22724-
The \Index{\TopMergeTypeName} of two types computes
22738+
The \IndexCustom{\TopMergeTypeName}{topMergeType@\TopMergeTypeName}
22739+
of two types computes
2272522740
a canonical type which represents both of them,
2272622741
in the case where they are structurally identical
2272722742
modulo the choice among top types.
@@ -22786,7 +22801,8 @@ \subsection{Functions Dealing with Extreme Types}
2278622801
\commentary{The ordering of the arguments makes no difference.}
2278722802

2278822803
\LMHash{}%
22789-
The \Index{\IsTopTypeName} predicate is true for any type which is in
22804+
The \IndexCustom{\IsTopTypeName}{isTopType@\IsTopTypeName}
22805+
predicate is true for any type which is in
2279022806
the equivalence class of top types.
2279122807
It is a syntactic characterization of top types
2279222808
(\ref{superBoundedTypes}).
@@ -22800,8 +22816,9 @@ \subsection{Functions Dealing with Extreme Types}
2280022816
\end{itemize}
2280122817

2280222818
\noindent
22803-
The \Index{\IsObjectTypeName} predicate is true if{}f
22804-
the argument is a subtype and a supertype of \code{Object}.
22819+
The \IndexCustom{\IsObjectTypeName}{isObjectType@\IsObjectTypeName}
22820+
predicate is true if{}f the argument is
22821+
a subtype and a supertype of \code{Object}.
2280522822

2280622823
\begin{itemize}
2280722824
\item \DefEquals{\IsObjectType{Object}}{\metavar{true}}.
@@ -22810,8 +22827,8 @@ \subsection{Functions Dealing with Extreme Types}
2281022827
\end{itemize}
2281122828

2281222829
\noindent
22813-
The \Index{\IsBottomTypeName} predicate is true if{}f
22814-
the argument is a subtype of \code{Never}.
22830+
The \IndexCustom{\IsBottomTypeName}{isBottomType@\IsBottomTypeName}
22831+
predicate is true if{}f the argument is a subtype of \code{Never}.
2281522832

2281622833
\begin{itemize}
2281722834
\item \DefEquals{\IsBottomType{Never}}{\metavar{true}}.
@@ -22821,8 +22838,9 @@ \subsection{Functions Dealing with Extreme Types}
2282122838
\end{itemize}
2282222839

2282322840
\noindent
22824-
The \Index{\IsNullTypeName} predicate is true if{}f
22825-
the argument is a subtype and a supertype of \code{Null}.
22841+
The \IndexCustom{\IsNullTypeName}{isNullType@\IsNullTypeName}
22842+
predicate is true if{}f the argument is
22843+
a subtype and a supertype of \code{Null}.
2282622844

2282722845
\begin{itemize}
2282822846
\item \DefEquals{\IsNullType{Null}}{\metavar{true}}.
@@ -22831,8 +22849,8 @@ \subsection{Functions Dealing with Extreme Types}
2283122849
\end{itemize}
2283222850

2283322851
\noindent
22834-
The \Index{\IsMoreTopTypeName} predicate defines a total order on
22835-
top and \code{Object} types.
22852+
The \IndexCustom{\IsMoreTopTypeName}{isMoreTopType@\IsMoreTopTypeName}
22853+
predicate defines a total order on top and \code{Object} types.
2283622854

2283722855
\begin{itemize}
2283822856
\item \DefEquals{\IsMoreTopType{\VOID}{$T$}}{\metavar{true}}.
@@ -22849,8 +22867,8 @@ \subsection{Functions Dealing with Extreme Types}
2284922867
\end{itemize}
2285022868

2285122869
\noindent
22852-
The \Index{\IsMoreBottomTypeName} predicate defines an almost total order on
22853-
bottom and \code{Null} types.
22870+
The \IndexCustom{\IsMoreBottomTypeName}{isMoreBottomType@\IsMoreBottomTypeName}
22871+
predicate defines an almost total order on bottom and \code{Null} types.
2285422872
\commentary{%
2285522873
This does not consistently order
2285622874
two different type variables with the same bound.%
@@ -22929,7 +22947,9 @@ \subsection{Type Normalization}
2292922947
}
2293022948

2293122949
\LMHash{}%
22932-
The function \Index{\NormalizedTypeOfName} is then defined as follows:
22950+
The function
22951+
\IndexCustom{\NormalizedTypeOfName}{normalizedType@\NormalizedTypeOfName}
22952+
is then defined as follows:
2293322953
\BlindDefineSymbol{T_a, T_u, T_r}%
2293422954
Let $T_a$ be a type
2293522955
(\commentary{where `a' stands for `argument'}).

0 commit comments

Comments
 (0)