diff options
Diffstat (limited to 'src')
8 files changed, 15 insertions, 13 deletions
diff --git a/src/library/scala/collection/TraversableLike.scala b/src/library/scala/collection/TraversableLike.scala index a55257d128..fdbc5e9857 100644 --- a/src/library/scala/collection/TraversableLike.scala +++ b/src/library/scala/collection/TraversableLike.scala @@ -77,7 +77,7 @@ trait TraversableLike[+A, +Repr] extends Any import Traversable.breaks._ /** The type implementing this traversable */ - protected type Self = Repr + protected[this] type Self = Repr /** The collection of type $coll underlying this `TraversableLike` object. * By default this is implemented as the `TraversableLike` object itself, diff --git a/src/library/scala/collection/generic/GenericClassTagCompanion.scala b/src/library/scala/collection/generic/GenericClassTagCompanion.scala index a587bbf544..76c12d118e 100644 --- a/src/library/scala/collection/generic/GenericClassTagCompanion.scala +++ b/src/library/scala/collection/generic/GenericClassTagCompanion.scala @@ -19,7 +19,7 @@ import scala.reflect.ClassTag * @author Aleksandar Prokopec */ abstract class GenericClassTagCompanion[+CC[X] <: Traversable[X]] { - type Coll = CC[_] + protected[this] type Coll = CC[_] def newBuilder[A](implicit ord: ClassTag[A]): Builder[A, CC[A]] diff --git a/src/library/scala/collection/generic/GenericCompanion.scala b/src/library/scala/collection/generic/GenericCompanion.scala index 5b03f8e5c6..b966ce51db 100644 --- a/src/library/scala/collection/generic/GenericCompanion.scala +++ b/src/library/scala/collection/generic/GenericCompanion.scala @@ -24,7 +24,7 @@ import scala.language.higherKinds */ abstract class GenericCompanion[+CC[X] <: GenTraversable[X]] { /** The underlying collection type with unknown element type */ - type Coll = CC[_] + protected[this] type Coll = CC[_] /** The default builder for `$Coll` objects. * @tparam A the type of the ${coll}'s elements diff --git a/src/library/scala/collection/generic/GenericOrderedCompanion.scala b/src/library/scala/collection/generic/GenericOrderedCompanion.scala index a9a50a1c35..094912c75a 100644 --- a/src/library/scala/collection/generic/GenericOrderedCompanion.scala +++ b/src/library/scala/collection/generic/GenericOrderedCompanion.scala @@ -19,7 +19,7 @@ import scala.language.higherKinds * @since 2.8 */ abstract class GenericOrderedCompanion[+CC[X] <: Traversable[X]] { - type Coll = CC[_] + protected[this] type Coll = CC[_] def newBuilder[A](implicit ord: Ordering[A]): Builder[A, CC[A]] diff --git a/src/library/scala/collection/immutable/TrieIterator.scala b/src/library/scala/collection/immutable/TrieIterator.scala index f117bddb8c..550f4cd7e0 100644 --- a/src/library/scala/collection/immutable/TrieIterator.scala +++ b/src/library/scala/collection/immutable/TrieIterator.scala @@ -46,7 +46,7 @@ private[collection] abstract class TrieIterator[+T](elems: Array[Iterable[T]]) e case x: HashSetCollision1[_] => x.ks.map(x => HashSet(x)).toArray }).asInstanceOf[Array[Iterable[T]]] - private type SplitIterators = ((Iterator[T], Int), Iterator[T]) + private[this] type SplitIterators = ((Iterator[T], Int), Iterator[T]) private def isTrie(x: AnyRef) = x match { case _: HashTrieMap[_,_] | _: HashTrieSet[_] => true diff --git a/src/library/scala/collection/parallel/ParSeqLike.scala b/src/library/scala/collection/parallel/ParSeqLike.scala index 201b624c72..874cf6fee9 100644 --- a/src/library/scala/collection/parallel/ParSeqLike.scala +++ b/src/library/scala/collection/parallel/ParSeqLike.scala @@ -44,8 +44,8 @@ trait ParSeqLike[+T, +Repr <: ParSeq[T], +Sequential <: Seq[T] with SeqLike[T, S extends scala.collection.GenSeqLike[T, Repr] with ParIterableLike[T, Repr, Sequential] { self => - - type SuperParIterator = IterableSplitter[T] + + protected[this] type SuperParIterator = IterableSplitter[T] /** A more refined version of the iterator found in the `ParallelIterable` trait, * this iterator can be split into arbitrary subsets of iterators. 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) diff --git a/src/reflect/scala/reflect/internal/Variances.scala b/src/reflect/scala/reflect/internal/Variances.scala index df0a502b30..739dd69992 100644 --- a/src/reflect/scala/reflect/internal/Variances.scala +++ b/src/reflect/scala/reflect/internal/Variances.scala @@ -73,9 +73,8 @@ trait Variances { def nextVariance(sym: Symbol, v: Variance): Variance = ( if (shouldFlip(sym, tvar)) v.flip else if (isLocalOnly(sym)) Bivariant - else if (!sym.isAliasType) v - else if (sym.isOverridingSymbol) Invariant - else Bivariant + else if (sym.isAliasType) Invariant + else v ) def loop(sym: Symbol, v: Variance): Variance = ( if (sym == tvar.owner || v.isBivariant) v @@ -145,12 +144,12 @@ trait Variances { || sym.owner.isCaseApplyOrUnapply ) tree match { + case defn: MemberDef if skip => + log(s"Skipping variance check of ${sym.defString}") case ClassDef(_, _, _, _) | TypeDef(_, _, _, _) => validateVariance(sym) super.traverse(tree) // ModuleDefs need not be considered because they have been eliminated already - case defn: ValOrDefDef if skip => - log(s"Skipping variance check of $sym") case ValDef(_, _, _, _) => validateVariance(sym) case DefDef(_, _, tparams, vparamss, _, _) => |