diff options
-rw-r--r-- | src/actors-migration/scala/actors/migration/StashingActor.scala | 2 | ||||
-rw-r--r-- | src/actors/scala/actors/ActorRef.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Infer.scala | 15 | ||||
-rw-r--r-- | src/library/scala/StringContext.scala | 12 | ||||
-rw-r--r-- | src/library/scala/annotation/migration.scala | 2 | ||||
-rw-r--r-- | src/library/scala/collection/TraversableOnce.scala | 4 | ||||
-rw-r--r-- | src/library/scala/collection/immutable/BitSet.scala | 4 | ||||
-rw-r--r-- | src/library/scala/collection/immutable/RedBlack.scala | 2 | ||||
-rw-r--r-- | src/library/scala/collection/immutable/TreeMap.scala | 2 | ||||
-rw-r--r-- | src/library/scala/collection/immutable/TreeSet.scala | 2 | ||||
-rw-r--r-- | src/library/scala/testing/Show.scala | 2 | ||||
-rw-r--r-- | src/library/scala/util/Either.scala | 2 | ||||
-rwxr-xr-x | src/library/scala/xml/Elem.scala | 2 | ||||
-rwxr-xr-x | src/library/scala/xml/Utility.scala | 2 | ||||
-rw-r--r-- | test/files/neg/t5845.check | 5 | ||||
-rw-r--r-- | test/files/pos/t4881.scala | 31 | ||||
-rw-r--r-- | test/files/pos/t6311.scala | 5 |
18 files changed, 32 insertions, 66 deletions
diff --git a/src/actors-migration/scala/actors/migration/StashingActor.scala b/src/actors-migration/scala/actors/migration/StashingActor.scala index c628035891..12bad2ed1c 100644 --- a/src/actors-migration/scala/actors/migration/StashingActor.scala +++ b/src/actors-migration/scala/actors/migration/StashingActor.scala @@ -13,7 +13,7 @@ object StashingActor extends Combinators { } } -@deprecated("Scala Actors are being removed from the standard library. Please refer to the migration guide.", "2.10") +@deprecated("Scala Actors are being removed from the standard library. Please refer to the migration guide.", "2.10.0") trait StashingActor extends InternalActor { type Receive = PartialFunction[Any, Unit] diff --git a/src/actors/scala/actors/ActorRef.scala b/src/actors/scala/actors/ActorRef.scala index 5e0ca1554a..cca78b0832 100644 --- a/src/actors/scala/actors/ActorRef.scala +++ b/src/actors/scala/actors/ActorRef.scala @@ -8,7 +8,7 @@ import scala.concurrent.ExecutionContext.Implicits.global /** * Trait used for migration of Scala actors to Akka. */ -@deprecated("ActorRef ought to be used only with the Actor Migration Kit.") +@deprecated("ActorRef ought to be used only with the Actor Migration Kit.", "2.10.0") trait ActorRef { /** diff --git a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala index 86bf1f1efd..48624ec28f 100644 --- a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala +++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala @@ -861,7 +861,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { inTpl.members.find(_.sym == aSym) } - @deprecated("2.10", "Use findLinkTarget instead!") + @deprecated("Use `findLinkTarget` instead.", "2.10.0") def findTemplate(query: String): Option[DocTemplateImpl] = { assert(modelFinished) docTemplatesCache.values find { (tpl: DocTemplateImpl) => tpl.qualifiedName == query && !packageDropped(tpl) && !tpl.isObject } diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index 0c3dcb9342..cb5fc8df5a 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -517,7 +517,7 @@ trait Infer extends Checkable { val tvars = tparams map freshVar if (isConservativelyCompatible(restpe.instantiateTypeParams(tparams, tvars), pt)) map2(tparams, tvars)((tparam, tvar) => - instantiateToBound(tvar, inferVariance(formals, restpe)(tparam))) + instantiateToBound(tvar, varianceInTypes(formals)(tparam))) else tvars map (tvar => WildcardType) } @@ -647,24 +647,13 @@ trait Infer extends Checkable { "argument expression's type is not compatible with formal parameter type" + foundReqMsg(tp1, pt1)) } } - val targs = solvedTypes( - tvars, tparams, tparams map inferVariance(formals, restpe), + tvars, tparams, tparams map varianceInTypes(formals), false, lubDepth(formals) max lubDepth(argtpes) ) adjustTypeArgs(tparams, tvars, targs, restpe) } - /** Determine which variance to assume for the type paraneter. We first chose the variance - * that minimizes any formal parameters. If that is still undetermined, because the type parameter - * does not appear as a formal parameter type, then we pick the variance so that it minimizes the - * method's result type instead. - */ - private def inferVariance(formals: List[Type], restpe: Type)(tparam: Symbol): Int = { - val v = varianceInTypes(formals)(tparam) - if (v != VarianceFlags) v else varianceInType(restpe)(tparam) - } - private[typechecker] def followApply(tp: Type): Type = tp match { case NullaryMethodType(restp) => val restp1 = followApply(restp) diff --git a/src/library/scala/StringContext.scala b/src/library/scala/StringContext.scala index d9f41f6002..fb43d56020 100644 --- a/src/library/scala/StringContext.scala +++ b/src/library/scala/StringContext.scala @@ -8,7 +8,7 @@ package scala -/** This class provides the basic mechanism to do String Interpolation. +/** This class provides the basic mechanism to do String Interpolation. * String Interpolation allows users * to embed variable references directly in *processed* string literals. * Here's an example: @@ -26,7 +26,7 @@ package scala * is rewritten to be: * * {{{ - * new StringContext("Hello, ", "").s(name) + * StringContext("Hello, ", "").s(name) * }}} * * By default, this class provides the `raw`, `s` and `f` methods as @@ -36,7 +36,7 @@ package scala * which adds a method to `StringContext`. Here's an example: * {{{ * implicit class JsonHelper(val sc: StringContext) extends AnyVal { - * def json(args: Any*): JSONObject = ... + * def json(args: Any*): JSONObject = ... * } * val x: JSONObject = json"{ a: $a }" * }}} @@ -72,7 +72,7 @@ case class StringContext(parts: String*) { * println(s"Hello, $name") // Hello, James * }}} * In this example, the expression $name is replaced with the `toString` of the - * variable `name`. + * variable `name`. * The `s` interpolator can take the `toString` of any arbitrary expression within * a `${}` block, for example: * {{{ @@ -98,7 +98,7 @@ case class StringContext(parts: String*) { * For example, the raw processed string `raw"a\nb"` is equal to the scala string `"a\\nb"`. * * ''Note:'' Even when using the raw interpolator, Scala will preprocess unicode escapes. - * For example: + * For example: * {{{ * scala> raw"\u0123" * res0: String = ģ @@ -133,7 +133,7 @@ case class StringContext(parts: String*) { * that starts with a formatting specifier, the expression is formatted according to that * specifier. All specifiers allowed in Java format strings are handled, and in the same * way they are treated in Java. - * + * * For example: * {{{ * val height = 1.9d diff --git a/src/library/scala/annotation/migration.scala b/src/library/scala/annotation/migration.scala index f60c827620..a55c7006a1 100644 --- a/src/library/scala/annotation/migration.scala +++ b/src/library/scala/annotation/migration.scala @@ -25,6 +25,6 @@ package scala.annotation * @since 2.8 */ private[scala] final class migration(message: String, changedIn: String) extends scala.annotation.StaticAnnotation { - @deprecated("Use the constructor taking two Strings instead.", "2.10") + @deprecated("Use the constructor taking two Strings instead.", "2.10.0") def this(majorVersion: Int, minorVersion: Int, message: String) = this(message, majorVersion + "." + minorVersion) } diff --git a/src/library/scala/collection/TraversableOnce.scala b/src/library/scala/collection/TraversableOnce.scala index d77d278fca..f912304680 100644 --- a/src/library/scala/collection/TraversableOnce.scala +++ b/src/library/scala/collection/TraversableOnce.scala @@ -366,9 +366,9 @@ trait TraversableOnce[+A] extends Any with GenTraversableOnce[A] { object TraversableOnce { - @deprecated("use OnceCanBuildFrom instead") + @deprecated("use OnceCanBuildFrom instead", "2.10.0") def traversableOnceCanBuildFrom[T] = new OnceCanBuildFrom[T] - @deprecated("use MonadOps instead") + @deprecated("use MonadOps instead", "2.10.0") def wrapTraversableOnce[A](trav: TraversableOnce[A]) = new MonadOps(trav) implicit def alternateImplicit[A](trav: TraversableOnce[A]) = new ForceImplicitAmbiguity diff --git a/src/library/scala/collection/immutable/BitSet.scala b/src/library/scala/collection/immutable/BitSet.scala index 1b676e2d2f..d79e2adbda 100644 --- a/src/library/scala/collection/immutable/BitSet.scala +++ b/src/library/scala/collection/immutable/BitSet.scala @@ -31,7 +31,7 @@ abstract class BitSet extends scala.collection.AbstractSet[Int] with Serializable { override def empty = BitSet.empty - @deprecated("Use BitSet.fromBitMask[NoCopy] instead of fromArray", "2.10") + @deprecated("Use BitSet.fromBitMask[NoCopy] instead of fromArray", "2.10.0") def fromArray(elems: Array[Long]): BitSet = fromBitMaskNoCopy(elems) protected def fromBitMaskNoCopy(elems: Array[Long]): BitSet = BitSet.fromBitMaskNoCopy(elems) @@ -82,7 +82,7 @@ object BitSet extends BitSetFactory[BitSet] { implicit def canBuildFrom: CanBuildFrom[BitSet, Int, BitSet] = bitsetCanBuildFrom /** A bitset containing all the bits in an array */ - @deprecated("Use fromBitMask[NoCopy] instead of fromArray", "2.10") + @deprecated("Use fromBitMask[NoCopy] instead of fromArray", "2.10.0") def fromArray(elems: Array[Long]): BitSet = fromBitMaskNoCopy(elems) /** A bitset containing all the bits in an array */ diff --git a/src/library/scala/collection/immutable/RedBlack.scala b/src/library/scala/collection/immutable/RedBlack.scala index a3ab27f814..77e5a87e73 100644 --- a/src/library/scala/collection/immutable/RedBlack.scala +++ b/src/library/scala/collection/immutable/RedBlack.scala @@ -18,7 +18,7 @@ package immutable * * @since 2.3 */ -@deprecated("use `TreeMap` or `TreeSet` instead", "2.10") +@deprecated("use `TreeMap` or `TreeSet` instead", "2.10.0") @SerialVersionUID(8691885935445612921L) abstract class RedBlack[A] extends Serializable { diff --git a/src/library/scala/collection/immutable/TreeMap.scala b/src/library/scala/collection/immutable/TreeMap.scala index 51bc76efc3..f7a24f3d66 100644 --- a/src/library/scala/collection/immutable/TreeMap.scala +++ b/src/library/scala/collection/immutable/TreeMap.scala @@ -51,7 +51,7 @@ class TreeMap[A, +B] private (tree: RB.Tree[A, B])(implicit val ordering: Orderi with MapLike[A, B, TreeMap[A, B]] with Serializable { - @deprecated("use `ordering.lt` instead", "2.10") + @deprecated("use `ordering.lt` instead", "2.10.0") def isSmaller(x: A, y: A) = ordering.lt(x, y) override protected[this] def newBuilder : Builder[(A, B), TreeMap[A, B]] = diff --git a/src/library/scala/collection/immutable/TreeSet.scala b/src/library/scala/collection/immutable/TreeSet.scala index 697da2bc4b..0fdb16c23b 100644 --- a/src/library/scala/collection/immutable/TreeSet.scala +++ b/src/library/scala/collection/immutable/TreeSet.scala @@ -96,7 +96,7 @@ class TreeSet[A] private (tree: RB.Tree[A, Unit])(implicit val ordering: Orderin override def takeWhile(p: A => Boolean) = take(countWhile(p)) override def span(p: A => Boolean) = splitAt(countWhile(p)) - @deprecated("use `ordering.lt` instead", "2.10") + @deprecated("use `ordering.lt` instead", "2.10.0") def isSmaller(x: A, y: A) = compare(x,y) < 0 def this()(implicit ordering: Ordering[A]) = this(null)(ordering) diff --git a/src/library/scala/testing/Show.scala b/src/library/scala/testing/Show.scala index da1868c7f6..c6c58f5da2 100644 --- a/src/library/scala/testing/Show.scala +++ b/src/library/scala/testing/Show.scala @@ -37,7 +37,7 @@ trait Show { } } - @deprecated("use SymApply instead", "2.10") + @deprecated("use SymApply instead", "2.10.0") def symApply(sym: Symbol): SymApply = new SymApply(sym) /** Apply method with name of given symbol `f` to given arguments and return diff --git a/src/library/scala/util/Either.scala b/src/library/scala/util/Either.scala index f0253eee07..51342eda78 100644 --- a/src/library/scala/util/Either.scala +++ b/src/library/scala/util/Either.scala @@ -221,7 +221,7 @@ object Either { case Right(a) => a } } - @deprecated("use MergeableEither instead", "2.10") + @deprecated("use MergeableEither instead", "2.10.0") def either2mergeable[A](x: Either[A, A]): MergeableEither[A] = new MergeableEither(x) /** diff --git a/src/library/scala/xml/Elem.scala b/src/library/scala/xml/Elem.scala index 2ca1dbfcd0..a92d7859c3 100755 --- a/src/library/scala/xml/Elem.scala +++ b/src/library/scala/xml/Elem.scala @@ -59,7 +59,7 @@ class Elem( val child: Node*) extends Node with Serializable { - @deprecated("This constructor is retained for backward compatibility. Please use the primary constructor, which lets you specify your own preference for `minimizeEmpty`.", "2.10") + @deprecated("This constructor is retained for backward compatibility. Please use the primary constructor, which lets you specify your own preference for `minimizeEmpty`.", "2.10.0") def this(prefix: String, label: String, attributes: MetaData, scope: NamespaceBinding, child: Node*) = { this(prefix, label, attributes, scope, child.isEmpty, child: _*) } diff --git a/src/library/scala/xml/Utility.scala b/src/library/scala/xml/Utility.scala index 50a284d7cd..b390235d59 100755 --- a/src/library/scala/xml/Utility.scala +++ b/src/library/scala/xml/Utility.scala @@ -175,7 +175,7 @@ object Utility extends AnyRef with parsing.TokenTests { * Note that calling this source-compatible method will result in the same old, arguably almost universally unwanted, * behaviour. */ - @deprecated("Please use `serialize` instead and specify a `minimizeTags` parameter", "2.10") + @deprecated("Please use `serialize` instead and specify a `minimizeTags` parameter", "2.10.0") def toXML( x: Node, pscope: NamespaceBinding = TopScope, diff --git a/test/files/neg/t5845.check b/test/files/neg/t5845.check index c0b402fccb..8c6100d6de 100644 --- a/test/files/neg/t5845.check +++ b/test/files/neg/t5845.check @@ -1,4 +1,7 @@ +t5845.scala:9: error: value +++ is not a member of Int + println(5 +++ 5) + ^ t5845.scala:15: error: value +++ is not a member of Int println(5 +++ 5) ^ -one error found +two errors found diff --git a/test/files/pos/t4881.scala b/test/files/pos/t4881.scala deleted file mode 100644 index 46cfad9793..0000000000 --- a/test/files/pos/t4881.scala +++ /dev/null @@ -1,31 +0,0 @@ -class Contra[-T] -trait A -trait B extends A -trait C extends B - -// test improved variance inference: first try formals to see in which variance positions the type param appears; -// only when that fails to determine variance, look at result type -object Test { - def contraLBUB[a >: C <: A](): Contra[a] = null - def contraLB[a >: C](): Contra[a] = null - -{ - val x = contraLBUB() //inferred Contra[C] instead of Contra[A] - val x1: Contra[A] = x -} - -{ - val x = contraLB() //inferred Contra[C] instead of Contra[Any] - val x1: Contra[Any] = x -} - -{ - val x = contraLBUB // make sure it does the same thing as its ()-less counterpart - val x1: Contra[A] = x -} - -{ - val x = contraLB - val x1: Contra[Any] = x -} -} diff --git a/test/files/pos/t6311.scala b/test/files/pos/t6311.scala new file mode 100644 index 0000000000..d27ad2f502 --- /dev/null +++ b/test/files/pos/t6311.scala @@ -0,0 +1,5 @@ +class A { + def fooMinimal[T, Coll <: Traversable[T]](msg: String)(param1: Traversable[T])(param2: Coll): Traversable[T] = throw new Exception() + + fooMinimal("")(List(1))(List(2)) +} |