diff options
author | Paolo G. Giarrusso <p.giarrusso@gmail.com> | 2014-02-16 20:11:34 +0100 |
---|---|---|
committer | Paolo G. Giarrusso <p.giarrusso@gmail.com> | 2014-02-16 22:50:34 +0100 |
commit | f6c11c05ad6e87a3b697a6093ac59a37a8ac0870 (patch) | |
tree | c9f6ffad39b4f2017484bd8667e1e97381a397cc | |
parent | f59aeb58681d1dba8d32886de4785f6fb8dc9eff (diff) | |
download | scala-f6c11c05ad6e87a3b697a6093ac59a37a8ac0870.tar.gz scala-f6c11c05ad6e87a3b697a6093ac59a37a8ac0870.tar.bz2 scala-f6c11c05ad6e87a3b697a6093ac59a37a8ac0870.zip |
SI-6566, unsoundness with alias variance: document fix
Commit a419799f872d5aae99728d711b1ced89e06804a8 changed the behavior of
relativeVariance, but without updating the corresponding comment. Fix
that.
-rw-r--r-- | src/reflect/scala/reflect/internal/Variances.scala | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/reflect/scala/reflect/internal/Variances.scala b/src/reflect/scala/reflect/internal/Variances.scala index a7cac5254c..659bfb5d01 100644 --- a/src/reflect/scala/reflect/internal/Variances.scala +++ b/src/reflect/scala/reflect/internal/Variances.scala @@ -65,10 +65,11 @@ trait Variances { * The search proceeds from `base` to the owner of `tvar`. * Initially the state is covariant, but it might change along the search. * - * An alias which does not override anything is treated as Bivariant; + * A local alias type is treated as Bivariant; * this is OK because we always expand aliases for variance checking. - * However if it does override a type in a base class, we must assume Invariant - * because there may be references to the type parameter that are not checked. + * However, for an alias which might be externally visible, we must assume Invariant, + * because there may be references to the type parameter that are not checked, + * leading to unsoundness (see SI-6566). */ def relativeVariance(tvar: Symbol): Variance = { def nextVariance(sym: Symbol, v: Variance): Variance = ( |