Skip to content

Commit e26eddd

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

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

386389
% Judgment expressing that a supertype relation exists.
387390
\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
@@ -22235,18 +22235,20 @@ \subsection{Subtypes}
2223522235
% ------------------------------------------------ Positional Function Type
2223622236
\RuleRawRaw{\SrnPositionalFunctionType}{%
2223722237
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22238+
\forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
2223822239
\Subtype{\Delta'}{S_0}{T_0} \\
2223922240
n_1 \leq n_2 &
2224022241
n_1 + k_1 \geq n_2 + k_2 &
2224122242
\forall j \in 1 .. n_2 + k_2\!:\;\Subtype{\Delta'}{T_j}{S_j}}{%
2224222243
\begin{array}{c}
2224322244
\Delta\vdash\RawFunctionTypePositional{S_0}{X}{B}{s}{S}{n_1}{k_1}\;<:\;\\
22244-
\RawFunctionTypePositional{T_0}{X}{B}{s}{T}{n_2}{k_2}
22245+
\RawFunctionTypePositional{T_0}{X}{B'\!}{s}{T}{n_2}{k_2}
2224522246
\end{array}}
2224622247
\ExtraVSP\ExtraVSP
2224722248
% ------------------------------------------------ Named Function Type
2224822249
\RuleRawRaw{\SrnNamedFunctionType}{%
2224922250
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22251+
\forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
2225022252
\Subtype{\Delta'}{S_0}{T_0} &
2225122253
\forall j \in 1 .. n\!:\;\Subtype{\Delta'}{T_j}{S_j}\\
2225222254
\{\,\List{y}{n+1}{n+k_2}\,\} \subseteq \{\,\List{x}{n+1}{n+k_1}\,\}\\
@@ -22256,13 +22258,16 @@ \subsection{Subtypes}
2225622258
(r_{n+q} = \REQUIRED{} \Rightarrow r'_{n+p} = \REQUIRED)}{%
2225722259
\begin{array}{c}
2225822260
\Delta\vdash\RawFunctionTypeNamed{S_0}{X}{B}{s}{S}{n}{x}{k_1}{r}\;<:\;\\
22259-
\RawFunctionTypeNamed{T_0}{X}{B}{s}{T}{n}{y}{k_2}{r'}
22261+
\RawFunctionTypeNamed{T_0}{X}{B'\!}{s}{T}{n}{y}{k_2}{r'}
2226022262
\end{array}}
2226122263
%
2226222264
\ExtraVSP
2226322265
% ------------------------------------------------ Covariance
22266+
%% TODO(eernst): Type aliases have been expanded so there is no other
22267+
%% variance than covariance, but there will be in/out/inout in classes,
22268+
%% and then we'll need to handle variance here.
2226422269
\RuleRaw{\SrnCovariance}{%
22265-
\mbox{$C$ is an interface type with $s$ type parameters} &
22270+
\mbox{$C$ is an interface type with $s$ type parameters.} &
2226622271
\SubtypeStd{S_j}{T_j}\mbox{, for each $j \in 1..s$}}{%
2226722272
\code{$C$<\List{S}{1}{s}>}}{\code{$C$<\List{T}{1}{s}>}}
2226822273
\ExtraVSP
@@ -22427,7 +22432,8 @@ \subsubsection{Subtype Rules}
2242722432
In this specification we frequently refer to
2242822433
subtype relationships and assignability
2242922434
without mentioning the environment explicitly,
22430-
as in \Index{\SubtypeNE{S}{T}}.
22435+
as in
22436+
\IndexCustom{\SubtypeNE{S}{T}}{$<:$@\SubtypeNE{S}{T}}.
2243122437
This is only done when a specific location in code is in focus,
2243222438
and it means that the environment is that which is obtained
2243322439
by mapping each type variable in scope at that location
@@ -22461,7 +22467,7 @@ \subsubsection{Being a Subtype}
2246122467
A type $S$ is shown to be a \Index{subtype} of another type $T$
2246222468
in an environment $\Delta$ by providing
2246322469
an instantiation of a rule $R$ whose conclusion is
22464-
\IndexCustom{\SubtypeStd{S}{T}}{$\Delta$@\SubtypeStd{S}{T}},
22470+
\IndexCustom{\SubtypeStd{S}{T}}{$\Delta<:$@\SubtypeStd{S}{T}},
2246522471
along with rule instantiations showing
2246622472
each of the premises of $R$,
2246722473
continuing until a rule with no premises is reached.
@@ -22690,9 +22696,17 @@ \subsubsection{Additional Subtyping Concepts}
2269022696

2269122697
\LMHash{}%
2269222698
$S$ is a \Index{supertype} of $T$ in a given environment $\Delta$,
22693-
written \SupertypeStd{S}{T},
22699+
written
22700+
\IndexCustom{\SupertypeStd{S}{T}}{$\Delta:>$@\SupertypeStd{S}{T}},
2269422701
if{}f \SubtypeStd{T}{S}.
2269522702

22703+
\LMHash{}%
22704+
$S$ and $T$ are \Index{mutual subtypes} of each other
22705+
in a given environment $\Delta$,
22706+
written
22707+
\IndexCustom{\MutualSubtypeStd{S}{T}}{$\Delta<:>$@\MutualSubtypeStd{S}{T}},
22708+
if{}f both \SubtypeStd{T}{S} and \SubtypeStd{S}{T}.
22709+
2269622710
\LMHash{}%
2269722711
A type $T$
2269822712
\Index{may be assigned}
@@ -22850,7 +22864,8 @@ \subsection{Functions Dealing with Extreme Types}
2285022864
the first applicable case must be used.
2285122865

2285222866
\LMHash{}%
22853-
The \Index{\TopMergeTypeName} of two types computes
22867+
The \IndexCustom{\TopMergeTypeName}{topMergeType@\TopMergeTypeName}
22868+
of two types computes
2285422869
a canonical type which represents both of them,
2285522870
in the case where they are structurally identical
2285622871
modulo the choice among top types.
@@ -22915,7 +22930,8 @@ \subsection{Functions Dealing with Extreme Types}
2291522930
\commentary{The ordering of the arguments makes no difference.}
2291622931

2291722932
\LMHash{}%
22918-
The \Index{\IsTopTypeName} predicate is true for any type which is in
22933+
The \IndexCustom{\IsTopTypeName}{isTopType@\IsTopTypeName}
22934+
predicate is true for any type which is in
2291922935
the equivalence class of top types.
2292022936
It is a syntactic characterization of top types
2292122937
(\ref{superBoundedTypes}).
@@ -22929,8 +22945,9 @@ \subsection{Functions Dealing with Extreme Types}
2292922945
\end{itemize}
2293022946

2293122947
\noindent
22932-
The \Index{\IsObjectTypeName} predicate is true if{}f
22933-
the argument is a subtype and a supertype of \code{Object}.
22948+
The \IndexCustom{\IsObjectTypeName}{isObjectType@\IsObjectTypeName}
22949+
predicate is true if{}f the argument is
22950+
a subtype and a supertype of \code{Object}.
2293422951

2293522952
\begin{itemize}
2293622953
\item \DefEquals{\IsObjectType{Object}}{\metavar{true}}.
@@ -22939,8 +22956,8 @@ \subsection{Functions Dealing with Extreme Types}
2293922956
\end{itemize}
2294022957

2294122958
\noindent
22942-
The \Index{\IsBottomTypeName} predicate is true if{}f
22943-
the argument is a subtype of \code{Never}.
22959+
The \IndexCustom{\IsBottomTypeName}{isBottomType@\IsBottomTypeName}
22960+
predicate is true if{}f the argument is a subtype of \code{Never}.
2294422961

2294522962
\begin{itemize}
2294622963
\item \DefEquals{\IsBottomType{Never}}{\metavar{true}}.
@@ -22950,8 +22967,9 @@ \subsection{Functions Dealing with Extreme Types}
2295022967
\end{itemize}
2295122968

2295222969
\noindent
22953-
The \Index{\IsNullTypeName} predicate is true if{}f
22954-
the argument is a subtype and a supertype of \code{Null}.
22970+
The \IndexCustom{\IsNullTypeName}{isNullType@\IsNullTypeName}
22971+
predicate is true if{}f the argument is
22972+
a subtype and a supertype of \code{Null}.
2295522973

2295622974
\begin{itemize}
2295722975
\item \DefEquals{\IsNullType{Null}}{\metavar{true}}.
@@ -22960,8 +22978,8 @@ \subsection{Functions Dealing with Extreme Types}
2296022978
\end{itemize}
2296122979

2296222980
\noindent
22963-
The \Index{\IsMoreTopTypeName} predicate defines a total order on
22964-
top and \code{Object} types.
22981+
The \IndexCustom{\IsMoreTopTypeName}{isMoreTopType@\IsMoreTopTypeName}
22982+
predicate defines a total order on top and \code{Object} types.
2296522983

2296622984
\begin{itemize}
2296722985
\item \DefEquals{\IsMoreTopType{\VOID}{$T$}}{\metavar{true}}.
@@ -22978,8 +22996,8 @@ \subsection{Functions Dealing with Extreme Types}
2297822996
\end{itemize}
2297922997

2298022998
\noindent
22981-
The \Index{\IsMoreBottomTypeName} predicate defines an almost total order on
22982-
bottom and \code{Null} types.
22999+
The \IndexCustom{\IsMoreBottomTypeName}{isMoreBottomType@\IsMoreBottomTypeName}
23000+
predicate defines an almost total order on bottom and \code{Null} types.
2298323001
\commentary{%
2298423002
This does not consistently order
2298523003
two different type variables with the same bound.%
@@ -23058,7 +23076,9 @@ \subsection{Type Normalization}
2305823076
}
2305923077

2306023078
\LMHash{}%
23061-
The function \Index{\NormalizedTypeOfName} is then defined as follows:
23079+
The function
23080+
\IndexCustom{\NormalizedTypeOfName}{normalizedType@\NormalizedTypeOfName}
23081+
is then defined as follows:
2306223082
\BlindDefineSymbol{T_a, T_u, T_r}%
2306323083
Let $T_a$ be a type
2306423084
(\commentary{where `a' stands for `argument'}).

0 commit comments

Comments
 (0)