Skip to content

Commit e0d10e1

Browse files
committed
Clarified tear-offs of methods with covariant parameters
1 parent a947c63 commit e0d10e1

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
@@ -15738,7 +15738,11 @@ \subsubsection{Instance Method Closurization}
1573815738
\LMHash{}%
1573915739
For each parameter $p_j$, $j \in 1 .. n+k$, if $p_j$ is covariant
1574015740
(\ref{covariantParameters})
15741-
then $T_j$ is \DYNAMIC. %% No user code will see this, avoid downcast in body.
15741+
then $T_j$ is \code{Object?}.
15742+
The corresponding actual argument in the body is replaced by
15743+
\code{$p_j$\,\,\AS\,\,$T'_j$}
15744+
where $T'_j$ is the type which would be $T_j$ if $p_j$ had not been covariant
15745+
(\commentary{that is, it is computed as specified below}).
1574215746

1574315747
\commentary{%
1574415748
This is concerned with the dynamic type of the function object obtained by
@@ -15751,12 +15755,15 @@ \subsubsection{Instance Method Closurization}
1575115755
}
1575215756

1575315757
\LMHash{}%
15754-
Otherwise, if $T$ is a non-generic class then for $j \in 1 .. n+k$,
15758+
Otherwise
15759+
(\commentary{when $p_j$ is not covariant}),
15760+
if $T$ is a non-generic class then for $j \in 1 .. n+k$,
1575515761
$T_j$ is a type annotation that denotes the same type
1575615762
(\ref{typeType})
1575715763
as that which is denoted by the type annotation on
1575815764
the corresponding parameter declaration in $D$.
15759-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15765+
If that parameter declaration has no type annotation
15766+
then $T_j$ is \code{Object?}.
1576015767

1576115768
\LMHash{}%
1576215769
Otherwise $T$ is a generic instantiation of a generic class $G$.
@@ -15765,7 +15772,8 @@ \subsubsection{Instance Method Closurization}
1576515772
Then $T_j$ is a type annotation that denotes
1576615773
$[t''_1/X''_1, \ldots, t''_{s''}/X''_{s''}]S_j$,
1576715774
where $S_j$ is the type annotation of the corresponding parameter in $D$.
15768-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15775+
If that parameter declaration has no type annotation
15776+
then $T_j$ is \code{Object?}.
1576915777

1577015778
\LMHash{}%
1577115779
There is one way in which
@@ -15896,7 +15904,11 @@ \subsubsection{Super Closurization}
1589615904
\LMHash{}%
1589715905
For each parameter $p_j$, $j \in 1 .. n+k$, if $p_j$ is covariant
1589815906
(\ref{covariantParameters})
15899-
then $T_j$ is \DYNAMIC.
15907+
then $T_j$ is \code{Object?}.
15908+
The corresponding actual argument in the body is replaced by
15909+
\code{$p_j$\,\,\AS\,\,$T'_j$}
15910+
where $T'_j$ is the type which would be $T_j$ if $p_j$ had not been covariant
15911+
(\commentary{that is, it is computed as specified below}).
1590015912

1590115913
\commentary{%
1590215914
This is concerned with the dynamic type of the function object obtained by
@@ -15909,12 +15921,15 @@ \subsubsection{Super Closurization}
1590915921
}
1591015922

1591115923
\LMHash{}%
15912-
Otherwise, if $S$ is a non-generic class then for $j \in 1 .. n+k$,
15924+
Otherwise
15925+
(\commentary{when $p_j$ is not covariant}),
15926+
if $S$ is a non-generic class then for $j \in 1 .. n+k$,
1591315927
$T_j$ is a type annotation that denotes the same type
1591415928
(\ref{typeType})
1591515929
as that which is denoted by the type annotation on
1591615930
the corresponding parameter declaration in $D$.
15917-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15931+
If that parameter declaration has no type annotation
15932+
then $T_j$ is \code{Object?}.
1591815933

1591915934
\LMHash{}%
1592015935
Otherwise $S$ is a generic instantiation of a generic class $G$.
@@ -15923,7 +15938,8 @@ \subsubsection{Super Closurization}
1592315938
Then $T_j$ is a type annotation that denotes
1592415939
$[t''_1/X''_1, \ldots, t''_{s''}/X''_{s''}]S_j$,
1592515940
where $S_j$ is the type annotation of the corresponding parameter in $D$.
15926-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15941+
If that parameter declaration has no type annotation
15942+
then $T_j$ is \code{Object?}.
1592715943

1592815944
\LMHash{}%
1592915945
There is one way in which

0 commit comments

Comments
 (0)