Skip to content

Commit a93efce

Browse files
committed
Clarified tear-offs of methods with covariant parameters
1 parent 83fdf1e commit a93efce

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
@@ -15406,7 +15406,11 @@ \subsubsection{Instance Method Closurization}
1540615406
\LMHash{}%
1540715407
For each parameter $p_j$, $j \in 1 .. n+k$, if $p_j$ is covariant
1540815408
(\ref{covariantParameters})
15409-
then $T_j$ is \DYNAMIC. %% No user code will see this, avoid downcast in body.
15409+
then $T_j$ is \code{Object?}.
15410+
The corresponding actual argument in the body is replaced by
15411+
\code{$p_j$\,\,\AS\,\,$T'_j$}
15412+
where $T'_j$ is the type which would be $T_j$ if $p_j$ had not been covariant
15413+
(\commentary{that is, it is computed as specified below}).
1541015414

1541115415
\commentary{%
1541215416
This is concerned with the dynamic type of the function object obtained by
@@ -15419,12 +15423,15 @@ \subsubsection{Instance Method Closurization}
1541915423
}
1542015424

1542115425
\LMHash{}%
15422-
Otherwise, if $T$ is a non-generic class then for $j \in 1 .. n+k$,
15426+
Otherwise
15427+
(\commentary{when $p_j$ is not covariant}),
15428+
if $T$ is a non-generic class then for $j \in 1 .. n+k$,
1542315429
$T_j$ is a type annotation that denotes the same type
1542415430
(\ref{typeType})
1542515431
as that which is denoted by the type annotation on
1542615432
the corresponding parameter declaration in $D$.
15427-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15433+
If that parameter declaration has no type annotation
15434+
then $T_j$ is \code{Object?}.
1542815435

1542915436
\LMHash{}%
1543015437
Otherwise $T$ is a generic instantiation of a generic class $G$.
@@ -15433,7 +15440,8 @@ \subsubsection{Instance Method Closurization}
1543315440
Then $T_j$ is a type annotation that denotes
1543415441
$[t''_1/X''_1, \ldots, t''_{s''}/X''_{s''}]S_j$,
1543515442
where $S_j$ is the type annotation of the corresponding parameter in $D$.
15436-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15443+
If that parameter declaration has no type annotation
15444+
then $T_j$ is \code{Object?}.
1543715445

1543815446
\LMHash{}%
1543915447
There is one way in which
@@ -15562,7 +15570,11 @@ \subsubsection{Super Closurization}
1556215570
\LMHash{}%
1556315571
For each parameter $p_j$, $j \in 1 .. n+k$, if $p_j$ is covariant
1556415572
(\ref{covariantParameters})
15565-
then $T_j$ is \DYNAMIC.
15573+
then $T_j$ is \code{Object?}.
15574+
The corresponding actual argument in the body is replaced by
15575+
\code{$p_j$\,\,\AS\,\,$T'_j$}
15576+
where $T'_j$ is the type which would be $T_j$ if $p_j$ had not been covariant
15577+
(\commentary{that is, it is computed as specified below}).
1556615578

1556715579
\commentary{%
1556815580
This is concerned with the dynamic type of the function object obtained by
@@ -15575,12 +15587,15 @@ \subsubsection{Super Closurization}
1557515587
}
1557615588

1557715589
\LMHash{}%
15578-
Otherwise, if $S$ is a non-generic class then for $j \in 1 .. n+k$,
15590+
Otherwise
15591+
(\commentary{when $p_j$ is not covariant}),
15592+
if $S$ is a non-generic class then for $j \in 1 .. n+k$,
1557915593
$T_j$ is a type annotation that denotes the same type
1558015594
(\ref{typeType})
1558115595
as that which is denoted by the type annotation on
1558215596
the corresponding parameter declaration in $D$.
15583-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15597+
If that parameter declaration has no type annotation
15598+
then $T_j$ is \code{Object?}.
1558415599

1558515600
\LMHash{}%
1558615601
Otherwise $S$ is a generic instantiation of a generic class $G$.
@@ -15589,7 +15604,8 @@ \subsubsection{Super Closurization}
1558915604
Then $T_j$ is a type annotation that denotes
1559015605
$[t''_1/X''_1, \ldots, t''_{s''}/X''_{s''}]S_j$,
1559115606
where $S_j$ is the type annotation of the corresponding parameter in $D$.
15592-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15607+
If that parameter declaration has no type annotation
15608+
then $T_j$ is \code{Object?}.
1559315609

1559415610
\LMHash{}%
1559515611
There is one way in which

0 commit comments

Comments
 (0)