summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala6
-rw-r--r--src/compiler/scala/tools/nsc/transform/TailCalls.scala7
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/Logic.scala25
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala18
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/AnalyzerPlugins.scala18
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Macros.scala12
-rw-r--r--src/library/scala/Option.scala11
-rw-r--r--src/library/scala/StringContext.scala2
-rw-r--r--src/library/scala/collection/Searching.scala12
-rw-r--r--src/library/scala/collection/immutable/Stream.scala8
-rw-r--r--src/library/scala/reflect/ClassTag.scala48
-rw-r--r--src/library/scala/util/matching/Regex.scala10
-rwxr-xr-xsrc/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala12
-rw-r--r--test/files/jvm/deprecation.check2
-rw-r--r--test/files/jvm/future-spec.check2
-rw-r--r--test/files/jvm/interpreter.check4
-rw-r--r--test/files/jvm/serialization-new.check2
-rw-r--r--test/files/jvm/serialization.check2
-rw-r--r--test/files/neg/t5675.check2
-rw-r--r--test/files/neg/tailrec-4.check16
-rw-r--r--test/files/neg/tailrec-4.scala35
-rw-r--r--test/files/neg/virtpatmat_exhaust_compound.check15
-rw-r--r--test/files/neg/virtpatmat_exhaust_compound.flags1
-rw-r--r--test/files/neg/virtpatmat_exhaust_compound.scala29
-rw-r--r--test/files/run/collection-stacks.check2
-rw-r--r--test/files/run/colltest.check2
-rw-r--r--test/files/run/colltest1.scala2
-rw-r--r--test/files/run/compiler-asSeenFrom.scala2
-rw-r--r--test/files/run/constrained-types.check8
-rw-r--r--test/files/run/delambdafy_t6028.check2
-rw-r--r--test/files/run/delay-bad.check2
-rw-r--r--test/files/run/eta-expand-star2.check2
-rw-r--r--test/files/run/existentials-in-compiler.scala2
-rw-r--r--test/files/run/inferred-type-constructors.check2
-rw-r--r--test/files/run/is-valid-num.scala2
-rw-r--r--test/files/run/iterator-from.scala2
-rw-r--r--test/files/run/literals.check2
-rw-r--r--test/files/run/macro-rangepos-args.check1
-rw-r--r--test/files/run/macro-rangepos-args.flags1
-rw-r--r--test/files/run/macro-rangepos-args/Macros_1.scala10
-rw-r--r--test/files/run/macro-rangepos-args/Test_2.scala4
-rw-r--r--test/files/run/macroPlugins-isBlackbox/Macros_2.scala11
-rw-r--r--test/files/run/macroPlugins-isBlackbox/Plugin_1.scala21
-rw-r--r--test/files/run/macroPlugins-isBlackbox/Test_3.flags1
-rw-r--r--test/files/run/macroPlugins-isBlackbox/Test_3.scala3
-rw-r--r--test/files/run/macroPlugins-isBlackbox/scalac-plugin.xml4
-rw-r--r--test/files/run/mapConserve.scala2
-rw-r--r--test/files/run/names-defaults.check2
-rw-r--r--test/files/run/pc-conversions.scala2
-rw-r--r--test/files/run/reflection-java-annotations.check2
-rw-r--r--test/files/run/reflection-magicsymbols-repl.check2
-rw-r--r--test/files/run/repl-power.check4
-rw-r--r--test/files/run/richs.check2
-rw-r--r--test/files/run/search.check4
-rw-r--r--test/files/run/stringinterpolation_macro-run.scala2
-rw-r--r--test/files/run/synchronized.check2
-rw-r--r--test/files/run/t2212.check2
-rw-r--r--test/files/run/t3361.check2
-rw-r--r--test/files/run/t3888.check2
-rw-r--r--test/files/run/t3970.check2
-rw-r--r--test/files/run/t3996.check2
-rw-r--r--test/files/run/t4080.check2
-rw-r--r--test/files/run/t4172.check2
-rw-r--r--test/files/run/t4396.check2
-rw-r--r--test/files/run/t4461.check2
-rw-r--r--test/files/run/t4594-repl-settings.scala2
-rw-r--r--test/files/run/t4680.check2
-rw-r--r--test/files/run/t4710.check2
-rw-r--r--test/files/run/t4813.check2
-rw-r--r--test/files/run/t5428.check2
-rw-r--r--test/files/run/t576.check2
-rw-r--r--test/files/run/t5905-features.scala8
-rw-r--r--test/files/run/t6028.check2
-rw-r--r--test/files/run/t6111.check2
-rw-r--r--test/files/run/t6292.check2
-rw-r--r--test/files/run/t6318_primitives.check54
-rw-r--r--test/files/run/t6318_primitives.scala40
-rw-r--r--test/files/run/t6329_repl.check8
-rw-r--r--test/files/run/t6329_repl_bug.check2
-rw-r--r--test/files/run/t6329_vanilla_bug.check2
-rw-r--r--test/files/run/t6481.check2
-rw-r--r--test/files/run/t6690.check2
-rw-r--r--test/files/run/t6863.check2
-rw-r--r--test/files/run/t6935.check2
-rw-r--r--test/files/run/t7096.scala2
-rw-r--r--test/files/run/t7319.check6
-rw-r--r--test/files/run/t7582.check2
-rw-r--r--test/files/run/t7582b.check2
-rw-r--r--test/files/run/t7932.check2
-rw-r--r--test/files/run/t8196.check2
-rw-r--r--test/files/run/t8549.check2
-rw-r--r--test/files/run/t8611a.flags1
-rw-r--r--test/files/run/t8611a.scala16
-rw-r--r--test/files/run/t8611b.flags1
-rw-r--r--test/files/run/t8611b.scala54
-rw-r--r--test/files/run/t8611c.flags1
-rw-r--r--test/files/run/t8611c.scala21
-rw-r--r--test/files/run/tailcalls.check8
-rw-r--r--test/files/run/tailcalls.scala35
-rw-r--r--test/files/run/unittest_collection.check2
-rw-r--r--test/files/run/virtpatmat_typetag.check4
-rw-r--r--test/junit/scala/reflect/internal/TypesTest.scala35
-rw-r--r--test/scaladoc/run/t8672.check4
-rw-r--r--test/scaladoc/run/t8672.scala32
104 files changed, 643 insertions, 158 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 35eab94333..cb785de4b3 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -1169,8 +1169,10 @@ class Global(var currentSettings: Settings, var reporter: Reporter)
if (option) reporter.warning(pos, msg)
else if (!(warnings contains pos)) warnings += ((pos, msg))
def summarize() =
- if (warnings.nonEmpty && (option.isDefault || settings.fatalWarnings))
- warning("there were %d %s warning(s); re-run with %s for details".format(warnings.size, what, option.name))
+ if (warnings.nonEmpty && (option.isDefault || settings.fatalWarnings)){
+ val warningEvent = if (warnings.size > 1) s"were ${ warnings.size } $what warnings" else s"was one $what warning"
+ warning(s"there $warningEvent; re-run with ${ option.name } for details")
+ }
}
def newSourceFile(code: String, filename: String = "<console>") =
diff --git a/src/compiler/scala/tools/nsc/transform/TailCalls.scala b/src/compiler/scala/tools/nsc/transform/TailCalls.scala
index 714f189ead..d9d1192772 100644
--- a/src/compiler/scala/tools/nsc/transform/TailCalls.scala
+++ b/src/compiler/scala/tools/nsc/transform/TailCalls.scala
@@ -328,11 +328,14 @@ abstract class TailCalls extends Transform {
)
case CaseDef(pat, guard, body) =>
+ // CaseDefs are already translated and guards were moved into the body.
+ // If this was not the case, guards would have to be transformed here as well.
+ assert(guard.isEmpty)
deriveCaseDef(tree)(transform)
case If(cond, thenp, elsep) =>
treeCopy.If(tree,
- cond,
+ noTailTransform(cond),
transform(thenp),
transform(elsep)
)
@@ -363,7 +366,7 @@ abstract class TailCalls extends Transform {
rewriteApply(tapply, fun, targs, vargs)
case Apply(fun, args) if fun.symbol == Boolean_or || fun.symbol == Boolean_and =>
- treeCopy.Apply(tree, fun, transformTrees(args))
+ treeCopy.Apply(tree, noTailTransform(fun), transformTrees(args))
// this is to detect tailcalls in translated matches
// it's a one-argument call to a label that is in a tailposition and that looks like label(x) {x}
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala b/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala
index fde0aca584..0899507bab 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala
@@ -505,7 +505,7 @@ trait ScalaLogic extends Interface with Logic with TreeAndTypeAnalysis {
}
- import global.{ConstantType, Constant, SingletonType, Literal, Ident, singleType}
+ import global.{ConstantType, Constant, EmptyScope, SingletonType, Literal, Ident, refinedType, singleType, TypeBounds, NoSymbol}
import global.definitions._
@@ -538,23 +538,30 @@ trait ScalaLogic extends Interface with Logic with TreeAndTypeAnalysis {
private val trees = mutable.HashSet.empty[Tree]
// hashconsing trees (modulo value-equality)
- private[TreesAndTypesDomain] def uniqueTpForTree(t: Tree): Type =
- // a new type for every unstable symbol -- only stable value are uniqued
- // technically, an unreachable value may change between cases
- // thus, the failure of a case that matches on a mutable value does not exclude the next case succeeding
- // (and thuuuuus, the latter case must be considered reachable)
- if (!t.symbol.isStable) t.tpe.narrow
+ private[TreesAndTypesDomain] def uniqueTpForTree(t: Tree): Type = {
+ def freshExistentialSubtype(tp: Type): Type = {
+ // SI-8611 tp.narrow is tempting, but unsuitable. See `testRefinedTypeSI8611` for an explanation.
+ NoSymbol.freshExistential("").setInfo(TypeBounds.upper(tp)).tpe
+ }
+
+ if (!t.symbol.isStable) {
+ // Create a fresh type for each unstable value, since we can never correlate it to another value.
+ // For example `case X => case X =>` should not complaing about the second case being unreachable,
+ // if X is mutable.
+ freshExistentialSubtype(t.tpe)
+ }
else trees find (a => a.correspondsStructure(t)(sameValue)) match {
case Some(orig) =>
- debug.patmat("unique tp for tree: "+ ((orig, orig.tpe)))
+ debug.patmat("unique tp for tree: " + ((orig, orig.tpe)))
orig.tpe
case _ =>
// duplicate, don't mutate old tree (TODO: use a map tree -> type instead?)
- val treeWithNarrowedType = t.duplicate setType t.tpe.narrow
+ val treeWithNarrowedType = t.duplicate setType freshExistentialSubtype(t.tpe)
debug.patmat("uniqued: "+ ((t, t.tpe, treeWithNarrowedType.tpe)))
trees += treeWithNarrowedType
treeWithNarrowedType.tpe
}
+ }
}
sealed abstract class Const {
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala
index 894f959319..e1a663ea41 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala
@@ -104,11 +104,18 @@ trait TreeAndTypeAnalysis extends Debugging {
// TODO case _ if tp.isTupleType => // recurse into component types
case modSym: ModuleClassSymbol =>
Some(List(tp))
+ case sym: RefinementClassSymbol =>
+ val parentSubtypes: List[Option[List[Type]]] = tp.parents.map(parent => enumerateSubtypes(parent))
+ if (parentSubtypes exists (_.isDefined))
+ // If any of the parents is enumerable, then the refinement type is enumerable.
+ Some(
+ // We must only include subtypes of the parents that conform to `tp`.
+ // See neg/virtpatmat_exhaust_compound.scala for an example.
+ parentSubtypes flatMap (_.getOrElse(Nil)) filter (_ <:< tp)
+ )
+ else None
// make sure it's not a primitive, else (5: Byte) match { case 5 => ... } sees no Byte
- case sym if !sym.isSealed || isPrimitiveValueClass(sym) =>
- debug.patmat("enum unsealed "+ ((tp, sym, sym.isSealed, isPrimitiveValueClass(sym))))
- None
- case sym =>
+ case sym if sym.isSealed =>
val subclasses = debug.patmatResult(s"enum $sym sealed, subclasses")(
// symbols which are both sealed and abstract need not be covered themselves, because
// all of their children must be and they cannot otherwise be created.
@@ -136,6 +143,9 @@ trait TreeAndTypeAnalysis extends Debugging {
else None
}
})
+ case sym =>
+ debug.patmat("enum unsealed "+ ((tp, sym, sym.isSealed, isPrimitiveValueClass(sym))))
+ None
}
// approximate a type to the static type that is fully checkable at run time,
diff --git a/src/compiler/scala/tools/nsc/typechecker/AnalyzerPlugins.scala b/src/compiler/scala/tools/nsc/typechecker/AnalyzerPlugins.scala
index fa6e5399eb..5a70d4c524 100644
--- a/src/compiler/scala/tools/nsc/typechecker/AnalyzerPlugins.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/AnalyzerPlugins.scala
@@ -190,6 +190,16 @@ trait AnalyzerPlugins { self: Analyzer =>
def pluginsTypedMacroBody(typer: Typer, ddef: DefDef): Option[Tree] = None
/**
+ * Figures out whether the given macro definition is blackbox or whitebox.
+ *
+ * Default implementation provided in `self.standardIsBlackbox` loads the macro impl binding
+ * and fetches boxity from the "isBlackbox" field of the macro signature.
+ *
+ * $nonCumulativeReturnValueDoc.
+ */
+ def pluginsIsBlackbox(macroDef: Symbol): Option[Boolean] = None
+
+ /**
* Expands an application of a def macro (i.e. of a symbol that has the MACRO flag set),
* possibly using the current typer mode and the provided prototype.
*
@@ -375,6 +385,14 @@ trait AnalyzerPlugins { self: Analyzer =>
def custom(plugin: MacroPlugin) = plugin.pluginsTypedMacroBody(typer, ddef)
})
+ /** @see MacroPlugin.pluginsIsBlackbox */
+ def pluginsIsBlackbox(macroDef: Symbol): Boolean = invoke(new NonCumulativeOp[Boolean] {
+ def position = macroDef.pos
+ def description = "compute boxity for this macro definition"
+ def default = standardIsBlackbox(macroDef)
+ def custom(plugin: MacroPlugin) = plugin.pluginsIsBlackbox(macroDef)
+ })
+
/** @see MacroPlugin.pluginsMacroExpand */
def pluginsMacroExpand(typer: Typer, expandee: Tree, mode: Mode, pt: Type): Tree = invoke(new NonCumulativeOp[Tree] {
def position = expandee.pos
diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
index f4456998c0..ef74beec62 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
@@ -263,7 +263,12 @@ trait Macros extends MacroRuntimes with Traces with Helpers {
}
def isBlackbox(expandee: Tree): Boolean = isBlackbox(dissectApplied(expandee).core.symbol)
- def isBlackbox(macroDef: Symbol): Boolean = {
+ def isBlackbox(macroDef: Symbol): Boolean = pluginsIsBlackbox(macroDef)
+
+ /** Default implementation of `isBlackbox`.
+ * Can be overridden by analyzer plugins (see AnalyzerPlugins.pluginsIsBlackbox for more details)
+ */
+ def standardIsBlackbox(macroDef: Symbol): Boolean = {
val fastTrackBoxity = fastTrack.get(macroDef).map(_.isBlackbox)
val bindingBoxity = loadMacroImplBinding(macroDef).map(_.isBlackbox)
fastTrackBoxity orElse bindingBoxity getOrElse false
@@ -417,9 +422,10 @@ trait Macros extends MacroRuntimes with Traces with Helpers {
val wrappedArgs = mapWithIndex(args)((arg, j) => {
val fingerprint = implParams(min(j, implParams.length - 1))
+ val duplicatedArg = duplicateAndKeepPositions(arg)
fingerprint match {
- case LiftedTyped => context.Expr[Nothing](arg.duplicate)(TypeTag.Nothing) // TODO: SI-5752
- case LiftedUntyped => arg.duplicate
+ case LiftedTyped => context.Expr[Nothing](duplicatedArg)(TypeTag.Nothing) // TODO: SI-5752
+ case LiftedUntyped => duplicatedArg
case _ => abort(s"unexpected fingerprint $fingerprint in $binding with paramss being $paramss " +
s"corresponding to arg $arg in $argss")
}
diff --git a/src/library/scala/Option.scala b/src/library/scala/Option.scala
index 905e925f57..5a1c832fae 100644
--- a/src/library/scala/Option.scala
+++ b/src/library/scala/Option.scala
@@ -251,6 +251,17 @@ sealed abstract class Option[+A] extends Product with Serializable {
* nonempty '''and''' `pf` is defined for that value.
* Returns $none otherwise.
*
+ * @example {{{
+ * // Returns Some(HTTP) because the partial function covers the case.
+ * Some("http").collect({case "http" => "HTTP"})
+ *
+ * // Returns None because the partial function doesn't cover the case.
+ * Some("ftp").collect({case "http" => "HTTP"})
+ *
+ * // Returns None because None is passed to the collect method.
+ * None.collect({case value => value})
+ * }}}
+ *
* @param pf the partial function.
* @return the result of applying `pf` to this $option's
* value (if possible), or $none.
diff --git a/src/library/scala/StringContext.scala b/src/library/scala/StringContext.scala
index c0468e8b02..c9e632c70e 100644
--- a/src/library/scala/StringContext.scala
+++ b/src/library/scala/StringContext.scala
@@ -38,7 +38,7 @@ import scala.annotation.tailrec
* To provide your own string interpolator, create an implicit class
* which adds a method to `StringContext`. Here's an example:
* {{{
- * implicit class JsonHelper(val sc: StringContext) extends AnyVal {
+ * implicit class JsonHelper(private val sc: StringContext) extends AnyVal {
* def json(args: Any*): JSONObject = ...
* }
* val x: JSONObject = json"{ a: $a }"
diff --git a/src/library/scala/collection/Searching.scala b/src/library/scala/collection/Searching.scala
index fec4bbf502..b68124b3f8 100644
--- a/src/library/scala/collection/Searching.scala
+++ b/src/library/scala/collection/Searching.scala
@@ -54,7 +54,7 @@ object Searching {
*/
final def search[B >: A](elem: B)(implicit ord: Ordering[B]): SearchResult =
coll match {
- case _: IndexedSeq[A] => binarySearch(elem, -1, coll.length)(ord)
+ case _: IndexedSeq[A] => binarySearch(elem, 0, coll.length)(ord)
case _ => linearSearch(coll.view, elem, 0)(ord)
}
@@ -81,18 +81,18 @@ object Searching {
final def search[B >: A](elem: B, from: Int, to: Int)
(implicit ord: Ordering[B]): SearchResult =
coll match {
- case _: IndexedSeq[A] => binarySearch(elem, from-1, to)(ord)
+ case _: IndexedSeq[A] => binarySearch(elem, from, to)(ord)
case _ => linearSearch(coll.view(from, to), elem, from)(ord)
}
@tailrec
private def binarySearch[B >: A](elem: B, from: Int, to: Int)
(implicit ord: Ordering[B]): SearchResult = {
- if ((to-from) == 1) InsertionPoint(from) else {
- val idx = from+(to-from)/2
+ if (to == from) InsertionPoint(from) else {
+ val idx = from+(to-from-1)/2
math.signum(ord.compare(elem, coll(idx))) match {
case -1 => binarySearch(elem, from, idx)(ord)
- case 1 => binarySearch(elem, idx, to)(ord)
+ case 1 => binarySearch(elem, idx + 1, to)(ord)
case _ => Found(idx)
}
}
@@ -105,7 +105,7 @@ object Searching {
while (it.hasNext) {
val cur = it.next()
if (ord.equiv(elem, cur)) return Found(idx)
- else if (ord.lt(elem, cur)) return InsertionPoint(idx-1)
+ else if (ord.lt(elem, cur)) return InsertionPoint(idx)
idx += 1
}
InsertionPoint(idx)
diff --git a/src/library/scala/collection/immutable/Stream.scala b/src/library/scala/collection/immutable/Stream.scala
index 60de147477..d3ff5e8abf 100644
--- a/src/library/scala/collection/immutable/Stream.scala
+++ b/src/library/scala/collection/immutable/Stream.scala
@@ -97,6 +97,14 @@ import scala.language.implicitConversions
* If, on the other hand, there is nothing holding on to the head (e.g. we used
* `def` to define the `Stream`) then once it is no longer being used directly,
* it disappears.
+ *
+ * - Note that some operations, including [[drop]], [[dropWhile]],
+ * [[flatMap]] or [[collect]] may process a large number of intermediate
+ * elements before returning. These necessarily hold onto the head, since
+ * they are methods on `Stream`, and a stream holds its own head. For
+ * computations of this sort where memoization is not desired, use
+ * `Iterator` when possible.
+ *
* {{{
* // For example, let's build the natural numbers and do some silly iteration
* // over them.
diff --git a/src/library/scala/reflect/ClassTag.scala b/src/library/scala/reflect/ClassTag.scala
index 33c5cee783..bced505273 100644
--- a/src/library/scala/reflect/ClassTag.scala
+++ b/src/library/scala/reflect/ClassTag.scala
@@ -70,26 +70,36 @@ trait ClassTag[T] extends ClassManifestDeprecatedApis[T] with Equals with Serial
* `SomeExtractor(...)` is turned into `ct(SomeExtractor(...))` if `T` in `SomeExtractor.unapply(x: T)`
* is uncheckable, but we have an instance of `ClassTag[T]`.
*/
- def unapply(x: Any): Option[T] = unapply_impl(x)
- def unapply(x: Byte): Option[T] = unapply_impl(x)
- def unapply(x: Short): Option[T] = unapply_impl(x)
- def unapply(x: Char): Option[T] = unapply_impl(x)
- def unapply(x: Int): Option[T] = unapply_impl(x)
- def unapply(x: Long): Option[T] = unapply_impl(x)
- def unapply(x: Float): Option[T] = unapply_impl(x)
- def unapply(x: Double): Option[T] = unapply_impl(x)
- def unapply(x: Boolean): Option[T] = unapply_impl(x)
- def unapply(x: Unit): Option[T] = unapply_impl(x)
+ def unapply(x: Any): Option[T] = x match {
+ case null => None
+ case b: Byte => unapply(b)
+ case s: Short => unapply(s)
+ case c: Char => unapply(c)
+ case i: Int => unapply(i)
+ case l: Long => unapply(l)
+ case f: Float => unapply(f)
+ case d: Double => unapply(d)
+ case b: Boolean => unapply(b)
+ case u: Unit => unapply(u)
+ case a: Any => unapplyImpl(a)
+ }
- private def unapply_impl[U: ClassTag](x: U): Option[T] =
- if (x == null) None
- else {
- val staticClass = classTag[U].runtimeClass
- val dynamicClass = x.getClass
- val effectiveClass = if (staticClass.isPrimitive) staticClass else dynamicClass
- val conforms = runtimeClass.isAssignableFrom(effectiveClass)
- if (conforms) Some(x.asInstanceOf[T]) else None
- }
+ // TODO: Inline the bodies of these into the Any-accepting unapply overload above and delete them.
+ // This cannot be done until at least 2.12.0 for reasons of binary compatibility
+ def unapply(x: Byte) : Option[T] = unapplyImpl(x, classOf[Byte])
+ def unapply(x: Short) : Option[T] = unapplyImpl(x, classOf[Short])
+ def unapply(x: Char) : Option[T] = unapplyImpl(x, classOf[Char])
+ def unapply(x: Int) : Option[T] = unapplyImpl(x, classOf[Int])
+ def unapply(x: Long) : Option[T] = unapplyImpl(x, classOf[Long])
+ def unapply(x: Float) : Option[T] = unapplyImpl(x, classOf[Float])
+ def unapply(x: Double) : Option[T] = unapplyImpl(x, classOf[Double])
+ def unapply(x: Boolean) : Option[T] = unapplyImpl(x, classOf[Boolean])
+ def unapply(x: Unit) : Option[T] = unapplyImpl(x, classOf[Unit])
+
+ private[this] def unapplyImpl(x: Any, alternative: jClass[_] = null): Option[T] = {
+ val conforms = runtimeClass.isAssignableFrom(x.getClass) || (alternative != null && runtimeClass.isAssignableFrom(alternative))
+ if (conforms) Some(x.asInstanceOf[T]) else None
+ }
// case class accessories
override def canEqual(x: Any) = x.isInstanceOf[ClassTag[_]]
diff --git a/src/library/scala/util/matching/Regex.scala b/src/library/scala/util/matching/Regex.scala
index 6743b9e42a..f35ea566ba 100644
--- a/src/library/scala/util/matching/Regex.scala
+++ b/src/library/scala/util/matching/Regex.scala
@@ -274,12 +274,18 @@ class Regex private[matching](val pattern: Pattern, groupNames: String*) extends
// @see UnanchoredRegex
protected def runMatcher(m: Matcher) = m.matches()
- /** Return all matches of this regexp in given character sequence as a [[scala.util.matching.Regex.MatchIterator]],
+ /** Return all non-overlapping matches of this regexp in given character
+ * sequence as a [[scala.util.matching.Regex.MatchIterator]],
* which is a special [[scala.collection.Iterator]] that returns the
* matched strings, but can also be converted into a normal iterator
* that returns objects of type [[scala.util.matching.Regex.Match]]
* that can be queried for data such as the text that precedes the
* match, subgroups, etc.
+ *
+ * Where potential matches overlap, the first possible match is returned,
+ * followed by the next match that is completely after the first. For
+ * instance, `"hat[^a]+".r` will match `hath` and `hattth` in the string
+ * `"hathatthattthatttt"`.
*
* Attempting to retrieve information about a match before initializing
* the iterator can result in [[java.lang.IllegalStateException]]s. See
@@ -292,7 +298,7 @@ class Regex private[matching](val pattern: Pattern, groupNames: String*) extends
def findAllIn(source: CharSequence) = new Regex.MatchIterator(source, this, groupNames)
- /** Return all matches of this regexp in given character sequence as a
+ /** Return all non-overlapping matches of this regexp in given character sequence as a
* [[scala.collection.Iterator]] of [[scala.util.matching.Regex.Match]].
*
* @param source The text to match against.
diff --git a/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala b/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala
index a933c35c99..19cc27b40b 100755
--- a/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala
@@ -666,7 +666,7 @@ trait CommentFactoryBase { this: MemberLookupBase =>
}
def summary(): Inline = {
- val i = inline(check("."))
+ val i = inline(checkSentenceEnded())
Summary(
if (jump("."))
Chain(List(i, Text(".")))
@@ -785,6 +785,16 @@ trait CommentFactoryBase { this: MemberLookupBase =>
})
}
+ def checkSentenceEnded(): Boolean = {
+ (char == '.') && {
+ val poff = offset
+ nextChar() // read '.'
+ val ok = char == endOfText || char == endOfLine || isWhitespace(char)
+ offset = poff
+ ok
+ }
+ }
+
def reportError(pos: Position, message: String) {
reporter.warning(pos, message)
}
diff --git a/test/files/jvm/deprecation.check b/test/files/jvm/deprecation.check
index d116778d3f..3c27d4d082 100644
--- a/test/files/jvm/deprecation.check
+++ b/test/files/jvm/deprecation.check
@@ -1,3 +1,3 @@
-warning: there were 4 deprecation warning(s); re-run with -deprecation for details
+warning: there were 4 deprecation warnings; re-run with -deprecation for details
Note: deprecation/Use_2.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
diff --git a/test/files/jvm/future-spec.check b/test/files/jvm/future-spec.check
index 844ca54682..df1629dd7e 100644
--- a/test/files/jvm/future-spec.check
+++ b/test/files/jvm/future-spec.check
@@ -1 +1 @@
-warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+warning: there was one deprecation warning; re-run with -deprecation for details
diff --git a/test/files/jvm/interpreter.check b/test/files/jvm/interpreter.check
index b55ecc10e6..d124794e72 100644
--- a/test/files/jvm/interpreter.check
+++ b/test/files/jvm/interpreter.check
@@ -95,7 +95,7 @@ scala> case class Bar(n: Int)
defined class Bar
scala> implicit def foo2bar(foo: Foo) = Bar(foo.n)
-warning: there were 1 feature warning(s); re-run with -feature for details
+warning: there was one feature warning; re-run with -feature for details
foo2bar: (foo: Foo)Bar
scala> val bar: Bar = Foo(3)
@@ -269,7 +269,7 @@ scala> xs map (x => x)
res6: Array[_] = Array(1, 2)
scala> xs map (x => (x, x))
-warning: there were 1 feature warning(s); re-run with -feature for details
+warning: there was one feature warning; re-run with -feature for details
res7: Array[(_$1, _$1)] forSome { type _$1 } = Array((1,1), (2,2))
scala>
diff --git a/test/files/jvm/serialization-new.check b/test/files/jvm/serialization-new.check
index 47d7bfd920..8ec5754ea2 100644
--- a/test/files/jvm/serialization-new.check
+++ b/test/files/jvm/serialization-new.check
@@ -1,4 +1,4 @@
-warning: there were 2 deprecation warning(s); re-run with -deprecation for details
+warning: there were 2 deprecation warnings; re-run with -deprecation for details
a1 = Array[1,2,3]
_a1 = Array[1,2,3]
arrayEquals(a1, _a1): true
diff --git a/test/files/jvm/serialization.check b/test/files/jvm/serialization.check
index 47d7bfd920..8ec5754ea2 100644
--- a/test/files/jvm/serialization.check
+++ b/test/files/jvm/serialization.check
@@ -1,4 +1,4 @@
-warning: there were 2 deprecation warning(s); re-run with -deprecation for details
+warning: there were 2 deprecation warnings; re-run with -deprecation for details
a1 = Array[1,2,3]
_a1 = Array[1,2,3]
arrayEquals(a1, _a1): true
diff --git a/test/files/neg/t5675.check b/test/files/neg/t5675.check
index da608a2b78..13226935dc 100644
--- a/test/files/neg/t5675.check
+++ b/test/files/neg/t5675.check
@@ -1,2 +1,2 @@
-error: there were 1 feature warning(s); re-run with -feature for details
+error: there was one feature warning; re-run with -feature for details
one error found
diff --git a/test/files/neg/tailrec-4.check b/test/files/neg/tailrec-4.check
new file mode 100644
index 0000000000..3ec3274478
--- /dev/null
+++ b/test/files/neg/tailrec-4.check
@@ -0,0 +1,16 @@
+tailrec-4.scala:6: error: could not optimize @tailrec annotated method foo: it contains a recursive call not in tail position
+ @tailrec def foo: Int = foo + 1
+ ^
+tailrec-4.scala:11: error: could not optimize @tailrec annotated method foo: it contains a recursive call not in tail position
+ @tailrec def foo: Int = foo + 1
+ ^
+tailrec-4.scala:17: error: could not optimize @tailrec annotated method foo: it contains a recursive call not in tail position
+ @tailrec def foo: Int = foo + 1
+ ^
+tailrec-4.scala:23: error: could not optimize @tailrec annotated method foo: it contains a recursive call not in tail position
+ @tailrec def foo: Int = foo + 1
+ ^
+tailrec-4.scala:31: error: could not optimize @tailrec annotated method foo: it contains a recursive call not in tail position
+ @tailrec def foo: Int = foo + 1
+ ^
+5 errors found
diff --git a/test/files/neg/tailrec-4.scala b/test/files/neg/tailrec-4.scala
new file mode 100644
index 0000000000..4822799dfa
--- /dev/null
+++ b/test/files/neg/tailrec-4.scala
@@ -0,0 +1,35 @@
+import annotation._
+
+object Tail {
+ def tcInFunc: Unit = {
+ () => {
+ @tailrec def foo: Int = foo + 1
+ }
+ }
+ def tcInBooleanExprFirstOp(x: Int, v: Int): Boolean = {
+ {
+ @tailrec def foo: Int = foo + 1
+ foo
+ } == v && true
+ }
+ def tcInBooleanExprSecondOp(x: Int, v: Int): Boolean = {
+ true && {
+ @tailrec def foo: Int = foo + 1
+ foo
+ } == v
+ }
+ def tcInIfCond(x: Int, v: Int): Boolean = {
+ if ({
+ @tailrec def foo: Int = foo + 1
+ foo
+ } == v) true else false
+ }
+ def tcInPatternGuard(x: Int, v: Int): Boolean =
+ v match {
+ case _ if
+ {
+ @tailrec def foo: Int = foo + 1
+ foo == 42
+ } => true
+ }
+}
diff --git a/test/files/neg/virtpatmat_exhaust_compound.check b/test/files/neg/virtpatmat_exhaust_compound.check
new file mode 100644
index 0000000000..72e0340682
--- /dev/null
+++ b/test/files/neg/virtpatmat_exhaust_compound.check
@@ -0,0 +1,15 @@
+virtpatmat_exhaust_compound.scala:14: warning: match may not be exhaustive.
+It would fail on the following inputs: O1, O2, O4
+ a match {
+ ^
+virtpatmat_exhaust_compound.scala:18: warning: match may not be exhaustive.
+It would fail on the following input: O4
+ def t1(a: Product with Base with Base2) = a match {
+ ^
+virtpatmat_exhaust_compound.scala:22: warning: match may not be exhaustive.
+It would fail on the following input: O2
+ def t2(a: Product with Base { def foo: Int }) = a match {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+three warnings found
+one error found
diff --git a/test/files/neg/virtpatmat_exhaust_compound.flags b/test/files/neg/virtpatmat_exhaust_compound.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/neg/virtpatmat_exhaust_compound.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/neg/virtpatmat_exhaust_compound.scala b/test/files/neg/virtpatmat_exhaust_compound.scala
new file mode 100644
index 0000000000..386c7af98d
--- /dev/null
+++ b/test/files/neg/virtpatmat_exhaust_compound.scala
@@ -0,0 +1,29 @@
+sealed trait Base
+case object O1 extends Base
+case object O2 extends Base {
+ def foo: Int = 0
+}
+
+sealed trait Base2
+case object O3 extends Base2
+
+case object O4 extends Base with Base2
+
+object Test {
+ val a /*: Product with Serialiable with Base */ = if (true) O1 else O2
+ a match {
+ case null =>
+ }
+
+ def t1(a: Product with Base with Base2) = a match {
+ case null => // O1..O3 should *not* be possible here
+ }
+
+ def t2(a: Product with Base { def foo: Int }) = a match {
+ case null => // O2 in the domain
+ }
+
+ def t3(a: Product with Base { def bar: Int }) = a match {
+ case null => // nothing in the domain
+ }
+}
diff --git a/test/files/run/collection-stacks.check b/test/files/run/collection-stacks.check
index 895bde374d..3a366bfcdf 100644
--- a/test/files/run/collection-stacks.check
+++ b/test/files/run/collection-stacks.check
@@ -1,4 +1,4 @@
-warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+warning: there was one deprecation warning; re-run with -deprecation for details
3-2-1: true
3-2-1: true
apply
diff --git a/test/files/run/colltest.check b/test/files/run/colltest.check
index 1e850bb582..46e4017eb6 100644
--- a/test/files/run/colltest.check
+++ b/test/files/run/colltest.check
@@ -1,4 +1,4 @@
-warning: there were 2 deprecation warning(s); re-run with -deprecation for details
+warning: there were 2 deprecation warnings; re-run with -deprecation for details
true
false
true
diff --git a/test/files/run/colltest1.scala b/test/files/run/colltest1.scala
index 8dce69afc9..e0ec378585 100644
--- a/test/files/run/colltest1.scala
+++ b/test/files/run/colltest1.scala
@@ -1,5 +1,5 @@
/*
- * filter: inliner warning\(s\); re-run with -Yinline-warnings for details
+ * filter: inliner warnings; re-run with -Yinline-warnings for details
*/
import scala.collection._
import scala.language.postfixOps
diff --git a/test/files/run/compiler-asSeenFrom.scala b/test/files/run/compiler-asSeenFrom.scala
index ea96c6fba7..677dd40ddc 100644
--- a/test/files/run/compiler-asSeenFrom.scala
+++ b/test/files/run/compiler-asSeenFrom.scala
@@ -1,5 +1,5 @@
/*
- * filter: inliner warning\(s\); re-run with -Yinline-warnings for details
+ * filter: inliner warning; re-run with -Yinline-warnings for details
*/
import scala.tools.nsc._
import scala.tools.partest.DirectTest
diff --git a/test/files/run/constrained-types.check b/test/files/run/constrained-types.check
index 9a106785a1..a3cd59b9fb 100644
--- a/test/files/run/constrained-types.check
+++ b/test/files/run/constrained-types.check
@@ -71,11 +71,11 @@ scala> var four = "four"
four: String = four
scala> val four2 = m(four) // should have an existential bound
-warning: there were 1 feature warning(s); re-run with -feature for details
+warning: there was one feature warning; re-run with -feature for details
four2: String @Annot(x) forSome { val x: String } = four
scala> val four3 = four2 // should have the same type as four2
-warning: there were 1 feature warning(s); re-run with -feature for details
+warning: there was one feature warning; re-run with -feature for details
four3: String @Annot(x) forSome { val x: String } = four
scala> val stuff = m("stuff") // should not crash
@@ -98,7 +98,7 @@ scala> def m = {
val y : String @Annot(x) = x
y
} // x should not escape the local scope with a narrow type
-warning: there were 1 feature warning(s); re-run with -feature for details
+warning: there was one feature warning; re-run with -feature for details
m: String @Annot(x) forSome { val x: String }
scala>
@@ -112,7 +112,7 @@ scala> def n(y: String) = {
}
m("stuff".stripMargin)
} // x should be existentially bound
-warning: there were 1 feature warning(s); re-run with -feature for details
+warning: there was one feature warning; re-run with -feature for details
n: (y: String)String @Annot(x) forSome { val x: String }
scala>
diff --git a/test/files/run/delambdafy_t6028.check b/test/files/run/delambdafy_t6028.check
index 92cfbaefb6..7bd8cd7202 100644
--- a/test/files/run/delambdafy_t6028.check
+++ b/test/files/run/delambdafy_t6028.check
@@ -54,4 +54,4 @@ package <empty> {
}
}
-warning: there were 1 feature warning(s); re-run with -feature for details
+warning: there was one feature warning; re-run with -feature for details
diff --git a/test/files/run/delay-bad.check b/test/files/run/delay-bad.check
index 5d8c5fa1d4..cb6e329f7a 100644
--- a/test/files/run/delay-bad.check
+++ b/test/files/run/delay-bad.check
@@ -4,7 +4,7 @@ delay-bad.scala:53: warning: a pure expression does nothing in statement positio
delay-bad.scala:73: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
f(new { val x = 5 } with E() { 5 })
^
-warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+warning: there was one deprecation warning; re-run with -deprecation for details
// new C { }
diff --git a/test/files/run/eta-expand-star2.check b/test/files/run/eta-expand-star2.check
index cbf4781255..d6929e4969 100644
--- a/test/files/run/eta-expand-star2.check
+++ b/test/files/run/eta-expand-star2.check
@@ -1,2 +1,2 @@
-warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+warning: there was one deprecation warning; re-run with -deprecation for details
hello
diff --git a/test/files/run/existentials-in-compiler.scala b/test/files/run/existentials-in-compiler.scala
index d019d56b42..dfc7048b31 100644
--- a/test/files/run/existentials-in-compiler.scala
+++ b/test/files/run/existentials-in-compiler.scala
@@ -1,5 +1,5 @@
/*
- * filter: inliner warning\(s\); re-run with -Yinline-warnings for details
+ * filter: inliner warnings; re-run with -Yinline-warnings for details
*/
import scala.tools.nsc._
import scala.tools.partest.CompilerTest
diff --git a/test/files/run/inferred-type-constructors.check b/test/files/run/inferred-type-constructors.check
index 5992ef02ad..67075a59a9 100644
--- a/test/files/run/inferred-type-constructors.check
+++ b/test/files/run/inferred-type-constructors.check
@@ -1,4 +1,4 @@
-warning: there were 2 feature warning(s); re-run with -feature for details
+warning: there were 2 feature warnings; re-run with -feature for details
p.Iterable[Int]
p.Set[Int]
p.Seq[Int]
diff --git a/test/files/run/is-valid-num.scala b/test/files/run/is-valid-num.scala
index 65e8ceeca6..4ab2fac8dd 100644
--- a/test/files/run/is-valid-num.scala
+++ b/test/files/run/is-valid-num.scala
@@ -1,5 +1,5 @@
/*
- * filter: inliner warning\(s\); re-run with -Yinline-warnings for details
+ * filter: inliner warnings; re-run with -Yinline-warnings for details
*/
object Test {
def x = BigInt("10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
diff --git a/test/files/run/iterator-from.scala b/test/files/run/iterator-from.scala
index 269e859657..e2ca5864ea 100644
--- a/test/files/run/iterator-from.scala
+++ b/test/files/run/iterator-from.scala
@@ -1,5 +1,5 @@
/* This file tests iteratorFrom, keysIteratorFrom, and valueIteratorFrom on various sorted sets and maps
- * filter: inliner warning\(s\); re-run with -Yinline-warnings for details
+ * filter: inliner warnings; re-run with -Yinline-warnings for details
*/
import scala.util.{Random => R}
diff --git a/test/files/run/literals.check b/test/files/run/literals.check
index ed7c6ca5b3..62c5fd68ae 100644
--- a/test/files/run/literals.check
+++ b/test/files/run/literals.check
@@ -1,4 +1,4 @@
-warning: there were 5 deprecation warning(s); re-run with -deprecation for details
+warning: there were 5 deprecation warnings; re-run with -deprecation for details
test '\u0024' == '$' was successful
test '\u005f' == '_' was successful
test 65.asInstanceOf[Char] == 'A' was successful
diff --git a/test/files/run/macro-rangepos-args.check b/test/files/run/macro-rangepos-args.check
new file mode 100644
index 0000000000..d779505c66
--- /dev/null
+++ b/test/files/run/macro-rangepos-args.check
@@ -0,0 +1 @@
+Line: 3. Width: 5.
diff --git a/test/files/run/macro-rangepos-args.flags b/test/files/run/macro-rangepos-args.flags
new file mode 100644
index 0000000000..fcf951d907
--- /dev/null
+++ b/test/files/run/macro-rangepos-args.flags
@@ -0,0 +1 @@
+-Yrangepos \ No newline at end of file
diff --git a/test/files/run/macro-rangepos-args/Macros_1.scala b/test/files/run/macro-rangepos-args/Macros_1.scala
new file mode 100644
index 0000000000..97b938613c
--- /dev/null
+++ b/test/files/run/macro-rangepos-args/Macros_1.scala
@@ -0,0 +1,10 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def impl(c: Context)(x: c.Tree): c.Tree = {
+ import c.universe._
+ Literal(Constant(s"Line: ${x.pos.line}. Width: ${x.pos.end - x.pos.start}."))
+ }
+ def pos(x: Any): String = macro impl
+}
diff --git a/test/files/run/macro-rangepos-args/Test_2.scala b/test/files/run/macro-rangepos-args/Test_2.scala
new file mode 100644
index 0000000000..8c770e9010
--- /dev/null
+++ b/test/files/run/macro-rangepos-args/Test_2.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ val x = 2
+ println(Macros.pos(x + 2))
+} \ No newline at end of file
diff --git a/test/files/run/macroPlugins-isBlackbox/Macros_2.scala b/test/files/run/macroPlugins-isBlackbox/Macros_2.scala
new file mode 100644
index 0000000000..a90dd702df
--- /dev/null
+++ b/test/files/run/macroPlugins-isBlackbox/Macros_2.scala
@@ -0,0 +1,11 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def impl(c: Context) = {
+ import c.universe._
+ q"42"
+ }
+
+ def foo: Any = macro impl
+} \ No newline at end of file
diff --git a/test/files/run/macroPlugins-isBlackbox/Plugin_1.scala b/test/files/run/macroPlugins-isBlackbox/Plugin_1.scala
new file mode 100644
index 0000000000..b78a18ea6a
--- /dev/null
+++ b/test/files/run/macroPlugins-isBlackbox/Plugin_1.scala
@@ -0,0 +1,21 @@
+package isblackbox
+
+import scala.tools.nsc.Global
+import scala.tools.nsc.plugins.{Plugin => NscPlugin}
+
+class Plugin(val global: Global) extends NscPlugin {
+ import global._
+ import analyzer._
+ import scala.reflect.internal.Mode
+
+ val name = "isBlackbox"
+ val description = "A sample analyzer plugin that overrides isBlackbox."
+ val components = Nil
+ addMacroPlugin(MacroPlugin)
+
+ object MacroPlugin extends MacroPlugin {
+ override def pluginsIsBlackbox(macroDef: Symbol): Option[Boolean] = {
+ Some(false)
+ }
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macroPlugins-isBlackbox/Test_3.flags b/test/files/run/macroPlugins-isBlackbox/Test_3.flags
new file mode 100644
index 0000000000..966df731d0
--- /dev/null
+++ b/test/files/run/macroPlugins-isBlackbox/Test_3.flags
@@ -0,0 +1 @@
+-Xplugin:. \ No newline at end of file
diff --git a/test/files/run/macroPlugins-isBlackbox/Test_3.scala b/test/files/run/macroPlugins-isBlackbox/Test_3.scala
new file mode 100644
index 0000000000..552e888143
--- /dev/null
+++ b/test/files/run/macroPlugins-isBlackbox/Test_3.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ val x: Int = Macros.foo
+} \ No newline at end of file
diff --git a/test/files/run/macroPlugins-isBlackbox/scalac-plugin.xml b/test/files/run/macroPlugins-isBlackbox/scalac-plugin.xml
new file mode 100644
index 0000000000..09b9c14648
--- /dev/null
+++ b/test/files/run/macroPlugins-isBlackbox/scalac-plugin.xml
@@ -0,0 +1,4 @@
+<plugin>
+ <name>is-blackbox</name>
+ <classname>isblackbox.Plugin</classname>
+</plugin> \ No newline at end of file
diff --git a/test/files/run/mapConserve.scala b/test/files/run/mapConserve.scala
index d1d52f3107..f52af3b9f4 100644
--- a/test/files/run/mapConserve.scala
+++ b/test/files/run/mapConserve.scala
@@ -1,5 +1,5 @@
/*
- * filter: inliner warning\(s\); re-run with -Yinline-warnings for details
+ * filter: inliner warnings; re-run with -Yinline-warnings for details
*/
import scala.annotation.tailrec
import scala.collection.mutable.ListBuffer
diff --git a/test/files/run/names-defaults.check b/test/files/run/names-defaults.check
index 0037822f3b..97cfa4e520 100644
--- a/test/files/run/names-defaults.check
+++ b/test/files/run/names-defaults.check
@@ -1,7 +1,7 @@
names-defaults.scala:269: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
spawn(b = { val ttt = 1; ttt }, a = 0)
^
-warning: there were 4 deprecation warning(s); re-run with -deprecation for details
+warning: there were 4 deprecation warnings; re-run with -deprecation for details
1: @
get: $
get: 2
diff --git a/test/files/run/pc-conversions.scala b/test/files/run/pc-conversions.scala
index 19fef355c8..5fecac9d94 100644
--- a/test/files/run/pc-conversions.scala
+++ b/test/files/run/pc-conversions.scala
@@ -1,5 +1,5 @@
/*
- * filter: inliner warning\(s\); re-run with -Yinline-warnings for details
+ * filter: inliner warning; re-run with -Yinline-warnings for details
*/
import collection._
diff --git a/test/files/run/reflection-java-annotations.check b/test/files/run/reflection-java-annotations.check
index 72d40989fe..842037254e 100644
--- a/test/files/run/reflection-java-annotations.check
+++ b/test/files/run/reflection-java-annotations.check
@@ -1,4 +1,4 @@
-warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+warning: there was one deprecation warning; re-run with -deprecation for details
List(JavaComplexAnnotation_1(v1 = 1, v10 = "hello", v101 = [101, 101], v102 = [102, 102], v103 = ['g', 'g'], v104 = [104, 104], v105 = [105L, 105L], v106 = [106.0, 106.0], v107 = [107.0, 107.0], v108 = [false, true], v11 = classOf[JavaAnnottee_1], v110 = ["hello", "world"], v111 = [classOf[JavaSimpleAnnotation_1], classOf[JavaComplexAnnotation_1]], v112 = [FOO, BAR], v113 = [JavaSimpleAnnotation_1(v1 = 21, v10 = "world2", v11 = classOf[JavaComplexAnnotation_1], v12 = BAR, v2 = 22, v3 = '\027', v4 = 24, v5 = 25L, v6 = 26.0, v7 = 27.0, v8 = false)], v12 = FOO, v13 = JavaSimpleAnnotation_1(v1 = 11, v10 = "world1", v11 = classOf[JavaSimpleAnnotation_1], v12 = FOO, v2 = 12, v3 = '\r', v4 = 14, v5 = 15L, v6 = 16.0, v7 = 17.0, v8 = false), v2 = 2, v3 = '\03', v4 = 4, v5 = 5L, v6 = 6.0, v7 = 7.0, v8 = false))
=======
new JavaComplexAnnotation_1(v1 = 1, v10 = "hello", v101 = Array(101, 101), v102 = Array(102, 102), v103 = Array('g', 'g'), v104 = Array(104, 104), v105 = Array(105L, 105L), v106 = Array(106.0, 106.0), v107 = Array(107.0, 107.0), v108 = Array(false, true), v11 = classOf[JavaAnnottee_1], v110 = Array("hello", "world"), v111 = Array(classOf[JavaSimpleAnnotation_1], classOf[JavaComplexAnnotation_1]), v112 = Array(FOO, BAR), v113 = Array(new JavaSimpleAnnotation_1(v1 = 21, v10 = "world2", v11 = classOf[JavaComplexAnnotation_1], v12 = BAR, v2 = 22, v3 = '\027', v4 = 24, v5 = 25L, v6 = 26.0, v7 = 27.0, v8 = false)), v12 = FOO, v13 = new JavaSimpleAnnotation_1(v1 = 11, v10 = "world1", v11 = classOf[JavaSimpleAnnotation_1], v12 = FOO, v2 = 12, v3 = '\r', v4 = 14, v5 = 15L, v6 = 16.0, v7 = 17.0, v8 = false), v2 = 2, v3 = '\03', v4 = 4, v5 = 5L, v6 = 6.0, v7 = 7.0, v8 = false)
diff --git a/test/files/run/reflection-magicsymbols-repl.check b/test/files/run/reflection-magicsymbols-repl.check
index a1bee76652..72aef1d3be 100644
--- a/test/files/run/reflection-magicsymbols-repl.check
+++ b/test/files/run/reflection-magicsymbols-repl.check
@@ -21,7 +21,7 @@ scala> def test(n: Int): Unit = {
val x = sig.asInstanceOf[MethodType].params.head
println(x.info)
}
-warning: there were 1 feature warning(s); re-run with -feature for details
+warning: there was one feature warning; re-run with -feature for details
test: (n: Int)Unit
scala> for (i <- 1 to 8) test(i)
diff --git a/test/files/run/repl-power.check b/test/files/run/repl-power.check
index e56901e0f2..8a8ca46012 100644
--- a/test/files/run/repl-power.check
+++ b/test/files/run/repl-power.check
@@ -11,11 +11,11 @@ scala> :power
scala> // guarding against "error: reference to global is ambiguous"
scala> global.emptyValDef // "it is imported twice in the same scope by ..."
-warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+warning: there was one deprecation warning; re-run with -deprecation for details
res0: $r.global.noSelfType.type = private val _ = _
scala> val tp = ArrayClass[scala.util.Random] // magic with tags
-warning: there were 1 feature warning(s); re-run with -feature for details
+warning: there was one feature warning; re-run with -feature for details
tp: $r.global.Type = Array[scala.util.Random]
scala> tp.memberType(Array_apply) // evidence
diff --git a/test/files/run/richs.check b/test/files/run/richs.check
index 02a98b376d..bcaf8bdb8d 100644
--- a/test/files/run/richs.check
+++ b/test/files/run/richs.check
@@ -1,4 +1,4 @@
-warning: there were 2 deprecation warning(s); re-run with -deprecation for details
+warning: there were 2 deprecation warnings; re-run with -deprecation for details
RichCharTest1:
true
diff --git a/test/files/run/search.check b/test/files/run/search.check
index a885696509..e0c55043e3 100644
--- a/test/files/run/search.check
+++ b/test/files/run/search.check
@@ -1,6 +1,6 @@
Found(2)
Found(4)
-InsertionPoint(9)
+InsertionPoint(10)
Found(2)
Found(4)
-InsertionPoint(9)
+InsertionPoint(10)
diff --git a/test/files/run/stringinterpolation_macro-run.scala b/test/files/run/stringinterpolation_macro-run.scala
index ff779dd1d3..a6def98540 100644
--- a/test/files/run/stringinterpolation_macro-run.scala
+++ b/test/files/run/stringinterpolation_macro-run.scala
@@ -1,5 +1,5 @@
/*
- * filter: inliner warning\(s\); re-run with -Yinline-warnings for details
+ * filter: inliner warnings; re-run with -Yinline-warnings for details
*/
object Test extends App {
diff --git a/test/files/run/synchronized.check b/test/files/run/synchronized.check
index 6e99739633..eab191b4ed 100644
--- a/test/files/run/synchronized.check
+++ b/test/files/run/synchronized.check
@@ -1,4 +1,4 @@
-warning: there were 14 inliner warning(s); re-run with -Yinline-warnings for details
+warning: there were 14 inliner warnings; re-run with -Yinline-warnings for details
.|. c1.f1: OK
.|. c1.fi: OK
.|... c1.fv: OK
diff --git a/test/files/run/t2212.check b/test/files/run/t2212.check
index 8ab4d60ab3..f7e80439c7 100644
--- a/test/files/run/t2212.check
+++ b/test/files/run/t2212.check
@@ -1,4 +1,4 @@
-warning: there were 2 deprecation warning(s); re-run with -deprecation for details
+warning: there were 2 deprecation warnings; re-run with -deprecation for details
LinkedList(1)
LinkedList(1)
true
diff --git a/test/files/run/t3361.check b/test/files/run/t3361.check
index c18bdc9aff..5e0a763501 100644
--- a/test/files/run/t3361.check
+++ b/test/files/run/t3361.check
@@ -1 +1 @@
-warning: there were 16 deprecation warning(s); re-run with -deprecation for details
+warning: there were 16 deprecation warnings; re-run with -deprecation for details
diff --git a/test/files/run/t3888.check b/test/files/run/t3888.check
index 844ca54682..df1629dd7e 100644
--- a/test/files/run/t3888.check
+++ b/test/files/run/t3888.check
@@ -1 +1 @@
-warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+warning: there was one deprecation warning; re-run with -deprecation for details
diff --git a/test/files/run/t3970.check b/test/files/run/t3970.check
index bd89fff9d9..0683a6c1a6 100644
--- a/test/files/run/t3970.check
+++ b/test/files/run/t3970.check
@@ -1 +1 @@
-warning: there were 5 deprecation warning(s); re-run with -deprecation for details
+warning: there were 5 deprecation warnings; re-run with -deprecation for details
diff --git a/test/files/run/t3996.check b/test/files/run/t3996.check
index a92ddc0e51..2e8e558f88 100644
--- a/test/files/run/t3996.check
+++ b/test/files/run/t3996.check
@@ -1 +1 @@
-warning: there were 2 deprecation warning(s); re-run with -deprecation for details
+warning: there were 2 deprecation warnings; re-run with -deprecation for details
diff --git a/test/files/run/t4080.check b/test/files/run/t4080.check
index 1953a68ad3..c642cc67da 100644
--- a/test/files/run/t4080.check
+++ b/test/files/run/t4080.check
@@ -1,2 +1,2 @@
-warning: there were 3 deprecation warning(s); re-run with -deprecation for details
+warning: there were 3 deprecation warnings; re-run with -deprecation for details
LinkedList(1, 0, 2, 3)
diff --git a/test/files/run/t4172.check b/test/files/run/t4172.check
index d94638d27e..a748430e2e 100644
--- a/test/files/run/t4172.check
+++ b/test/files/run/t4172.check
@@ -2,7 +2,7 @@ Type in expressions to have them evaluated.
Type :help for more information.
scala> val c = { class C { override def toString = "C" }; ((new C, new C { def f = 2 })) }
-warning: there were 1 feature warning(s); re-run with -feature for details
+warning: there was one feature warning; re-run with -feature for details
c: (C, C{def f: Int}) forSome { type C <: AnyRef } = (C,C)
scala>
diff --git a/test/files/run/t4396.check b/test/files/run/t4396.check
index a75e1f257f..d38fb7fae7 100644
--- a/test/files/run/t4396.check
+++ b/test/files/run/t4396.check
@@ -1,4 +1,4 @@
-warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+warning: there was one deprecation warning; re-run with -deprecation for details
hallo
constructor
out:22
diff --git a/test/files/run/t4461.check b/test/files/run/t4461.check
index 9488669324..c44b0fc077 100644
--- a/test/files/run/t4461.check
+++ b/test/files/run/t4461.check
@@ -1,4 +1,4 @@
-warning: there were 4 deprecation warning(s); re-run with -deprecation for details
+warning: there were 4 deprecation warnings; re-run with -deprecation for details
Include(End,1)
Include(End,2)
Include(End,3)
diff --git a/test/files/run/t4594-repl-settings.scala b/test/files/run/t4594-repl-settings.scala
index d2335460e5..8b8b2e3746 100644
--- a/test/files/run/t4594-repl-settings.scala
+++ b/test/files/run/t4594-repl-settings.scala
@@ -11,7 +11,7 @@ object Test extends SessionTest {
|depp: String
|
|scala> def a = depp
- |warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+ |warning: there was one deprecation warning; re-run with -deprecation for details
|a: String
|
|scala> :settings +deprecation
diff --git a/test/files/run/t4680.check b/test/files/run/t4680.check
index 512bfd4b54..21a1e0cd15 100644
--- a/test/files/run/t4680.check
+++ b/test/files/run/t4680.check
@@ -4,7 +4,7 @@ t4680.scala:51: warning: a pure expression does nothing in statement position; y
t4680.scala:69: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
new { val x = 5 } with E() { 5 }
^
-warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+warning: there was one deprecation warning; re-run with -deprecation for details
// new C { }
diff --git a/test/files/run/t4710.check b/test/files/run/t4710.check
index f2335d1bdd..6ee7198b4b 100644
--- a/test/files/run/t4710.check
+++ b/test/files/run/t4710.check
@@ -2,7 +2,7 @@ Type in expressions to have them evaluated.
Type :help for more information.
scala> def method : String = { implicit def f(s: Symbol) = "" ; 'symbol }
-warning: there were 1 feature warning(s); re-run with -feature for details
+warning: there was one feature warning; re-run with -feature for details
method: String
scala>
diff --git a/test/files/run/t4813.check b/test/files/run/t4813.check
index a92ddc0e51..2e8e558f88 100644
--- a/test/files/run/t4813.check
+++ b/test/files/run/t4813.check
@@ -1 +1 @@
-warning: there were 2 deprecation warning(s); re-run with -deprecation for details
+warning: there were 2 deprecation warnings; re-run with -deprecation for details
diff --git a/test/files/run/t5428.check b/test/files/run/t5428.check
index a46514ae7c..52fce09399 100644
--- a/test/files/run/t5428.check
+++ b/test/files/run/t5428.check
@@ -1,2 +1,2 @@
-warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+warning: there was one deprecation warning; re-run with -deprecation for details
Stack(8, 7, 6, 5, 4, 3)
diff --git a/test/files/run/t576.check b/test/files/run/t576.check
index 6458d5d743..22f3843abf 100644
--- a/test/files/run/t576.check
+++ b/test/files/run/t576.check
@@ -1,4 +1,4 @@
-warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+warning: there was one deprecation warning; re-run with -deprecation for details
1
2
3
diff --git a/test/files/run/t5905-features.scala b/test/files/run/t5905-features.scala
index a3848eef2a..b518d61145 100644
--- a/test/files/run/t5905-features.scala
+++ b/test/files/run/t5905-features.scala
@@ -3,13 +3,13 @@ import tools.partest.DirectTest
// verify that all languageFeature names are accepted by -language
object Test extends DirectTest {
- override def code = "class Code { def f = (1 to 10) size }" // exercise a feature
+ override def code = "class Code { def f = (1 to 10) size }" // exercise a feature to sanity-check coverage of -language options
override def extraSettings = s"-usejavacp -d ${testOutput.path}"
override def show() = {
- val global = newCompiler("-language:postfixOps", "-Ystop-after:typer")
- compileString(global)(code)
+ val global = newCompiler("-Ystop-after:typer")
+ compileString(global)("") // warm me up, scotty
import global._
exitingTyper {
//def isFeature(s: Symbol) = s.annotations.exists((a: AnnotationInfo) => a.tpe <:< typeOf[scala.annotation.meta.languageFeature])
@@ -21,6 +21,8 @@ object Test extends DirectTest {
assert(feats.nonEmpty, "Test must find feature flags.")
+ //compile("junk") // tragically, does not fail the test, i.e., arg must not be totally borked
+
//dynamics,postfixOps,reflectiveCalls,implicitConversions,higherKinds,existentials,experimental.macros
compile(s"-language:$all")
}
diff --git a/test/files/run/t6028.check b/test/files/run/t6028.check
index a6c4db8f11..55ff42d8d7 100644
--- a/test/files/run/t6028.check
+++ b/test/files/run/t6028.check
@@ -81,4 +81,4 @@ package <empty> {
}
}
-warning: there were 1 feature warning(s); re-run with -feature for details
+warning: there was one feature warning; re-run with -feature for details
diff --git a/test/files/run/t6111.check b/test/files/run/t6111.check
index 1f23a87f73..21a5b19ea0 100644
--- a/test/files/run/t6111.check
+++ b/test/files/run/t6111.check
@@ -1,3 +1,3 @@
-warning: there were 2 deprecation warning(s); re-run with -deprecation for details
+warning: there were 2 deprecation warnings; re-run with -deprecation for details
(8,8)
(x,x)
diff --git a/test/files/run/t6292.check b/test/files/run/t6292.check
index 6232ba7519..6f7430d5b8 100644
--- a/test/files/run/t6292.check
+++ b/test/files/run/t6292.check
@@ -1 +1 @@
-warning: there were 7 deprecation warning(s); re-run with -deprecation for details
+warning: there were 7 deprecation warnings; re-run with -deprecation for details
diff --git a/test/files/run/t6318_primitives.check b/test/files/run/t6318_primitives.check
index b330f91276..4bc5e598eb 100644
--- a/test/files/run/t6318_primitives.check
+++ b/test/files/run/t6318_primitives.check
@@ -1,36 +1,54 @@
-true
+Checking if byte matches byte
Some(1)
-false
+Checking if byte matches short
None
-true
+Checking if class java.lang.Byte matches byte
Some(1)
-false
+Checking if short matches short
+Some(1)
+Checking if short matches char
None
-true
+Checking if class java.lang.Short matches short
+Some(1)
+Checking if char matches char
Some()
-false
+Checking if char matches int
None
-true
+Checking if class java.lang.Character matches char
+Some()
+Checking if int matches int
Some(1)
-false
+Checking if int matches long
None
-true
+Checking if class java.lang.Integer matches int
Some(1)
-false
+Checking if long matches long
+Some(1)
+Checking if long matches float
None
-true
+Checking if class java.lang.Long matches long
+Some(1)
+Checking if float matches float
Some(1.0)
-false
+Checking if float matches double
None
-true
+Checking if class java.lang.Float matches float
Some(1.0)
-false
+Checking if double matches double
+Some(1.0)
+Checking if double matches boolean
None
-true
+Checking if class java.lang.Double matches double
+Some(1.0)
+Checking if boolean matches boolean
Some(true)
-false
+Checking if boolean matches void
None
-true
+Checking if class java.lang.Boolean matches boolean
+Some(true)
+Checking if void matches void
Some(())
-false
+Checking if void matches byte
None
+Checking if class scala.runtime.BoxedUnit matches void
+Some(())
diff --git a/test/files/run/t6318_primitives.scala b/test/files/run/t6318_primitives.scala
index 30f27120b3..bc8ec88359 100644
--- a/test/files/run/t6318_primitives.scala
+++ b/test/files/run/t6318_primitives.scala
@@ -2,70 +2,88 @@ import scala.reflect.{ClassTag, classTag}
object Test extends App {
def test[T: ClassTag](x: T) {
- println(classTag[T].runtimeClass.isAssignableFrom(x.getClass))
+ println(s"Checking if ${x.getClass} matches ${classTag[T].runtimeClass}")
println(classTag[T].unapply(x))
}
{
val x = 1.toByte
- println(ClassTag.Byte.runtimeClass.isAssignableFrom(x.getClass))
+ println(s"Checking if ${x.getClass} matches ${classTag[Byte].runtimeClass}")
println(ClassTag.Byte.unapply(x))
+ println(s"Checking if ${x.getClass} matches ${classTag[Short].runtimeClass}")
+ println(ClassTag.Short.unapply(x))
test(x)
}
{
val x = 1.toShort
- println(ClassTag.Short.runtimeClass.isAssignableFrom(x.getClass))
+ println(s"Checking if ${x.getClass} matches ${classTag[Short].runtimeClass}")
println(ClassTag.Short.unapply(x))
+ println(s"Checking if ${x.getClass} matches ${classTag[Char].runtimeClass}")
+ println(ClassTag.Char.unapply(x))
test(x)
}
{
val x = 1.toChar
- println(ClassTag.Char.runtimeClass.isAssignableFrom(x.getClass))
+ println(s"Checking if ${x.getClass} matches ${classTag[Char].runtimeClass}")
println(ClassTag.Char.unapply(x))
+ println(s"Checking if ${x.getClass} matches ${classTag[Int].runtimeClass}")
+ println(ClassTag.Int.unapply(x))
test(x)
}
{
val x = 1.toInt
- println(ClassTag.Int.runtimeClass.isAssignableFrom(x.getClass))
+ println(s"Checking if ${x.getClass} matches ${classTag[Int].runtimeClass}")
println(ClassTag.Int.unapply(x))
+ println(s"Checking if ${x.getClass} matches ${classTag[Long].runtimeClass}")
+ println(ClassTag.Long.unapply(x))
test(x)
}
{
val x = 1.toLong
- println(ClassTag.Long.runtimeClass.isAssignableFrom(x.getClass))
+ println(s"Checking if ${x.getClass} matches ${classTag[Long].runtimeClass}")
println(ClassTag.Long.unapply(x))
+ println(s"Checking if ${x.getClass} matches ${classTag[Float].runtimeClass}")
+ println(ClassTag.Float.unapply(x))
test(x)
}
{
val x = 1.toFloat
- println(ClassTag.Float.runtimeClass.isAssignableFrom(x.getClass))
+ println(s"Checking if ${x.getClass} matches ${classTag[Float].runtimeClass}")
println(ClassTag.Float.unapply(x))
+ println(s"Checking if ${x.getClass} matches ${classTag[Double].runtimeClass}")
+ println(ClassTag.Double.unapply(x))
test(x)
}
{
val x = 1.toDouble
- println(ClassTag.Double.runtimeClass.isAssignableFrom(x.getClass))
+ println(s"Checking if ${x.getClass} matches ${classTag[Double].runtimeClass}")
println(ClassTag.Double.unapply(x))
+ println(s"Checking if ${x.getClass} matches ${classTag[Boolean].runtimeClass}")
+ println(ClassTag.Boolean.unapply(x))
test(x)
}
{
val x = true
- println(ClassTag.Boolean.runtimeClass.isAssignableFrom(x.getClass))
+ println(s"Checking if ${x.getClass} matches ${classTag[Boolean].runtimeClass}")
println(ClassTag.Boolean.unapply(x))
+ println(s"Checking if ${x.getClass} matches ${classTag[Unit].runtimeClass}")
+ println(ClassTag.Unit.unapply(x))
test(x)
}
{
val x = ()
- println(ClassTag.Unit.runtimeClass.isAssignableFrom(x.getClass))
+ println(s"Checking if ${x.getClass} matches ${classTag[Unit].runtimeClass}")
println(ClassTag.Unit.unapply(x))
+ println(s"Checking if ${x.getClass} matches ${classTag[Byte].runtimeClass}")
+ println(ClassTag.Byte.unapply(x))
test(x)
}
-} \ No newline at end of file
+}
diff --git a/test/files/run/t6329_repl.check b/test/files/run/t6329_repl.check
index 5049426ab4..ad0bb46e5b 100644
--- a/test/files/run/t6329_repl.check
+++ b/test/files/run/t6329_repl.check
@@ -5,28 +5,28 @@ scala> import scala.reflect.classTag
import scala.reflect.classTag
scala> classManifest[scala.List[_]]
-warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+warning: there was one deprecation warning; re-run with -deprecation for details
res0: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List[<?>]
scala> classTag[scala.List[_]]
res1: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List
scala> classManifest[scala.collection.immutable.List[_]]
-warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+warning: there was one deprecation warning; re-run with -deprecation for details
res2: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List[<?>]
scala> classTag[scala.collection.immutable.List[_]]
res3: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List
scala> classManifest[Predef.Set[_]]
-warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+warning: there was one deprecation warning; re-run with -deprecation for details
res4: scala.reflect.ClassTag[scala.collection.immutable.Set[_]] = scala.collection.immutable.Set[<?>]
scala> classTag[Predef.Set[_]]
res5: scala.reflect.ClassTag[scala.collection.immutable.Set[_]] = scala.collection.immutable.Set
scala> classManifest[scala.collection.immutable.Set[_]]
-warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+warning: there was one deprecation warning; re-run with -deprecation for details
res6: scala.reflect.ClassTag[scala.collection.immutable.Set[_]] = scala.collection.immutable.Set[<?>]
scala> classTag[scala.collection.immutable.Set[_]]
diff --git a/test/files/run/t6329_repl_bug.check b/test/files/run/t6329_repl_bug.check
index 44c41cfd03..38a8de5606 100644
--- a/test/files/run/t6329_repl_bug.check
+++ b/test/files/run/t6329_repl_bug.check
@@ -8,7 +8,7 @@ scala> import scala.reflect.runtime._
import scala.reflect.runtime._
scala> classManifest[List[_]]
-warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+warning: there was one deprecation warning; re-run with -deprecation for details
res0: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List[<?>]
scala> scala.reflect.classTag[List[_]]
diff --git a/test/files/run/t6329_vanilla_bug.check b/test/files/run/t6329_vanilla_bug.check
index 640d168a8a..01bf0636ea 100644
--- a/test/files/run/t6329_vanilla_bug.check
+++ b/test/files/run/t6329_vanilla_bug.check
@@ -1,3 +1,3 @@
-warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+warning: there was one deprecation warning; re-run with -deprecation for details
scala.collection.immutable.List[<?>]
scala.collection.immutable.List
diff --git a/test/files/run/t6481.check b/test/files/run/t6481.check
index df40722242..4a3f6f7ee9 100644
--- a/test/files/run/t6481.check
+++ b/test/files/run/t6481.check
@@ -1,4 +1,4 @@
-warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+warning: there was one deprecation warning; re-run with -deprecation for details
delayed init
new foo(1, 2)
delayed init
diff --git a/test/files/run/t6690.check b/test/files/run/t6690.check
index a92ddc0e51..2e8e558f88 100644
--- a/test/files/run/t6690.check
+++ b/test/files/run/t6690.check
@@ -1 +1 @@
-warning: there were 2 deprecation warning(s); re-run with -deprecation for details
+warning: there were 2 deprecation warnings; re-run with -deprecation for details
diff --git a/test/files/run/t6863.check b/test/files/run/t6863.check
index fea22b582f..37de2e6e51 100644
--- a/test/files/run/t6863.check
+++ b/test/files/run/t6863.check
@@ -10,4 +10,4 @@ t6863.scala:46: warning: comparing values of types Unit and Unit using `==' will
t6863.scala:59: warning: comparing values of types Unit and Unit using `==' will always yield true
assert({ () => x }.apply == ())
^
-warning: there were 4 deprecation warning(s); re-run with -deprecation for details
+warning: there were 4 deprecation warnings; re-run with -deprecation for details
diff --git a/test/files/run/t6935.check b/test/files/run/t6935.check
index 844ca54682..df1629dd7e 100644
--- a/test/files/run/t6935.check
+++ b/test/files/run/t6935.check
@@ -1 +1 @@
-warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+warning: there was one deprecation warning; re-run with -deprecation for details
diff --git a/test/files/run/t7096.scala b/test/files/run/t7096.scala
index e7a894fc23..872562dd4d 100644
--- a/test/files/run/t7096.scala
+++ b/test/files/run/t7096.scala
@@ -1,5 +1,5 @@
/*
- * filter: inliner warning\(s\); re-run with -Yinline-warnings for details
+ * filter: inliner warning; re-run with -Yinline-warnings for details
*/
import scala.tools.partest._
import scala.tools.nsc._
diff --git a/test/files/run/t7319.check b/test/files/run/t7319.check
index b7443aa0c4..2ac4142098 100644
--- a/test/files/run/t7319.check
+++ b/test/files/run/t7319.check
@@ -5,15 +5,15 @@ scala> class M[A]
defined class M
scala> implicit def ma0[A](a: A): M[A] = null
-warning: there were 1 feature warning(s); re-run with -feature for details
+warning: there was one feature warning; re-run with -feature for details
ma0: [A](a: A)M[A]
scala> implicit def ma1[A](a: A): M[A] = null
-warning: there were 1 feature warning(s); re-run with -feature for details
+warning: there was one feature warning; re-run with -feature for details
ma1: [A](a: A)M[A]
scala> def convert[F[X <: F[X]]](builder: F[_ <: F[_]]) = 0
-warning: there were 1 feature warning(s); re-run with -feature for details
+warning: there was one feature warning; re-run with -feature for details
convert: [F[X <: F[X]]](builder: F[_ <: F[_]])Int
scala> convert(Some[Int](0))
diff --git a/test/files/run/t7582.check b/test/files/run/t7582.check
index 225fb1ace8..cd951d8d4f 100644
--- a/test/files/run/t7582.check
+++ b/test/files/run/t7582.check
@@ -1,2 +1,2 @@
-warning: there were 1 inliner warning(s); re-run with -Yinline-warnings for details
+warning: there was one inliner warning; re-run with -Yinline-warnings for details
2
diff --git a/test/files/run/t7582b.check b/test/files/run/t7582b.check
index 225fb1ace8..cd951d8d4f 100644
--- a/test/files/run/t7582b.check
+++ b/test/files/run/t7582b.check
@@ -1,2 +1,2 @@
-warning: there were 1 inliner warning(s); re-run with -Yinline-warnings for details
+warning: there was one inliner warning; re-run with -Yinline-warnings for details
2
diff --git a/test/files/run/t7932.check b/test/files/run/t7932.check
index 13d64f1d3c..3f0a0c4f62 100644
--- a/test/files/run/t7932.check
+++ b/test/files/run/t7932.check
@@ -1,3 +1,3 @@
-warning: there were 1 feature warning(s); re-run with -feature for details
+warning: there was one feature warning; re-run with -feature for details
public Category<?> C.category()
public Category<scala.Tuple2> C.category1()
diff --git a/test/files/run/t8196.check b/test/files/run/t8196.check
index b32f42cf07..f021a3619f 100644
--- a/test/files/run/t8196.check
+++ b/test/files/run/t8196.check
@@ -1,7 +1,7 @@
t8196.scala:26: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
form2.g1 // comment this line in order to make the test pass
^
-warning: there were 2 feature warning(s); re-run with -feature for details
+warning: there were 2 feature warnings; re-run with -feature for details
Scope{
final private val f1: Int
}
diff --git a/test/files/run/t8549.check b/test/files/run/t8549.check
index a92ddc0e51..2e8e558f88 100644
--- a/test/files/run/t8549.check
+++ b/test/files/run/t8549.check
@@ -1 +1 @@
-warning: there were 2 deprecation warning(s); re-run with -deprecation for details
+warning: there were 2 deprecation warnings; re-run with -deprecation for details
diff --git a/test/files/run/t8611a.flags b/test/files/run/t8611a.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/run/t8611a.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/run/t8611a.scala b/test/files/run/t8611a.scala
new file mode 100644
index 0000000000..99304df762
--- /dev/null
+++ b/test/files/run/t8611a.scala
@@ -0,0 +1,16 @@
+trait K
+trait L
+
+object O {
+ type LK = K with L
+ val A: LK = new K with L
+ val B: LK = new K with L
+}
+
+object Test extends App {
+ val scrut: O.LK = O.B
+ scrut match {
+ case O.A => ???
+ case O.B => // spurious unreachable
+ }
+}
diff --git a/test/files/run/t8611b.flags b/test/files/run/t8611b.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/run/t8611b.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/run/t8611b.scala b/test/files/run/t8611b.scala
new file mode 100644
index 0000000000..2df17c9ca0
--- /dev/null
+++ b/test/files/run/t8611b.scala
@@ -0,0 +1,54 @@
+sealed trait KrafsDescription
+
+abstract class NotWorkingEnum extends Enumeration {
+
+ type ExtendedValue = Value with KrafsDescription
+
+ def Enum(inDescription: String): ExtendedValue = {
+ new Val(nextId) with KrafsDescription {
+ }
+ }
+}
+
+abstract class WorkingEnum extends Enumeration {
+
+ type ExtendedValue = Value
+
+ def Enum(inDescription: String): ExtendedValue = {
+ new Val(nextId) {
+ }
+ }
+}
+
+object NotWorkingTab extends NotWorkingEnum {
+ val a = Enum("A")
+ val b = Enum("B")
+}
+
+object WorkingTab extends WorkingEnum {
+ val a = Enum("A")
+ val b = Enum("B")
+}
+
+object Test extends App {
+ testGris()
+ testWorking()
+
+ def testGris() {
+ val pipp = NotWorkingTab.b
+ pipp match {
+ case NotWorkingTab.a => ???
+ case NotWorkingTab.b =>
+ case _ => ???
+ }
+ }
+
+ def testWorking() {
+ val stuff = WorkingTab.a
+ stuff match {
+ case WorkingTab.a =>
+ case WorkingTab.b => ???
+ case _ => ???
+ }
+ }
+}
diff --git a/test/files/run/t8611c.flags b/test/files/run/t8611c.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/run/t8611c.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/run/t8611c.scala b/test/files/run/t8611c.scala
new file mode 100644
index 0000000000..2bd17f29a5
--- /dev/null
+++ b/test/files/run/t8611c.scala
@@ -0,0 +1,21 @@
+trait K
+trait L
+
+object O {
+ type LK = K with L
+}
+
+object Test extends App {
+ local
+
+ def local = {
+ val A: O.LK = new K with L
+ val B: O.LK = new K with L
+ val scrut: O.LK = A
+ scrut match {
+ case B if "".isEmpty => ???
+ case A =>
+ case B => ???
+ }
+ }
+}
diff --git a/test/files/run/tailcalls.check b/test/files/run/tailcalls.check
index 7607921856..92d4f8a3c8 100644
--- a/test/files/run/tailcalls.check
+++ b/test/files/run/tailcalls.check
@@ -50,6 +50,10 @@ test NonTailCall.f2
test TailCall.b1 was successful
test TailCall.b2 was successful
test FancyTailCalls.tcTryLocal was successful
+test FancyTailCalls.tcInBooleanExprFirstOp was successful
+test FancyTailCalls.tcInBooleanExprSecondOp was successful
+test FancyTailCalls.tcInIfCond was successful
+test FancyTailCalls.tcInPatternGuard was successful
test FancyTailCalls.differentInstance was successful
test PolyObject.tramp was successful
#partest avian
@@ -104,5 +108,9 @@ test NonTailCall.f2
test TailCall.b1 was successful
test TailCall.b2 was successful
test FancyTailCalls.tcTryLocal was successful
+test FancyTailCalls.tcInBooleanExprFirstOp was successful
+test FancyTailCalls.tcInBooleanExprSecondOp was successful
+test FancyTailCalls.tcInIfCond was successful
+test FancyTailCalls.tcInPatternGuard was successful
test FancyTailCalls.differentInstance was successful
test PolyObject.tramp was successful
diff --git a/test/files/run/tailcalls.scala b/test/files/run/tailcalls.scala
index 1653b14de9..8df2dcfcb6 100644
--- a/test/files/run/tailcalls.scala
+++ b/test/files/run/tailcalls.scala
@@ -213,6 +213,33 @@ class FancyTailCalls {
} finally {}
}
+ def tcInBooleanExprFirstOp(x: Int, v: Int): Boolean = {
+ {
+ def loop(n: Int): Int = if (n == 0) v else loop(n - 1)
+ loop(x)
+ } == v && true
+ }
+ def tcInBooleanExprSecondOp(x: Int, v: Int): Boolean = {
+ true && {
+ def loop(n: Int): Int = if (n == 0) v else loop(n - 1)
+ loop(x)
+ } == v
+ }
+ def tcInIfCond(x: Int, v: Int): Boolean = {
+ if ({
+ def loop(n: Int): Int = if (n == 0) v else loop(n - 1)
+ loop(x)
+ } == v) true else false
+ }
+ def tcInPatternGuard(x: Int, v: Int): Boolean =
+ v match {
+ case _ if
+ {
+ def loop(n: Int): Int = if (n == 0) v else loop(n - 1)
+ loop(x) == v
+ } => true
+ }
+
import FancyTailCalls._
final def differentInstance(n: Int, v: Int): Int = {
if (n == 0) v
@@ -376,8 +403,12 @@ object Test {
check_success_b("TailCall.b2", TailCall.b2(max), true)
val FancyTailCalls = new FancyTailCalls;
- check_success("FancyTailCalls.tcTryLocal", FancyTailCalls.tcTryLocal(max, max), max)
- check_success("FancyTailCalls.differentInstance", FancyTailCalls.differentInstance(max, 42), 42)
+ check_success("FancyTailCalls.tcTryLocal", FancyTailCalls.tcTryLocal(max, max), max)
+ check_success_b("FancyTailCalls.tcInBooleanExprFirstOp", FancyTailCalls.tcInBooleanExprFirstOp(max, max), true)
+ check_success_b("FancyTailCalls.tcInBooleanExprSecondOp", FancyTailCalls.tcInBooleanExprSecondOp(max, max), true)
+ check_success_b("FancyTailCalls.tcInIfCond", FancyTailCalls.tcInIfCond(max, max), true)
+ check_success_b("FancyTailCalls.tcInPatternGuard", FancyTailCalls.tcInPatternGuard(max, max), true)
+ check_success("FancyTailCalls.differentInstance", FancyTailCalls.differentInstance(max, 42), 42)
check_success("PolyObject.tramp", PolyObject.tramp[Int](max), 0)
}
diff --git a/test/files/run/unittest_collection.check b/test/files/run/unittest_collection.check
index 844ca54682..df1629dd7e 100644
--- a/test/files/run/unittest_collection.check
+++ b/test/files/run/unittest_collection.check
@@ -1 +1 @@
-warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+warning: there was one deprecation warning; re-run with -deprecation for details
diff --git a/test/files/run/virtpatmat_typetag.check b/test/files/run/virtpatmat_typetag.check
index cac9d9a4d6..00df8b5e81 100644
--- a/test/files/run/virtpatmat_typetag.check
+++ b/test/files/run/virtpatmat_typetag.check
@@ -1,9 +1,9 @@
-1 is not a Int; it's a class java.lang.Integer
+1 is a Int
1 is a java.lang.Integer
1 is not a java.lang.String; it's a class java.lang.Integer
true is a Any
woele is a java.lang.String
-1 is not a Int; it's a class java.lang.Integer
+1 is a Int
1 is a java.lang.Integer
1 is not a java.lang.String; it's a class java.lang.Integer
true is a Any
diff --git a/test/junit/scala/reflect/internal/TypesTest.scala b/test/junit/scala/reflect/internal/TypesTest.scala
new file mode 100644
index 0000000000..95194ef0a4
--- /dev/null
+++ b/test/junit/scala/reflect/internal/TypesTest.scala
@@ -0,0 +1,35 @@
+package scala.reflect.internal
+
+import org.junit.Assert._
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import scala.tools.nsc.symtab.SymbolTableForUnitTesting
+
+@RunWith(classOf[JUnit4])
+class TypesTest {
+
+ object symbolTable extends SymbolTableForUnitTesting
+ import symbolTable._, definitions._
+
+ @Test
+ def testRefinedTypeSI8611(): Unit = {
+ def stringNarrowed = StringTpe.narrow
+ assert(stringNarrowed != stringNarrowed)
+ assert(!(stringNarrowed =:= stringNarrowed))
+
+ def boolWithString = refinedType(BooleanTpe :: StringTpe :: Nil, NoSymbol)
+ assert(boolWithString != boolWithString)
+ assert(boolWithString =:= boolWithString)
+
+ val boolWithString1 = boolWithString
+ val boolWithString1narrow1 = boolWithString1.narrow
+ val boolWithString1narrow2 = boolWithString1.narrow
+ // Two narrowings of the same refinement end up =:=. This was the root
+ // cause of SI-8611. See `narrowUniquely` in `Logic` for the workaround.
+ assert(boolWithString1narrow1 =:= boolWithString1narrow2)
+ val uniquelyNarrowed1 = refinedType(boolWithString1narrow1 :: Nil, NoSymbol)
+ val uniquelyNarrowed2 = refinedType(boolWithString1narrow2 :: Nil, NoSymbol)
+ assert(uniquelyNarrowed1 =:= uniquelyNarrowed2)
+ }
+}
diff --git a/test/scaladoc/run/t8672.check b/test/scaladoc/run/t8672.check
new file mode 100644
index 0000000000..d7194c73bf
--- /dev/null
+++ b/test/scaladoc/run/t8672.check
@@ -0,0 +1,4 @@
+Some(Chain(List(Text(New in release 1.2.3.4, it works), Text(.))))
+Some(Text(Sentence no period))
+Some(Chain(List(Text(Sentence period at end), Text(.))))
+Done.
diff --git a/test/scaladoc/run/t8672.scala b/test/scaladoc/run/t8672.scala
new file mode 100644
index 0000000000..8a9b5086bd
--- /dev/null
+++ b/test/scaladoc/run/t8672.scala
@@ -0,0 +1,32 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+ override def code = """
+ class C {
+
+ /**
+ * New in release 1.2.3.4, it works. Next sentence.
+ * Next Line.
+ */
+ def method1 = 0
+
+ /** Sentence no period */
+ def method2 = 0
+
+ /** Sentence period at end.*/
+ def method3 = 0
+ }
+ """
+
+ def scaladocSettings = ""
+
+ def testModel(root: Package) = {
+ import access._
+ val ms = List("method1", "method2", "method3")
+ for (m <- ms) {
+ val method = root._class("C")._method(m)
+ println(method.comment.get.body.summary)
+ }
+ }
+}