summaryrefslogtreecommitdiff
path: root/src/reflect/scala/reflect/internal/Symbols.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-01-02 07:09:21 -0800
committerPaul Phillips <paulp@improving.org>2013-01-09 12:11:15 -0800
commita419799f872d5aae99728d711b1ced89e06804a8 (patch)
tree572d18cb43f281939ccb2729f19e7096f5017508 /src/reflect/scala/reflect/internal/Symbols.scala
parent567df8ef284ab7491d6e144eb169db77d8ac06be (diff)
downloadscala-a419799f872d5aae99728d711b1ced89e06804a8.tar.gz
scala-a419799f872d5aae99728d711b1ced89e06804a8.tar.bz2
scala-a419799f872d5aae99728d711b1ced89e06804a8.zip
SI-6566, unsoundness with alias variance.
This wasn't as bad as it could have been. All these changes plug soundness holes in trunk. Mostly we're looking at type aliases which were merely protected when they had to be protected[this] not to allow unsound variance crossover.
Diffstat (limited to 'src/reflect/scala/reflect/internal/Symbols.scala')
-rw-r--r--src/reflect/scala/reflect/internal/Symbols.scala5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala
index e14c617f24..0127bd988b 100644
--- a/src/reflect/scala/reflect/internal/Symbols.scala
+++ b/src/reflect/scala/reflect/internal/Symbols.scala
@@ -900,7 +900,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
}
/** The variance of this symbol. */
- final def variance: Variance =
+ def variance: Variance =
if (isCovariant) Covariant
else if (isContravariant) Contravariant
else Invariant
@@ -2635,6 +2635,9 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
class AliasTypeSymbol protected[Symbols] (initOwner: Symbol, initPos: Position, initName: TypeName)
extends TypeSymbol(initOwner, initPos, initName) {
type TypeOfClonedSymbol = TypeSymbol
+ override def variance = if (hasLocalFlag) Bivariant else info.typeSymbol.variance
+ override def isContravariant = variance.isContravariant
+ override def isCovariant = variance.isCovariant
final override def isAliasType = true
override def cloneSymbolImpl(owner: Symbol, newFlags: Long): TypeSymbol =
owner.newNonClassSymbol(name, pos, newFlags)