Skip to content

Commit 3a74a4b

Browse files
committed
Clarified tear-offs of methods with covariant parameters
1 parent 436bc09 commit 3a74a4b

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

specification/dartLangSpec.tex

+24-8
Original file line numberDiff line numberDiff line change
@@ -15244,7 +15244,11 @@ \subsubsection{Instance Method Closurization}
1524415244
\LMHash{}%
1524515245
For each parameter $p_j$, $j \in 1 .. n+k$, if $p_j$ is covariant
1524615246
(\ref{covariantParameters})
15247-
then $T_j$ is \DYNAMIC. %% No user code will see this, avoid downcast in body.
15247+
then $T_j$ is \code{Object?}.
15248+
The corresponding actual argument in the body is replaced by
15249+
\code{$p_j$\,\,\AS\,\,$T'_j$}
15250+
where $T'_j$ is the type which would be $T_j$ if $p_j$ had not been covariant
15251+
(\commentary{that is, it is computed as specified below}).
1524815252

1524915253
\commentary{%
1525015254
This is concerned with the dynamic type of the function object obtained by
@@ -15257,12 +15261,15 @@ \subsubsection{Instance Method Closurization}
1525715261
}
1525815262

1525915263
\LMHash{}%
15260-
Otherwise, if $T$ is a non-generic class then for $j \in 1 .. n+k$,
15264+
Otherwise
15265+
(\commentary{when $p_j$ is not covariant}),
15266+
if $T$ is a non-generic class then for $j \in 1 .. n+k$,
1526115267
$T_j$ is a type annotation that denotes the same type
1526215268
(\ref{typeType})
1526315269
as that which is denoted by the type annotation on
1526415270
the corresponding parameter declaration in $D$.
15265-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15271+
If that parameter declaration has no type annotation
15272+
then $T_j$ is \code{Object?}.
1526615273

1526715274
\LMHash{}%
1526815275
Otherwise $T$ is a generic instantiation of a generic class $G$.
@@ -15271,7 +15278,8 @@ \subsubsection{Instance Method Closurization}
1527115278
Then $T_j$ is a type annotation that denotes
1527215279
$[t''_1/X''_1, \ldots, t''_{s''}/X''_{s''}]S_j$,
1527315280
where $S_j$ is the type annotation of the corresponding parameter in $D$.
15274-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15281+
If that parameter declaration has no type annotation
15282+
then $T_j$ is \code{Object?}.
1527515283

1527615284
\LMHash{}%
1527715285
There is one way in which
@@ -15400,7 +15408,11 @@ \subsubsection{Super Closurization}
1540015408
\LMHash{}%
1540115409
For each parameter $p_j$, $j \in 1 .. n+k$, if $p_j$ is covariant
1540215410
(\ref{covariantParameters})
15403-
then $T_j$ is \DYNAMIC.
15411+
then $T_j$ is \code{Object?}.
15412+
The corresponding actual argument in the body is replaced by
15413+
\code{$p_j$\,\,\AS\,\,$T'_j$}
15414+
where $T'_j$ is the type which would be $T_j$ if $p_j$ had not been covariant
15415+
(\commentary{that is, it is computed as specified below}).
1540415416

1540515417
\commentary{%
1540615418
This is concerned with the dynamic type of the function object obtained by
@@ -15413,12 +15425,15 @@ \subsubsection{Super Closurization}
1541315425
}
1541415426

1541515427
\LMHash{}%
15416-
Otherwise, if $S$ is a non-generic class then for $j \in 1 .. n+k$,
15428+
Otherwise
15429+
(\commentary{when $p_j$ is not covariant}),
15430+
if $S$ is a non-generic class then for $j \in 1 .. n+k$,
1541715431
$T_j$ is a type annotation that denotes the same type
1541815432
(\ref{typeType})
1541915433
as that which is denoted by the type annotation on
1542015434
the corresponding parameter declaration in $D$.
15421-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15435+
If that parameter declaration has no type annotation
15436+
then $T_j$ is \code{Object?}.
1542215437

1542315438
\LMHash{}%
1542415439
Otherwise $S$ is a generic instantiation of a generic class $G$.
@@ -15427,7 +15442,8 @@ \subsubsection{Super Closurization}
1542715442
Then $T_j$ is a type annotation that denotes
1542815443
$[t''_1/X''_1, \ldots, t''_{s''}/X''_{s''}]S_j$,
1542915444
where $S_j$ is the type annotation of the corresponding parameter in $D$.
15430-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15445+
If that parameter declaration has no type annotation
15446+
then $T_j$ is \code{Object?}.
1543115447

1543215448
\LMHash{}%
1543315449
There is one way in which

0 commit comments

Comments
 (0)