Skip to content

Commit c6e05e6

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

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
@@ -466,6 +466,9 @@
466466
\newcommand{\SubtypeStd}[2]{\Subtype{\Delta}{#1}{#2}}
467467
% Subtype judgment where the environment is omitted (NE: "no environment").
468468
\newcommand{\SubtypeNE}[2]{\ensuremath{{#1}\,<:\,{#2}}}
469+
\newcommand{\MutualSubtype}[3]{\ensuremath{{#1}\vdash{#2}\,<:>\,{#3}}}
470+
\newcommand{\MutualSubtypeStd}[2]{\MutualSubtype{\Delta}{#1}{#2}}
471+
\newcommand{\MutualSubtypeNE}[2]{\ensuremath{{#1}\,<:>\,{#2}}}
469472

470473
% Judgment expressing that a supertype relation exists.
471474
\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
@@ -22987,18 +22987,20 @@ \subsection{Subtypes}
2298722987
% ------------------------------------------------ Positional Function Type
2298822988
\RuleRawRaw{\SrnPositionalFunctionType}{%
2298922989
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22990+
\forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
2299022991
\Subtype{\Delta'}{S_0}{T_0} \\
2299122992
n_1 \leq n_2 &
2299222993
n_1 + k_1 \geq n_2 + k_2 &
2299322994
\forall j \in 1 .. n_2 + k_2\!:\;\Subtype{\Delta'}{T_j}{S_j}}{%
2299422995
\begin{array}{c}
2299522996
\Delta\vdash\RawFunctionTypePositional{S_0}{X}{B}{s}{S}{n_1}{k_1}\;<:\;\\
22996-
\RawFunctionTypePositional{T_0}{X}{B}{s}{T}{n_2}{k_2}
22997+
\RawFunctionTypePositional{T_0}{X}{B'\!}{s}{T}{n_2}{k_2}
2299722998
\end{array}}
2299822999
\ExtraVSP\ExtraVSP
2299923000
% ------------------------------------------------ Named Function Type
2300023001
\RuleRawRaw{\SrnNamedFunctionType}{%
2300123002
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
23003+
\forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
2300223004
\Subtype{\Delta'}{S_0}{T_0} &
2300323005
\forall j \in 1 .. n\!:\;\Subtype{\Delta'}{T_j}{S_j}\\
2300423006
\{\,\List{y}{n+1}{n+k_2}\,\} \subseteq \{\,\List{x}{n+1}{n+k_1}\,\}\\
@@ -23008,13 +23010,16 @@ \subsection{Subtypes}
2300823010
(r_{n+q} = \REQUIRED{} \Rightarrow r'_{n+p} = \REQUIRED)}{%
2300923011
\begin{array}{c}
2301023012
\Delta\vdash\RawFunctionTypeNamed{S_0}{X}{B}{s}{S}{n}{x}{k_1}{r}\;<:\;\\
23011-
\RawFunctionTypeNamed{T_0}{X}{B}{s}{T}{n}{y}{k_2}{r'}
23013+
\RawFunctionTypeNamed{T_0}{X}{B'\!}{s}{T}{n}{y}{k_2}{r'}
2301223014
\end{array}}
2301323015
%
2301423016
\ExtraVSP
2301523017
% ------------------------------------------------ Covariance
23018+
%% TODO(eernst): Type aliases have been expanded so there is no other
23019+
%% variance than covariance, but there will be in/out/inout in classes,
23020+
%% and then we'll need to handle variance here.
2301623021
\RuleRaw{\SrnCovariance}{%
23017-
\mbox{$C$ is an interface type with $s$ type parameters} &
23022+
\mbox{$C$ is an interface type with $s$ type parameters.} &
2301823023
\SubtypeStd{S_j}{T_j}\mbox{, for each $j \in 1..s$}}{%
2301923024
\code{$C$<\List{S}{1}{s}>}}{\code{$C$<\List{T}{1}{s}>}}
2302023025
\ExtraVSP
@@ -23181,7 +23186,8 @@ \subsubsection{Subtype Rules}
2318123186
In this specification we frequently refer to
2318223187
subtype relationships and assignability
2318323188
without mentioning the environment explicitly,
23184-
as in \Index{\SubtypeNE{S}{T}}.
23189+
as in
23190+
\IndexCustom{\SubtypeNE{S}{T}}{$<:$@\SubtypeNE{S}{T}}.
2318523191
This is only done when a specific location in code is in focus,
2318623192
and it means that the environment is that which is obtained
2318723193
by mapping each type variable in scope at that location
@@ -23215,7 +23221,7 @@ \subsubsection{Being a Subtype}
2321523221
A type $S$ is shown to be a \Index{subtype} of another type $T$
2321623222
in an environment $\Delta$ by providing
2321723223
an instantiation of a rule $R$ whose conclusion is
23218-
\IndexCustom{\SubtypeStd{S}{T}}{$\Delta$@\SubtypeStd{S}{T}},
23224+
\IndexCustom{\SubtypeStd{S}{T}}{$\Delta<:$@\SubtypeStd{S}{T}},
2321923225
along with rule instantiations showing
2322023226
each of the premises of $R$,
2322123227
continuing until a rule with no premises is reached.
@@ -23444,9 +23450,17 @@ \subsubsection{Additional Subtyping Concepts}
2344423450

2344523451
\LMHash{}%
2344623452
$S$ is a \Index{supertype} of $T$ in a given environment $\Delta$,
23447-
written \SupertypeStd{S}{T},
23453+
written
23454+
\IndexCustom{\SupertypeStd{S}{T}}{$\Delta:>$@\SupertypeStd{S}{T}},
2344823455
if{}f \SubtypeStd{T}{S}.
2344923456

23457+
\LMHash{}%
23458+
$S$ and $T$ are \Index{mutual subtypes} of each other
23459+
in a given environment $\Delta$,
23460+
written
23461+
\IndexCustom{\MutualSubtypeStd{S}{T}}{$\Delta<:>$@\MutualSubtypeStd{S}{T}},
23462+
if{}f both \SubtypeStd{T}{S} and \SubtypeStd{S}{T}.
23463+
2345023464
\LMHash{}%
2345123465
A type $T$
2345223466
\Index{may be assigned}
@@ -23604,7 +23618,8 @@ \subsection{Functions Dealing with Extreme Types}
2360423618
the first applicable case must be used.
2360523619

2360623620
\LMHash{}%
23607-
The \Index{\TopMergeTypeName} of two types computes
23621+
The \IndexCustom{\TopMergeTypeName}{topMergeType@\TopMergeTypeName}
23622+
of two types computes
2360823623
a canonical type which represents both of them,
2360923624
in the case where they are structurally identical
2361023625
modulo the choice among top types.
@@ -23669,7 +23684,8 @@ \subsection{Functions Dealing with Extreme Types}
2366923684
\commentary{The ordering of the arguments makes no difference.}
2367023685

2367123686
\LMHash{}%
23672-
The \Index{\IsTopTypeName} predicate is true for any type which is in
23687+
The \IndexCustom{\IsTopTypeName}{isTopType@\IsTopTypeName}
23688+
predicate is true for any type which is in
2367323689
the equivalence class of top types.
2367423690
It is a syntactic characterization of top types
2367523691
(\ref{superBoundedTypes}).
@@ -23683,8 +23699,9 @@ \subsection{Functions Dealing with Extreme Types}
2368323699
\end{itemize}
2368423700

2368523701
\noindent
23686-
The \Index{\IsObjectTypeName} predicate is true if{}f
23687-
the argument is a subtype and a supertype of \code{Object}.
23702+
The \IndexCustom{\IsObjectTypeName}{isObjectType@\IsObjectTypeName}
23703+
predicate is true if{}f the argument is
23704+
a subtype and a supertype of \code{Object}.
2368823705

2368923706
\begin{itemize}
2369023707
\item \DefEquals{\IsObjectType{Object}}{\metavar{true}}.
@@ -23693,8 +23710,8 @@ \subsection{Functions Dealing with Extreme Types}
2369323710
\end{itemize}
2369423711

2369523712
\noindent
23696-
The \Index{\IsBottomTypeName} predicate is true if{}f
23697-
the argument is a subtype of \code{Never}.
23713+
The \IndexCustom{\IsBottomTypeName}{isBottomType@\IsBottomTypeName}
23714+
predicate is true if{}f the argument is a subtype of \code{Never}.
2369823715

2369923716
\begin{itemize}
2370023717
\item \DefEquals{\IsBottomType{Never}}{\metavar{true}}.
@@ -23704,8 +23721,9 @@ \subsection{Functions Dealing with Extreme Types}
2370423721
\end{itemize}
2370523722

2370623723
\noindent
23707-
The \Index{\IsNullTypeName} predicate is true if{}f
23708-
the argument is a subtype and a supertype of \code{Null}.
23724+
The \IndexCustom{\IsNullTypeName}{isNullType@\IsNullTypeName}
23725+
predicate is true if{}f the argument is
23726+
a subtype and a supertype of \code{Null}.
2370923727

2371023728
\begin{itemize}
2371123729
\item \DefEquals{\IsNullType{Null}}{\metavar{true}}.
@@ -23714,8 +23732,8 @@ \subsection{Functions Dealing with Extreme Types}
2371423732
\end{itemize}
2371523733

2371623734
\noindent
23717-
The \Index{\IsMoreTopTypeName} predicate defines a total order on
23718-
top and \code{Object} types.
23735+
The \IndexCustom{\IsMoreTopTypeName}{isMoreTopType@\IsMoreTopTypeName}
23736+
predicate defines a total order on top and \code{Object} types.
2371923737

2372023738
\begin{itemize}
2372123739
\item \DefEquals{\IsMoreTopType{\VOID}{$T$}}{\metavar{true}}.
@@ -23732,8 +23750,8 @@ \subsection{Functions Dealing with Extreme Types}
2373223750
\end{itemize}
2373323751

2373423752
\noindent
23735-
The \Index{\IsMoreBottomTypeName} predicate defines an almost total order on
23736-
bottom and \code{Null} types.
23753+
The \IndexCustom{\IsMoreBottomTypeName}{isMoreBottomType@\IsMoreBottomTypeName}
23754+
predicate defines an almost total order on bottom and \code{Null} types.
2373723755
\commentary{%
2373823756
This does not consistently order
2373923757
two different type variables with the same bound.%
@@ -23812,7 +23830,9 @@ \subsection{Type Normalization}
2381223830
}
2381323831

2381423832
\LMHash{}%
23815-
The function \Index{\NormalizedTypeOfName} is then defined as follows:
23833+
The function
23834+
\IndexCustom{\NormalizedTypeOfName}{normalizedType@\NormalizedTypeOfName}
23835+
is then defined as follows:
2381623836
\BlindDefineSymbol{T_a, T_u, T_r}%
2381723837
Let $T_a$ be a type
2381823838
\commentary{(where `a' stands for `argument')}.

0 commit comments

Comments
 (0)