Skip to content

Commit 4682754

Browse files
committed
Clarified treatment of mixed programs
1 parent e8bdb87 commit 4682754

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

accepted/future-releases/variance/feature-specification.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,10 @@ When a legacy library _L_ imports a library _L2_ with sound variance, the
364364
declarations imported from _L2_ are _legacy erased_. This means that all
365365
variance modifiers in type parameter declarations are ignored.
366366

367-
In a mixed program (where both legacy libraries and libraries with sound
368-
variance exist), a dynamic type check is performed on the actual arguments
369-
for each instance method parameter whose declared type contains a
370-
contravariant type variable.
367+
*To maintain a sound heap in a mixed program execution (that is, when both
368+
legacy libraries and libraries with sound variance exist), it is then
369+
necessary to perform some type checks at run time. In particular, a
370+
dynamic type check is performed on method calls: The actual argument for
371+
each instance method parameter whose declared type contains a contravariant
372+
type variable. Moreover, a caller-side check is performed on each
373+
expression whose static type contains a contravariant type variable.*

0 commit comments

Comments
 (0)