Skip to content

Commit b8b7c86

Browse files
committed
Clarified tear-offs of methods with covariant parameters
1 parent 84d503b commit b8b7c86

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

specification/dartLangSpec.tex

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15761,7 +15761,11 @@ \subsubsection{Instance Method Closurization}
1576115761
\LMHash{}%
1576215762
For each parameter $p_j$, $j \in 1 .. n+k$, if $p_j$ is covariant
1576315763
(\ref{covariantParameters})
15764-
then $T_j$ is \DYNAMIC. %% No user code will see this, avoid downcast in body.
15764+
then $T_j$ is \code{Object?}.
15765+
The corresponding actual argument in the body is replaced by
15766+
\code{$p_j$\,\,\AS\,\,$T'_j$}
15767+
where $T'_j$ is the type which would be $T_j$ if $p_j$ had not been covariant
15768+
(\commentary{that is, it is computed as specified below}).
1576515769

1576615770
\commentary{%
1576715771
This is concerned with the dynamic type of the function object obtained by
@@ -15774,12 +15778,15 @@ \subsubsection{Instance Method Closurization}
1577415778
}
1577515779

1577615780
\LMHash{}%
15777-
Otherwise, if $T$ is a non-generic class then for $j \in 1 .. n+k$,
15781+
Otherwise
15782+
(\commentary{when $p_j$ is not covariant}),
15783+
if $T$ is a non-generic class then for $j \in 1 .. n+k$,
1577815784
$T_j$ is a type annotation that denotes the same type
1577915785
(\ref{typeType})
1578015786
as that which is denoted by the type annotation on
1578115787
the corresponding parameter declaration in $D$.
15782-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15788+
If that parameter declaration has no type annotation
15789+
then $T_j$ is \code{Object?}.
1578315790

1578415791
\LMHash{}%
1578515792
Otherwise $T$ is a generic instantiation of a generic class $G$.
@@ -15788,7 +15795,8 @@ \subsubsection{Instance Method Closurization}
1578815795
Then $T_j$ is a type annotation that denotes
1578915796
$[t''_1/X''_1, \ldots, t''_{s''}/X''_{s''}]S_j$,
1579015797
where $S_j$ is the type annotation of the corresponding parameter in $D$.
15791-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15798+
If that parameter declaration has no type annotation
15799+
then $T_j$ is \code{Object?}.
1579215800

1579315801
\LMHash{}%
1579415802
There is one way in which
@@ -15919,7 +15927,11 @@ \subsubsection{Super Closurization}
1591915927
\LMHash{}%
1592015928
For each parameter $p_j$, $j \in 1 .. n+k$, if $p_j$ is covariant
1592115929
(\ref{covariantParameters})
15922-
then $T_j$ is \DYNAMIC.
15930+
then $T_j$ is \code{Object?}.
15931+
The corresponding actual argument in the body is replaced by
15932+
\code{$p_j$\,\,\AS\,\,$T'_j$}
15933+
where $T'_j$ is the type which would be $T_j$ if $p_j$ had not been covariant
15934+
(\commentary{that is, it is computed as specified below}).
1592315935

1592415936
\commentary{%
1592515937
This is concerned with the dynamic type of the function object obtained by
@@ -15932,12 +15944,15 @@ \subsubsection{Super Closurization}
1593215944
}
1593315945

1593415946
\LMHash{}%
15935-
Otherwise, if $S$ is a non-generic class then for $j \in 1 .. n+k$,
15947+
Otherwise
15948+
(\commentary{when $p_j$ is not covariant}),
15949+
if $S$ is a non-generic class then for $j \in 1 .. n+k$,
1593615950
$T_j$ is a type annotation that denotes the same type
1593715951
(\ref{typeType})
1593815952
as that which is denoted by the type annotation on
1593915953
the corresponding parameter declaration in $D$.
15940-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15954+
If that parameter declaration has no type annotation
15955+
then $T_j$ is \code{Object?}.
1594115956

1594215957
\LMHash{}%
1594315958
Otherwise $S$ is a generic instantiation of a generic class $G$.
@@ -15946,7 +15961,8 @@ \subsubsection{Super Closurization}
1594615961
Then $T_j$ is a type annotation that denotes
1594715962
$[t''_1/X''_1, \ldots, t''_{s''}/X''_{s''}]S_j$,
1594815963
where $S_j$ is the type annotation of the corresponding parameter in $D$.
15949-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15964+
If that parameter declaration has no type annotation
15965+
then $T_j$ is \code{Object?}.
1595015966

1595115967
\LMHash{}%
1595215968
There is one way in which

0 commit comments

Comments
 (0)