Skip to content

Commit 78f695d

Browse files
committed
Eliminated some Object Right rules, corrected covariance/extends; missing: function types
1 parent c76b6b5 commit 78f695d

File tree

1 file changed

+101
-61
lines changed

1 file changed

+101
-61
lines changed

specification/dartLangSpec.tex

Lines changed: 101 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -21888,29 +21888,27 @@ \subsection{Subtypes}
2188821888
\newcommand{\SrnRightTop}{2}
2188921889
\newcommand{\SrnLeftTop}{3}
2189021890
\newcommand{\SrnBottom}{4}
21891-
\newcommand{\SrnRightObjectOne}{5.1}
21892-
\newcommand{\SrnRightObjectTwo}{5.2}
21893-
\newcommand{\SrnRightObjectThree}{5.3}
21894-
\newcommand{\SrnRightObjectFour}{5.4}
21895-
\newcommand{\SrnNullOne}{6.1}
21896-
\newcommand{\SrnNullTwo}{6.2}
21897-
\newcommand{\SrnLeftFutureOr}{7}
21898-
\newcommand{\SrnLeftNullable}{7b}
21899-
\newcommand{\SrnTypeVariableReflexivityA}{8}
21900-
\newcommand{\SrnRightPromotedVariable}{9}
21901-
\newcommand{\SrnRightFutureOrA}{10}
21902-
\newcommand{\SrnRightFutureOrB}{11}
21903-
\newcommand{\SrnRightNullableOne}{11b.1}
21904-
\newcommand{\SrnRightNullableTwo}{11b.2}
21905-
\newcommand{\SrnRightNullableThree}{11b.3}
21906-
\newcommand{\SrnRightNullableFour}{11b.4}
21907-
\newcommand{\SrnLeftPromotedVariable}{12}
21908-
\newcommand{\SrnLeftVariableBound}{13}
21909-
\newcommand{\SrnRightFunction}{14}
21910-
\newcommand{\SrnPositionalFunctionType}{15}
21911-
\newcommand{\SrnNamedFunctionType}{16}
21912-
\newcommand{\SrnCovariance}{17}
21913-
\newcommand{\SrnSuperinterface}{18}
21891+
%\newcommand{\SrnRightObjectOne}{}
21892+
%\newcommand{\SrnRightObjectTwo}{}
21893+
%\newcommand{\SrnRightObjectThree}{}
21894+
\newcommand{\SrnRightObjectFour}{5}
21895+
\newcommand{\SrnNullOne}{6}
21896+
\newcommand{\SrnNullTwo}{7}
21897+
\newcommand{\SrnLeftFutureOr}{8}
21898+
\newcommand{\SrnLeftNullable}{9}
21899+
\newcommand{\SrnTypeVariableReflexivityA}{10}
21900+
\newcommand{\SrnRightPromotedVariable}{11}
21901+
\newcommand{\SrnRightFutureOrA}{12}
21902+
\newcommand{\SrnRightFutureOrB}{13}
21903+
\newcommand{\SrnRightNullableOne}{14}
21904+
\newcommand{\SrnRightNullableTwo}{15}
21905+
\newcommand{\SrnLeftPromotedVariable}{16}
21906+
\newcommand{\SrnLeftVariableBound}{17}
21907+
\newcommand{\SrnRightFunction}{18}
21908+
\newcommand{\SrnPositionalFunctionType}{19}
21909+
\newcommand{\SrnNamedFunctionType}{20}
21910+
\newcommand{\SrnCovariance}{21}
21911+
\newcommand{\SrnSuperinterface}{22}
2191421912

2191521913
\begin{figure}[p]
2191621914
\def\VSP{\vspace{4mm}}
@@ -21923,55 +21921,95 @@ \subsection{Subtypes}
2192321921
\centerline{\inference[#1]{#3}{\SubtypeStd{#4}{#5}}}\VSP}
2192421922
\def\RuleRawRaw#1#2#3#4{\centerline{\inference[#1]{#3}{#4}}\VSP}
2192521923
%
21924+
% ----------------------------------------------------------------------
21925+
% Omitted rules stated here, with justification for
21926+
% the omission.
21927+
% ------------------------------------------------ Right Object 1
21928+
% Not needed unless algorithmic: Instance of
21929+
% \SrnLeftVariableBound.
21930+
% \RuleRaw{\SrnRightObjectOne}{Right Object 1}{%
21931+
% \code{$X$\,\EXTENDS\,$B$} & \SubtypeStd{B}{\code{Object}}%
21932+
% }{X}{\code{Object}}
21933+
% ------------------------------------------------ Right Object 2
21934+
% Not needed unless algorithmic: Instance of
21935+
% \SrnLeftPromotedVariable.
21936+
% \RuleRaw{\SrnRightObjectTwo}{}{%
21937+
% \SubtypeStd{S}{\code{Object}}}{\code{$X$\,\&\,$S$}}{\code{Object}}
21938+
% ------------------------------------------------ Right Object 3
21939+
% Not needed unless algorithmic: Derivable from
21940+
% \SrnLeftFutureOr{} and \SrnRightObjectFour{} (to get
21941+
% Future<S> <: Object).
21942+
% \RuleRaw{\SrnRightObjectThree}{}{%
21943+
% \SubtypeStd{S}{\code{Object}}}{\code{FutureOr<$S$>}}{\code{Object}}
21944+
% ----------------------------------------------------------------------
2192621945
\begin{minipage}[c]{0.49\textwidth}
21927-
\Axiom{\SrnReflexivity}{Reflexivity}{T}{T}
21928-
\Axiom{\SrnBottom}{Left Bottom}{\code{Never}}{T}
21929-
\RuleRaw{\SrnRightObjectTwo}{Right Object 2}{%
21930-
\SubtypeStd{S}{\code{Object}}}{\code{$X$\,\&\,$S$}}{\code{Object}}
21931-
\RuleRaw{\SrnRightObjectThree}{Right Object 3}{%
21932-
\SubtypeStd{S}{\code{Object}}}{\code{FutureOr<$S$>}}{\code{Object}}
21933-
\Axiom{\SrnNullOne}{Left Null One}{\code{Null}}{\code{$T$?}}
21946+
% ------------------------------------------------ Reflexivity
21947+
\Axiom{\SrnReflexivity}{}{T}{T}
21948+
\ExtraVSP
21949+
% ------------------------------------------------ Left Top
21950+
% Non-algorithmic justification for this rule: Needed
21951+
% to prove dynamic/void <: FutureOr<Object>?.
21952+
\RuleRaw{\SrnLeftTop}{}{%
21953+
S \in \{\DYNAMIC, \VOID\}\\
21954+
\SubtypeStd{\code{Object?}}{T}}{S}{T}
21955+
% ------------------------------------------------ Left Bottom
21956+
\Axiom{\SrnBottom}{}{\code{Never}}{T}
21957+
% ------------------------------------------------ Left Null 1
21958+
\Axiom{\SrnNullOne}{}{\code{Null}}{\code{$T$?}}
2193421959
\end{minipage}
2193521960
\begin{minipage}[c]{0.49\textwidth}
21936-
\RuleRaw{\SrnRightTop}{Right Top}{%
21961+
% ------------------------------------------------ Right Top
21962+
\RuleRaw{\SrnRightTop}{}{%
2193721963
T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
21938-
\RuleRaw{\SrnLeftTop}{Left Top}{%
21939-
S \in \{\DYNAMIC, \VOID\} & \SubtypeStd{\code{Object?}}{T}}{S}{T}
21940-
\RuleRaw{\SrnRightObjectOne}{Right Object 1}{%
21941-
\code{$X$\,\EXTENDS\,$B$} & \SubtypeStd{B}{\code{Object}}%
21942-
}{X}{\code{Object}}
21943-
\RuleRaw{\SrnRightObjectFour}{Right Object 4}{%
21964+
% ------------------------------------------------ Right Object 4
21965+
\RuleRaw{\SrnRightObjectFour}{}{%
2194421966
$S$\,\not\in \{\code{Null}, \DYNAMIC, \VOID\}\\
21945-
\mbox{$S$ is not of the form \code{$U$?}, $X$, %
21946-
\code{$X$\,\&\,$U$}, \code{FutureOr<$U$>}}}{S}{\code{Object}}
21947-
\Rule{\SrnNullTwo}{Left Null Two}{\code{Null}}{T}{%
21967+
\mbox{$S$ is not of the form \code{$U$?}, $X$,}\\
21968+
\mbox{\code{$X$\,\&\,$U$}, %
21969+
or \code{FutureOr<$U$>}}}{S}{\code{Object}}
21970+
% ------------------------------------------------ Left Null 2
21971+
\Rule{\SrnNullTwo}{}{\code{Null}}{T}{%
2194821972
\code{Null}}{\code{FutureOr<$T$>}}
2194921973
\end{minipage}
2195021974

2195121975
\begin{minipage}[c]{0.49\textwidth}
21952-
\RuleTwo{\SrnLeftFutureOr}{Left FutureOr}{\code{Future<$S$>}}{T}{S}{T}{%
21976+
% ------------------------------------------------ Left FutureOr
21977+
\RuleTwo{\SrnLeftFutureOr}{}{%
21978+
\code{Future<$S$>}}{T}{S}{T}{%
2195321979
\code{FutureOr<$S$>}}{T}
21954-
\RuleTwo{\SrnRightPromotedVariable}{Right Promoted Variable}{S}{X}{S}{T}{
21980+
% ------------------------------------------------ Right Promoted Variable
21981+
\RuleTwo{\SrnRightPromotedVariable}{}{S}{X}{S}{T}{
2195521982
S}{X \& T}
21956-
\Rule{\SrnRightFutureOrB}{Right FutureOr B}{S}{T}{S}{\code{FutureOr<$T$>}}
21957-
\Rule{\SrnRightNullableTwo}{Right Nullable 2}{S}{\code{Null}}{S}{%
21983+
% ------------------------------------------------ Right FutureOr B
21984+
\Rule{\SrnRightFutureOrB}{}{S}{T}{S}{%
21985+
\code{FutureOr<$T$>}}
21986+
% ------------------------------------------------ Right Nullable 2
21987+
\Rule{\SrnRightNullableTwo}{}{S}{\code{Null}}{S}{%
2195821988
\code{$T$?}}
21959-
\Rule{\SrnLeftVariableBound}{Left Variable Bound}{\Gamma(X)}{T}{X}{T}
21989+
% ------------------------------------------------ Left Variable Bound
21990+
\Rule{\SrnLeftVariableBound}{}{\Gamma(X)}{T}{X}{T}
2196021991
\end{minipage}
2196121992
\begin{minipage}[c]{0.49\textwidth}
21962-
\RuleTwo{\SrnLeftNullable}{Left Nullable}{S}{T}{\code{Null}}{T}{
21993+
% ------------------------------------------------ Left Nullable
21994+
\RuleTwo{\SrnLeftNullable}{}{S}{T}{\code{Null}}{T}{
2196321995
\code{$S$?}}{T}
21964-
\Axiom{\SrnTypeVariableReflexivityA}{Left Promoted Variable A}{X \& S}{X}
21965-
\Rule{\SrnRightFutureOrA}{Right FutureOr A}{S}{\code{Future<$T$>}}{%
21966-
S}{\code{FutureOr<$T$>}}
21967-
\Rule{\SrnRightNullableOne}{Right Nullable 1}{S}{T}{S}{\code{$T$?}}
21968-
\Rule{\SrnLeftPromotedVariable}{Left Promoted Variable B}{S}{T}{X \& S}{T}
21969-
\RuleRaw{\SrnRightFunction}{Right Function}{T\mbox{ is a function type}}{
21970-
T}{\FUNCTION}
21996+
% ------------------------------------------------ Left Promoted Variable A
21997+
\Axiom{\SrnTypeVariableReflexivityA}{}{X \& S}{X}
21998+
% ------------------------------------------------ Right FutureOr A
21999+
\Rule{\SrnRightFutureOrA}{}{S}{%
22000+
\code{Future<$T$>}}{S}{\code{FutureOr<$T$>}}
22001+
% ------------------------------------------------ Right Nullable 1
22002+
\Rule{\SrnRightNullableOne}{}{S}{T}{S}{\code{$T$?}}
22003+
% ------------------------------------------------ Left Promoted Variable B
22004+
\Rule{\SrnLeftPromotedVariable}{}{S}{T}{X \& S}{T}
22005+
% ------------------------------------------------ Right Function
22006+
\RuleRaw{\SrnRightFunction}{}{%
22007+
T\mbox{ is a function type}}{T}{\FUNCTION}
2197122008
\end{minipage}
2197222009
%
2197322010
\ExtraVSP
21974-
\RuleRawRaw{\SrnPositionalFunctionType}{Positional Function Types}{%
22011+
% ------------------------------------------------ Positional Function Type
22012+
\RuleRawRaw{\SrnPositionalFunctionType}{}{%
2197522013
\Gamma' = \Gamma\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
2197622014
\Subtype{\Gamma'}{S_0}{T_0} \\
2197722015
n_1 \leq n_2 &
@@ -21982,7 +22020,8 @@ \subsection{Subtypes}
2198222020
\RawFunctionTypePositional{T_0}{X}{B}{s}{T}{n_2}{k_2}
2198322021
\end{array}}
2198422022
\ExtraVSP\ExtraVSP
21985-
\RuleRawRaw{\SrnNamedFunctionType}{Named Function Types}{
22023+
% ------------------------------------------------ Named Function Type
22024+
\RuleRawRaw{\SrnNamedFunctionType}{}{
2198622025
\Gamma' = \Gamma\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
2198722026
\Subtype{\Gamma'}{S_0}{T_0} &
2198822027
\forall j \in 1 .. n\!:\;\Subtype{\Gamma'}{T_j}{S_j} \\
@@ -21995,14 +22034,15 @@ \subsection{Subtypes}
2199522034
\end{array}}
2199622035
%
2199722036
\ExtraVSP
21998-
\RuleRaw{\SrnCovariance}{Covariance}{%
21999-
\code{\CLASS{} $C$<\TypeParametersNoBounds{X}{s}>\,\ldots\,\{\}} &
22000-
\forall j \in 1 .. s\!:\;\SubtypeStd{S_j}{T_j}}{%
22037+
% ------------------------------------------------ Covariance
22038+
\RuleRaw{\SrnCovariance}{}{%
22039+
\mbox{$C$ is an interface type with $s$ type parameters} &
22040+
\SubtypeStd{S_j}{T_j}\mbox{, for each $j \in 1..s$}}{%
2200122041
\code{$C$<\List{S}{1}{s}>}}{\code{$C$<\List{T}{1}{s}>}}
2200222042
\ExtraVSP
22003-
%% !!! Should include mixins (and other non-class interface types, if any).
22004-
\RuleRaw{\SrnSuperinterface}{Superinterface}{%
22005-
\code{\CLASS{} $C$<\TypeParametersNoBounds{X}{s}>\,\ldots\,\{\}}\\
22043+
% ------------------------------------------------ Superinterface
22044+
\RuleRaw{\SrnSuperinterface}{}{%
22045+
\mbox{$C$ is an interface type with type parameters \List{X}{1}{s}}\\
2200622046
\Superinterface{\code{$D$<\List{T}{1}{m}>}}{C} &
2200722047
\SubtypeStd{[S_1/X_1,\ldots,S_s/X_s]\code{$D$<\List{T}{1}{m}>}}{T}}{%
2200822048
\code{$C$<\List{S}{1}{s}>}\;}{\;T}

0 commit comments

Comments
 (0)