Skip to content

Commit 6e8b2a7

Browse files
committed
Clarified tear-offs of methods with covariant parameters
1 parent 62566d4 commit 6e8b2a7

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

1573915743
\commentary{%
1574015744
This is concerned with the dynamic type of the function object obtained by
@@ -15747,12 +15751,15 @@ \subsubsection{Instance Method Closurization}
1574715751
}
1574815752

1574915753
\LMHash{}%
15750-
Otherwise, if $T$ is a non-generic class then for $j \in 1 .. n+k$,
15754+
Otherwise
15755+
(\commentary{when $p_j$ is not covariant}),
15756+
if $T$ is a non-generic class then for $j \in 1 .. n+k$,
1575115757
$T_j$ is a type annotation that denotes the same type
1575215758
(\ref{typeType})
1575315759
as that which is denoted by the type annotation on
1575415760
the corresponding parameter declaration in $D$.
15755-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15761+
If that parameter declaration has no type annotation
15762+
then $T_j$ is \code{Object?}.
1575615763

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

1576615774
\LMHash{}%
1576715775
There is one way in which
@@ -15892,7 +15900,11 @@ \subsubsection{Super Closurization}
1589215900
\LMHash{}%
1589315901
For each parameter $p_j$, $j \in 1 .. n+k$, if $p_j$ is covariant
1589415902
(\ref{covariantParameters})
15895-
then $T_j$ is \DYNAMIC.
15903+
then $T_j$ is \code{Object?}.
15904+
The corresponding actual argument in the body is replaced by
15905+
\code{$p_j$\,\,\AS\,\,$T'_j$}
15906+
where $T'_j$ is the type which would be $T_j$ if $p_j$ had not been covariant
15907+
(\commentary{that is, it is computed as specified below}).
1589615908

1589715909
\commentary{%
1589815910
This is concerned with the dynamic type of the function object obtained by
@@ -15905,12 +15917,15 @@ \subsubsection{Super Closurization}
1590515917
}
1590615918

1590715919
\LMHash{}%
15908-
Otherwise, if $S$ is a non-generic class then for $j \in 1 .. n+k$,
15920+
Otherwise
15921+
(\commentary{when $p_j$ is not covariant}),
15922+
if $S$ is a non-generic class then for $j \in 1 .. n+k$,
1590915923
$T_j$ is a type annotation that denotes the same type
1591015924
(\ref{typeType})
1591115925
as that which is denoted by the type annotation on
1591215926
the corresponding parameter declaration in $D$.
15913-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15927+
If that parameter declaration has no type annotation
15928+
then $T_j$ is \code{Object?}.
1591415929

1591515930
\LMHash{}%
1591615931
Otherwise $S$ is a generic instantiation of a generic class $G$.
@@ -15919,7 +15934,8 @@ \subsubsection{Super Closurization}
1591915934
Then $T_j$ is a type annotation that denotes
1592015935
$[t''_1/X''_1, \ldots, t''_{s''}/X''_{s''}]S_j$,
1592115936
where $S_j$ is the type annotation of the corresponding parameter in $D$.
15922-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15937+
If that parameter declaration has no type annotation
15938+
then $T_j$ is \code{Object?}.
1592315939

1592415940
\LMHash{}%
1592515941
There is one way in which

0 commit comments

Comments
 (0)