Skip to content

Commit 59ef6dd

Browse files
committed
Clarified tear-offs of methods with covariant parameters
1 parent 470dadb commit 59ef6dd

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

1542515429
\commentary{%
1542615430
This is concerned with the dynamic type of the function object obtained by
@@ -15433,12 +15437,15 @@ \subsubsection{Instance Method Closurization}
1543315437
}
1543415438

1543515439
\LMHash{}%
15436-
Otherwise, if $T$ is a non-generic class then for $j \in 1 .. n+k$,
15440+
Otherwise
15441+
(\commentary{when $p_j$ is not covariant}),
15442+
if $T$ is a non-generic class then for $j \in 1 .. n+k$,
1543715443
$T_j$ is a type annotation that denotes the same type
1543815444
(\ref{typeType})
1543915445
as that which is denoted by the type annotation on
1544015446
the corresponding parameter declaration in $D$.
15441-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15447+
If that parameter declaration has no type annotation
15448+
then $T_j$ is \code{Object?}.
1544215449

1544315450
\LMHash{}%
1544415451
Otherwise $T$ is a generic instantiation of a generic class $G$.
@@ -15447,7 +15454,8 @@ \subsubsection{Instance Method Closurization}
1544715454
Then $T_j$ is a type annotation that denotes
1544815455
$[t''_1/X''_1, \ldots, t''_{s''}/X''_{s''}]S_j$,
1544915456
where $S_j$ is the type annotation of the corresponding parameter in $D$.
15450-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15457+
If that parameter declaration has no type annotation
15458+
then $T_j$ is \code{Object?}.
1545115459

1545215460
\LMHash{}%
1545315461
There is one way in which
@@ -15576,7 +15584,11 @@ \subsubsection{Super Closurization}
1557615584
\LMHash{}%
1557715585
For each parameter $p_j$, $j \in 1 .. n+k$, if $p_j$ is covariant
1557815586
(\ref{covariantParameters})
15579-
then $T_j$ is \DYNAMIC.
15587+
then $T_j$ is \code{Object?}.
15588+
The corresponding actual argument in the body is replaced by
15589+
\code{$p_j$\,\,\AS\,\,$T'_j$}
15590+
where $T'_j$ is the type which would be $T_j$ if $p_j$ had not been covariant
15591+
(\commentary{that is, it is computed as specified below}).
1558015592

1558115593
\commentary{%
1558215594
This is concerned with the dynamic type of the function object obtained by
@@ -15589,12 +15601,15 @@ \subsubsection{Super Closurization}
1558915601
}
1559015602

1559115603
\LMHash{}%
15592-
Otherwise, if $S$ is a non-generic class then for $j \in 1 .. n+k$,
15604+
Otherwise
15605+
(\commentary{when $p_j$ is not covariant}),
15606+
if $S$ is a non-generic class then for $j \in 1 .. n+k$,
1559315607
$T_j$ is a type annotation that denotes the same type
1559415608
(\ref{typeType})
1559515609
as that which is denoted by the type annotation on
1559615610
the corresponding parameter declaration in $D$.
15597-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15611+
If that parameter declaration has no type annotation
15612+
then $T_j$ is \code{Object?}.
1559815613

1559915614
\LMHash{}%
1560015615
Otherwise $S$ is a generic instantiation of a generic class $G$.
@@ -15603,7 +15618,8 @@ \subsubsection{Super Closurization}
1560315618
Then $T_j$ is a type annotation that denotes
1560415619
$[t''_1/X''_1, \ldots, t''_{s''}/X''_{s''}]S_j$,
1560515620
where $S_j$ is the type annotation of the corresponding parameter in $D$.
15606-
If that parameter declaration has no type annotation then $T_j$ is \DYNAMIC.
15621+
If that parameter declaration has no type annotation
15622+
then $T_j$ is \code{Object?}.
1560715623

1560815624
\LMHash{}%
1560915625
There is one way in which

0 commit comments

Comments
 (0)