Skip to content

Commit a002cbe

Browse files
committed
Clarified tear-offs of methods with covariant parameters
1 parent 1118d55 commit a002cbe

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
@@ -15425,7 +15425,11 @@ \subsubsection{Instance Method Closurization}
1542515425
\LMHash{}%
1542615426
For each parameter $p_j$, $j \in 1 .. n+k$, if $p_j$ is covariant
1542715427
(\ref{covariantParameters})
15428-
then $T_j$ is \DYNAMIC. %% No user code will see this, avoid downcast in body.
15428+
then $T_j$ is \code{Object?}.
15429+
The corresponding actual argument in the body is replaced by
15430+
\code{$p_j$\,\,\AS\,\,$T'_j$}
15431+
where $T'_j$ is the type which would be $T_j$ if $p_j$ had not been covariant
15432+
(\commentary{that is, it is computed as specified below}).
1542915433

1543015434
\commentary{%
1543115435
This is concerned with the dynamic type of the function object obtained by
@@ -15438,12 +15442,15 @@ \subsubsection{Instance Method Closurization}
1543815442
}
1543915443

1544015444
\LMHash{}%
15441-
Otherwise, if $T$ is a non-generic class then for $j \in 1 .. n+k$,
15445+
Otherwise
15446+
(\commentary{when $p_j$ is not covariant}),
15447+
if $T$ is a non-generic class then for $j \in 1 .. n+k$,
1544215448
$T_j$ is a type annotation that denotes the same type
1544315449
(\ref{typeType})
1544415450
as that which is denoted by the type annotation on
1544515451
the corresponding parameter declaration in $D$.
15446-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15452+
If that parameter declaration has no type annotation
15453+
then $T_j$ is \code{Object?}.
1544715454

1544815455
\LMHash{}%
1544915456
Otherwise $T$ is a generic instantiation of a generic class $G$.
@@ -15452,7 +15459,8 @@ \subsubsection{Instance Method Closurization}
1545215459
Then $T_j$ is a type annotation that denotes
1545315460
$[t''_1/X''_1, \ldots, t''_{s''}/X''_{s''}]S_j$,
1545415461
where $S_j$ is the type annotation of the corresponding parameter in $D$.
15455-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15462+
If that parameter declaration has no type annotation
15463+
then $T_j$ is \code{Object?}.
1545615464

1545715465
\LMHash{}%
1545815466
There is one way in which
@@ -15581,7 +15589,11 @@ \subsubsection{Super Closurization}
1558115589
\LMHash{}%
1558215590
For each parameter $p_j$, $j \in 1 .. n+k$, if $p_j$ is covariant
1558315591
(\ref{covariantParameters})
15584-
then $T_j$ is \DYNAMIC.
15592+
then $T_j$ is \code{Object?}.
15593+
The corresponding actual argument in the body is replaced by
15594+
\code{$p_j$\,\,\AS\,\,$T'_j$}
15595+
where $T'_j$ is the type which would be $T_j$ if $p_j$ had not been covariant
15596+
(\commentary{that is, it is computed as specified below}).
1558515597

1558615598
\commentary{%
1558715599
This is concerned with the dynamic type of the function object obtained by
@@ -15594,12 +15606,15 @@ \subsubsection{Super Closurization}
1559415606
}
1559515607

1559615608
\LMHash{}%
15597-
Otherwise, if $S$ is a non-generic class then for $j \in 1 .. n+k$,
15609+
Otherwise
15610+
(\commentary{when $p_j$ is not covariant}),
15611+
if $S$ is a non-generic class then for $j \in 1 .. n+k$,
1559815612
$T_j$ is a type annotation that denotes the same type
1559915613
(\ref{typeType})
1560015614
as that which is denoted by the type annotation on
1560115615
the corresponding parameter declaration in $D$.
15602-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15616+
If that parameter declaration has no type annotation
15617+
then $T_j$ is \code{Object?}.
1560315618

1560415619
\LMHash{}%
1560515620
Otherwise $S$ is a generic instantiation of a generic class $G$.
@@ -15608,7 +15623,8 @@ \subsubsection{Super Closurization}
1560815623
Then $T_j$ is a type annotation that denotes
1560915624
$[t''_1/X''_1, \ldots, t''_{s''}/X''_{s''}]S_j$,
1561015625
where $S_j$ is the type annotation of the corresponding parameter in $D$.
15611-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15626+
If that parameter declaration has no type annotation
15627+
then $T_j$ is \code{Object?}.
1561215628

1561315629
\LMHash{}%
1561415630
There is one way in which

0 commit comments

Comments
 (0)