summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bincompat-forward.whitelist.conf9
-rw-r--r--src/compiler/scala/tools/nsc/ScriptRunner.scala12
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Scanners.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala8
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Checkable.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala14
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala3
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Tags.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/TypersTracking.scala2
-rwxr-xr-xsrc/compiler/scala/tools/nsc/util/DocStrings.scala4
-rw-r--r--src/library/scala/Predef.scala2
-rw-r--r--src/library/scala/collection/immutable/HashSet.scala7
-rw-r--r--src/library/scala/collection/immutable/ListSet.scala7
-rw-r--r--src/library/scala/collection/immutable/Set.scala16
-rw-r--r--src/library/scala/sys/process/package.scala3
-rw-r--r--src/library/scala/util/control/Exception.scala2
-rw-r--r--src/repl/scala/tools/nsc/interpreter/IMain.scala3
-rw-r--r--src/repl/scala/tools/nsc/interpreter/Imports.scala31
-rw-r--r--test/files/jvm/interpreter.check6
-rw-r--r--test/files/run/constrained-types.check8
-rw-r--r--test/files/run/kind-repl-command.check2
-rw-r--r--test/files/run/reify-repl-fail-gracefully.check2
-rw-r--r--test/files/run/reify_newimpl_22.check2
-rw-r--r--test/files/run/reify_newimpl_23.check2
-rw-r--r--test/files/run/reify_newimpl_25.check2
-rw-r--r--test/files/run/reify_newimpl_26.check2
-rw-r--r--test/files/run/repl-bare-expr.check12
-rw-r--r--test/files/run/repl-parens.check12
-rw-r--r--test/files/run/repl-paste-2.check2
-rw-r--r--test/files/run/repl-reset.check8
-rw-r--r--test/files/run/repl-trim-stack-trace.scala6
-rw-r--r--test/files/run/t1931.scala43
-rw-r--r--test/files/run/t4542.check2
-rw-r--r--test/files/run/t4594-repl-settings.scala2
-rw-r--r--test/files/run/t5655.check4
-rw-r--r--test/files/run/t7319.check6
-rw-r--r--test/files/run/t7747-repl.check32
-rw-r--r--test/files/run/t8346.check6
-rw-r--r--test/files/run/t8346.scala34
-rw-r--r--test/files/run/t9170.scala24
-rw-r--r--test/files/run/t9206.scala4
-rw-r--r--test/files/run/t9425.scala8
-rw-r--r--test/files/run/xMigration.check6
46 files changed, 198 insertions, 176 deletions
diff --git a/bincompat-forward.whitelist.conf b/bincompat-forward.whitelist.conf
index 552c0d85f5..2d32e3e9da 100644
--- a/bincompat-forward.whitelist.conf
+++ b/bincompat-forward.whitelist.conf
@@ -469,6 +469,15 @@ filter {
{
matchName="scala.util.Sorting.scala$util$Sorting$$booleanSort"
problemName=MissingMethodProblem
+ },
+ // SI-8362: AbstractPromise extends AtomicReference
+ // It's ok to change a package-protected class in an impl package,
+ // even though it's not clear why it changed -- bug in generic signature generation?
+ // -public class scala.concurrent.impl.Promise$DefaultPromise<T> extends scala.concurrent.impl.AbstractPromise implements scala.concurrent.impl.Promise<T>
+ // +public class scala.concurrent.impl.Promise$DefaultPromise<T extends java.lang.Object> extends scala.concurrent.impl.AbstractPromise implements scala.concurrent.impl.Promise<T>
+ {
+ matchName="scala.concurrent.impl.Promise$DefaultPromise"
+ problemName=MissingTypesProblem
}
]
}
diff --git a/src/compiler/scala/tools/nsc/ScriptRunner.scala b/src/compiler/scala/tools/nsc/ScriptRunner.scala
index 6d24b31531..bf93ad30bc 100644
--- a/src/compiler/scala/tools/nsc/ScriptRunner.scala
+++ b/src/compiler/scala/tools/nsc/ScriptRunner.scala
@@ -16,16 +16,16 @@ import util.Exceptional.unwrap
/** An object that runs Scala code in script files.
*
- * <p>For example, here is a complete Scala script on Unix:</pre>
- * <pre>
+ * For example, here is a complete Scala script on Unix:
+ * {{{
* #!/bin/sh
* exec scala "$0" "$@"
* !#
* Console.println("Hello, world!")
* args.toList foreach Console.println
- * </pre>
- * <p>And here is a batch file example on Windows XP:</p>
- * <pre>
+ * }}}
+ * And here is a batch file example on Windows XP:
+ * {{{
* ::#!
* @echo off
* call scala %0 %*
@@ -33,7 +33,7 @@ import util.Exceptional.unwrap
* ::!#
* Console.println("Hello, world!")
* args.toList foreach Console.println
- * </pre>
+ * }}}
*
* @author Lex Spoon
* @version 1.0, 15/05/2006
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
index 92833d647b..cd41c75298 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
@@ -226,7 +226,7 @@ trait Scanners extends ScannersCommon {
* RPAREN if region starts with '('
* RBRACKET if region starts with '['
* RBRACE if region starts with '{'
- * ARROW if region starts with `case'
+ * ARROW if region starts with 'case'
* STRINGLIT if region is a string interpolation expression starting with '${'
* (the STRINGLIT appears twice in succession on the stack iff the
* expression is a multiline string literal).
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
index 7096f16d75..7153c09377 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
@@ -492,8 +492,8 @@ abstract class GenASM extends SubComponent with BytecodeWriters { self =>
* generic classes or interfaces.
*
* @param superName the internal of name of the super class. For interfaces,
- * the super class is {@link Object}. May be <tt>null</tt>, but
- * only for the {@link Object} class.
+ * the super class is [[Object]]. May be <tt>null</tt>, but
+ * only for the [[Object]] class.
*
* @param interfaces the internal names of the class's interfaces (see
* {@link Type#getInternalName() getInternalName}). May be
@@ -529,6 +529,10 @@ abstract class GenASM extends SubComponent with BytecodeWriters { self =>
case e: java.lang.RuntimeException if e.getMessage != null && (e.getMessage contains "too large!") =>
reporter.error(sym.pos,
s"Could not write class $jclassName because it exceeds JVM code size limits. ${e.getMessage}")
+ case e: java.io.IOException if e.getMessage != null && (e.getMessage contains "File name too long") =>
+ reporter.error(sym.pos, e.getMessage + "\n" +
+ "This can happen on some encrypted or legacy file systems. Please see SI-3623 for more details.")
+
}
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Checkable.scala b/src/compiler/scala/tools/nsc/typechecker/Checkable.scala
index 8bcd5e6f12..2b6a4c763a 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Checkable.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Checkable.scala
@@ -44,7 +44,7 @@ import scala.language.postfixOps
* which is essentially the intersection of X and |P|, where |P| is
* the erasure of P. If XR <: P, then no warning is emitted.
*
- * We evaluate "X with conform to P" by checking `X <: P_wild, where
+ * We evaluate "X with conform to P" by checking `X <: P_wild`, where
* P_wild is the result of substituting wildcard types in place of
* pattern type variables. This is intentionally stricter than
* (X matchesPattern P), see SI-8597 for motivating test cases.
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index 196b137a3e..73e454bf47 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -110,10 +110,10 @@ trait Implicits {
* Ignore their constr field! The list of type constraints returned along with each tree specifies the constraints that
* must be met by the corresponding type parameter in `tpars` (for the returned implicit view to be valid).
*
- * @arg tp from-type for the implicit conversion
- * @arg context search implicits here
- * @arg tpars symbols that should be considered free type variables
- * (implicit search should not try to solve them, just track their constraints)
+ * @param tp from-type for the implicit conversion
+ * @param context search implicits here
+ * @param tpars symbols that should be considered free type variables
+ * (implicit search should not try to solve them, just track their constraints)
*/
def allViewsFrom(tp: Type, context: Context, tpars: List[Symbol]): List[(SearchResult, List[TypeConstraint])] = {
// my untouchable typevars are better than yours (they can't be constrained by them)
@@ -324,8 +324,10 @@ trait Implicits {
*/
class ImplicitSearch(tree: Tree, pt: Type, isView: Boolean, context0: Context, pos0: Position = NoPosition) extends Typer(context0) with ImplicitsContextErrors {
val searchId = implicitSearchId()
- private def typingLog(what: String, msg: => String) =
- typingStack.printTyping(tree, f"[search #$searchId] $what $msg")
+ private def typingLog(what: String, msg: => String) = {
+ if (printingOk(tree))
+ typingStack.printTyping(f"[search #$searchId] $what $msg")
+ }
import infer._
if (Statistics.canEnable) Statistics.incCounter(implicitSearchCount)
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index bf705e89ad..a5fdbb5148 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -1375,7 +1375,7 @@ trait Infer extends Checkable {
* Otherwise, if there is no best alternative, error.
*
* @param argtpes0 contains the argument types. If an argument is named, as
- * "a = 3", the corresponding type is `NamedType("a", Int)'. If the name
+ * "a = 3", the corresponding type is `NamedType("a", Int)`. If the name
* of some NamedType does not exist in an alternative's parameter names,
* the type is replaces by `Unit`, i.e. the argument is treated as an
* assignment expression.
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index 0198529ef7..90ac1f466d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -1511,7 +1511,8 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans
sym.isSourceMethod &&
sym.isCase &&
sym.name == nme.apply &&
- isClassTypeAccessible(tree)
+ isClassTypeAccessible(tree) &&
+ !tree.tpe.resultType.typeSymbol.primaryConstructor.isLessAccessibleThan(tree.symbol)
if (doTransform) {
tree foreach {
diff --git a/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala b/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala
index ea44b9dc39..92b0719ba3 100644
--- a/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala
@@ -132,7 +132,7 @@ trait StdAttachments {
/** Marks the tree as a macro impl reference, which is a naked reference to a method.
*
* This is necessary for typechecking macro impl references (see `DefaultMacroCompiler.defaultResolveMacroImpl`),
- * because otherwise typing a naked reference will result in the "follow this method with `_' if you want to
+ * because otherwise typing a naked reference will result in the "follow this method with `_` if you want to
* treat it as a partially applied function" errors.
*
* This mark suppresses adapt except for when the annottee is a macro application.
diff --git a/src/compiler/scala/tools/nsc/typechecker/Tags.scala b/src/compiler/scala/tools/nsc/typechecker/Tags.scala
index 57dc74d2a0..56127f4026 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Tags.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Tags.scala
@@ -36,7 +36,7 @@ trait Tags {
* @param allowMaterialization If true (default) then the resolver is allowed to launch materialization macros when there's no class tag in scope.
* If false then materialization macros are prohibited from running.
*
- * @returns Tree that represents an `scala.reflect.ClassTag` for `tp` if everything is okay.
+ * @return Tree that represents an `scala.reflect.ClassTag` for `tp` if everything is okay.
* EmptyTree if the result contains unresolved (i.e. not spliced) type parameters and abstract type members.
* EmptyTree if `allowMaterialization` is false, and there is no class tag in scope.
*/
@@ -57,7 +57,7 @@ trait Tags {
* @param allowMaterialization If true (default) then the resolver is allowed to launch materialization macros when there's no type tag in scope.
* If false then materialization macros are prohibited from running.
*
- * @returns Tree that represents a `scala.reflect.TypeTag` for `tp` if everything is okay.
+ * @return Tree that represents a `scala.reflect.TypeTag` for `tp` if everything is okay.
* EmptyTree if `concrete` is true and the result contains unresolved (i.e. not spliced) type parameters and abstract type members.
* EmptyTree if `allowMaterialization` is false, and there is no array tag in scope.
*/
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index cc15a2485f..8228adc20e 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2714,7 +2714,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
*
* If 'T' is not fully defined, it is inferred by type checking
* `apply$body` without a result type before type checking the block.
- * The method's inferred result type is used instead of T`. [See test/files/pos/sammy_poly.scala]
+ * The method's inferred result type is used instead of `T`. [See test/files/pos/sammy_poly.scala]
*
* The `apply` method is identified by the argument `sam`; `S` corresponds to the argument `samClassTp`,
* and `resPt` is derived from `samClassTp` -- it may be fully defined, or not...
diff --git a/src/compiler/scala/tools/nsc/typechecker/TypersTracking.scala b/src/compiler/scala/tools/nsc/typechecker/TypersTracking.scala
index 550fd4e68d..37fbb73b85 100644
--- a/src/compiler/scala/tools/nsc/typechecker/TypersTracking.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/TypersTracking.scala
@@ -159,7 +159,7 @@ trait TypersTracking {
// Some trees which are typed with mind-numbing frequency and
// which add nothing by being printed. Did () type to Unit? Let's
// gamble on yes.
- private def printingOk(t: Tree) = printTypings && (settings.debug.value || !noPrint(t))
+ def printingOk(t: Tree) = printTypings && (settings.debug.value || !noPrint(t))
def noPrintTyping(t: Tree) = (t.tpe ne null) || !printingOk(t)
def noPrintAdapt(tree1: Tree, tree2: Tree) = !printingOk(tree1) || (
(tree1.tpe == tree2.tpe)
diff --git a/src/compiler/scala/tools/nsc/util/DocStrings.scala b/src/compiler/scala/tools/nsc/util/DocStrings.scala
index 4ff7067a21..501546b8f6 100755
--- a/src/compiler/scala/tools/nsc/util/DocStrings.scala
+++ b/src/compiler/scala/tools/nsc/util/DocStrings.scala
@@ -37,7 +37,7 @@ object DocStrings {
/** Returns index of string `str` after `start` skipping longest
* sequence of space and tab characters, possibly also containing
* a single `*` character or the `/``**` sequence.
- * @pre start == str.length || str(start) == `\n'
+ * @pre start == str.length || str(start) == `\n`
*/
def skipLineLead(str: String, start: Int): Int =
if (start == str.length) start
@@ -49,7 +49,7 @@ object DocStrings {
else idx
}
- /** Skips to next occurrence of `\n' or to the position after the `/``**` sequence following index `start`.
+ /** Skips to next occurrence of `\n` or to the position after the `/``**` sequence following index `start`.
*/
def skipToEol(str: String, start: Int): Int =
if (start + 2 < str.length && (str charAt start) == '/' && (str charAt (start + 1)) == '*' && (str charAt (start + 2)) == '*') start + 3
diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala
index fa58015a84..334377e838 100644
--- a/src/library/scala/Predef.scala
+++ b/src/library/scala/Predef.scala
@@ -56,7 +56,7 @@ import scala.io.StdIn
* only contain natural numbers (i.e. non-negative), and that the result returned
* will also be natural. `require` is distinct from `assert` in that if the
* condition fails, then the caller of the function is to blame rather than a
- * logical error having been made within `addNaturals` itself. `ensures` is a
+ * logical error having been made within `addNaturals` itself. `ensuring` is a
* form of `assert` that declares the guarantee the function is providing with
* regards to its return value.
*
diff --git a/src/library/scala/collection/immutable/HashSet.scala b/src/library/scala/collection/immutable/HashSet.scala
index 49b4397cf2..6b71c0fa66 100644
--- a/src/library/scala/collection/immutable/HashSet.scala
+++ b/src/library/scala/collection/immutable/HashSet.scala
@@ -162,13 +162,6 @@ class HashSet[A] extends AbstractSet[A]
def - (e: A): HashSet[A] =
nullToEmpty(removed0(e, computeHash(e), 0))
- /** Returns this $coll as an immutable set.
- *
- * A new set will not be built; lazy collections will stay lazy.
- */
- @deprecatedOverriding("Immutable sets should do nothing on toSet but return themselves cast as a Set.", "2.11.0")
- override def toSet[B >: A]: Set[B] = this.asInstanceOf[Set[B]]
-
override def filter(p: A => Boolean) = {
val buffer = new Array[HashSet[A]](bufferSize(size))
nullToEmpty(filter0(p, false, 0, buffer, 0))
diff --git a/src/library/scala/collection/immutable/ListSet.scala b/src/library/scala/collection/immutable/ListSet.scala
index a6e6fba0a5..2e17677359 100644
--- a/src/library/scala/collection/immutable/ListSet.scala
+++ b/src/library/scala/collection/immutable/ListSet.scala
@@ -138,13 +138,6 @@ class ListSet[A] extends AbstractSet[A]
override def stringPrefix = "ListSet"
- /** Returns this $coll as an immutable set.
- *
- * A new set will not be built; lazy collections will stay lazy.
- */
- @deprecatedOverriding("Immutable sets should do nothing on toSet but return themselves cast as a Set.", "2.11.0")
- override def toSet[B >: A]: Set[B] = this.asInstanceOf[Set[B]]
-
/** Represents an entry in the `ListSet`.
*/
protected class Node(override val head: A) extends ListSet[A] with Serializable {
diff --git a/src/library/scala/collection/immutable/Set.scala b/src/library/scala/collection/immutable/Set.scala
index 7725ad9ee3..0fbf7942d4 100644
--- a/src/library/scala/collection/immutable/Set.scala
+++ b/src/library/scala/collection/immutable/Set.scala
@@ -35,7 +35,12 @@ trait Set[A] extends Iterable[A]
override def companion: GenericCompanion[Set] = Set
- override def toSet[B >: A]: Set[B] = to[({type l[a] = immutable.Set[B]})#l] // for bincompat; remove in dev
+ /** Returns this $coll as an immutable map.
+ *
+ * A new map will not be built; lazy collections will stay lazy.
+ */
+ @deprecatedOverriding("Immutable sets should do nothing on toSet but return themselves cast as a Set.", "2.11.0")
+ override def toSet[B >: A]: Set[B] = this.asInstanceOf[Set[B]]
override def seq: Set[A] = this
protected override def parCombiner = ParSet.newCombiner[A] // if `immutable.SetLike` gets introduced, please move this there!
@@ -57,7 +62,6 @@ object Set extends ImmutableSetFactory[Set] {
def - (elem: Any): Set[Any] = this
def iterator: Iterator[Any] = Iterator.empty
override def foreach[U](f: Any => U): Unit = {}
- override def toSet[B >: Any]: Set[B] = this.asInstanceOf[Set[B]]
}
private[collection] def emptyInstance: Set[Any] = EmptySet
@@ -88,8 +92,6 @@ object Set extends ImmutableSetFactory[Set] {
if (f(elem1)) Some(elem1)
else None
}
- @deprecatedOverriding("Immutable sets should do nothing on toSet but return themselves cast as a Set.", "2.11.0")
- override def toSet[B >: A]: Set[B] = this.asInstanceOf[Set[B]]
}
/** An optimized representation for immutable sets of size 2 */
@@ -121,8 +123,6 @@ object Set extends ImmutableSetFactory[Set] {
else if (f(elem2)) Some(elem2)
else None
}
- @deprecatedOverriding("Immutable sets should do nothing on toSet but return themselves cast as a Set.", "2.11.0")
- override def toSet[B >: A]: Set[B] = this.asInstanceOf[Set[B]]
}
/** An optimized representation for immutable sets of size 3 */
@@ -156,8 +156,6 @@ object Set extends ImmutableSetFactory[Set] {
else if (f(elem3)) Some(elem3)
else None
}
- @deprecatedOverriding("Immutable sets should do nothing on toSet but return themselves cast as a Set.", "2.11.0")
- override def toSet[B >: A]: Set[B] = this.asInstanceOf[Set[B]]
}
/** An optimized representation for immutable sets of size 4 */
@@ -193,8 +191,6 @@ object Set extends ImmutableSetFactory[Set] {
else if (f(elem4)) Some(elem4)
else None
}
- @deprecatedOverriding("Immutable sets should do nothing on toSet but return themselves cast as a Set.", "2.11.0")
- override def toSet[B >: A]: Set[B] = this.asInstanceOf[Set[B]]
}
}
diff --git a/src/library/scala/sys/process/package.scala b/src/library/scala/sys/process/package.scala
index 5ec2e73cb9..0e9a1bfc56 100644
--- a/src/library/scala/sys/process/package.scala
+++ b/src/library/scala/sys/process/package.scala
@@ -157,7 +157,8 @@ package scala.sys {
* while(input.read() != -1) count += 1
* input.close()
* }
- * cat ! new ProcessIO(_.close(), byteCounter, _.close())
+ * val p = cat run new ProcessIO(_.close(), byteCounter, _.close())
+ * p.exitValue()
* count
* }
*
diff --git a/src/library/scala/util/control/Exception.scala b/src/library/scala/util/control/Exception.scala
index aa30887ba0..24c297a2fc 100644
--- a/src/library/scala/util/control/Exception.scala
+++ b/src/library/scala/util/control/Exception.scala
@@ -105,7 +105,7 @@ object Exception {
case x if rethrow(x) => throw x
case x if pf isDefinedAt x => pf(x)
}
- finally fin map (_.invoke())
+ finally fin foreach (_.invoke())
/* Create an empty Try container with this Catch and the supplied `Finally`. */
def andFinally(body: => Unit): Catch[T] = fin match {
diff --git a/src/repl/scala/tools/nsc/interpreter/IMain.scala b/src/repl/scala/tools/nsc/interpreter/IMain.scala
index 841b4abfa5..06ae179da9 100644
--- a/src/repl/scala/tools/nsc/interpreter/IMain.scala
+++ b/src/repl/scala/tools/nsc/interpreter/IMain.scala
@@ -888,7 +888,7 @@ class IMain(@BeanProperty val factory: ScriptEngineFactory, initialSettings: Set
/** Code to import bound names from previous lines - accessPath is code to
* append to objectName to access anything bound by request.
*/
- lazy val ComputedImports(importsPreamble, importsTrailer, accessPath) =
+ lazy val ComputedImports(headerPreamble, importsPreamble, importsTrailer, accessPath) =
exitingTyper(importsCode(referencedNames.toSet, ObjectSourceCode, definesClass))
/** the line of code to compute */
@@ -908,6 +908,7 @@ class IMain(@BeanProperty val factory: ScriptEngineFactory, initialSettings: Set
else List("def %s = %s".format("$line", tquoted(originalLine)), "def %s = Nil".format("$trees"))
}
def preamble = s"""
+ |$headerPreamble
|${preambleHeader format lineRep.readName}
|${envLines mkString (" ", ";\n ", ";\n")}
|$importsPreamble
diff --git a/src/repl/scala/tools/nsc/interpreter/Imports.scala b/src/repl/scala/tools/nsc/interpreter/Imports.scala
index 3ec77e46f1..5b231d94b6 100644
--- a/src/repl/scala/tools/nsc/interpreter/Imports.scala
+++ b/src/repl/scala/tools/nsc/interpreter/Imports.scala
@@ -70,7 +70,10 @@ trait Imports {
/** Compute imports that allow definitions from previous
* requests to be visible in a new request. Returns
- * three pieces of related code:
+ * three or four pieces of related code:
+ *
+ * 0. Header code fragment that should go at the beginning
+ * of the compilation unit, specifically, import Predef.
*
* 1. An initial code fragment that should go before
* the code of the new request.
@@ -91,30 +94,34 @@ trait Imports {
* (3) It imports multiple same-named implicits, but only the
* last one imported is actually usable.
*/
- case class ComputedImports(prepend: String, append: String, access: String)
+ case class ComputedImports(header: String, prepend: String, append: String, access: String)
protected def importsCode(wanted: Set[Name], wrapper: Request#Wrapper, definesClass: Boolean): ComputedImports = {
+ val header, code, trailingBraces, accessPath = new StringBuilder
+ val currentImps = mutable.HashSet[Name]()
+ var predefEscapes = false // only emit predef import header if name not resolved in history, loosely
+
/** Narrow down the list of requests from which imports
* should be taken. Removes requests which cannot contribute
* useful imports for the specified set of wanted names.
*/
- case class ReqAndHandler(req: Request, handler: MemberHandler) { }
+ case class ReqAndHandler(req: Request, handler: MemberHandler)
def reqsToUse: List[ReqAndHandler] = {
/** Loop through a list of MemberHandlers and select which ones to keep.
- * 'wanted' is the set of names that need to be imported.
+ * 'wanted' is the set of names that need to be imported.
*/
def select(reqs: List[ReqAndHandler], wanted: Set[Name]): List[ReqAndHandler] = {
// Single symbol imports might be implicits! See bug #1752. Rather than
// try to finesse this, we will mimic all imports for now.
def keepHandler(handler: MemberHandler) = handler match {
- /* While defining classes in class based mode - implicits are not needed. */
+ // While defining classes in class based mode - implicits are not needed.
case h: ImportHandler if isClassBased && definesClass => h.importedNames.exists(x => wanted.contains(x))
case _: ImportHandler => true
case x => x.definesImplicit || (x.definedNames exists wanted)
}
reqs match {
- case Nil => Nil
+ case Nil => predefEscapes = wanted contains PredefModule.name ; Nil
case rh :: rest if !keepHandler(rh.handler) => select(rest, wanted)
case rh :: rest =>
import rh.handler._
@@ -127,9 +134,6 @@ trait Imports {
select(allReqAndHandlers reverseMap { case (r, h) => ReqAndHandler(r, h) }, wanted).reverse
}
- val code, trailingBraces, accessPath = new StringBuilder
- val currentImps = mutable.HashSet[Name]()
-
// add code for a new object to hold some imports
def addWrapper() {
import nme.{ INTERPRETER_IMPORT_WRAPPER => iw }
@@ -146,6 +150,9 @@ trait Imports {
try op finally addWrapper()
}
+ // imports from Predef are relocated to the template header to allow hiding.
+ def checkHeader(h: ImportHandler) = h.referencedNames contains PredefModule.name
+
// loop through previous requests, adding imports for each one
wrapBeforeAndAfter {
// Reusing a single temporary value when import from a line with multiple definitions.
@@ -153,6 +160,9 @@ trait Imports {
for (ReqAndHandler(req, handler) <- reqsToUse) {
val objName = req.lineRep.readPathInstance
handler match {
+ case h: ImportHandler if checkHeader(h) =>
+ header.clear()
+ header append f"${h.member}%n"
// If the user entered an import, then just use it; add an import wrapping
// level if the import might conflict with some other import
case x: ImportHandler if x.importsWildcard =>
@@ -194,7 +204,8 @@ trait Imports {
}
}
- ComputedImports(code.toString, trailingBraces.toString, accessPath.toString)
+ val computedHeader = if (predefEscapes) header.toString else ""
+ ComputedImports(computedHeader, code.toString, trailingBraces.toString, accessPath.toString)
}
private def allReqAndHandlers =
diff --git a/test/files/jvm/interpreter.check b/test/files/jvm/interpreter.check
index 08372685d6..ce3c8062d7 100644
--- a/test/files/jvm/interpreter.check
+++ b/test/files/jvm/interpreter.check
@@ -30,7 +30,7 @@ scala> val four: anotherint = 4
four: anotherint = 4
scala> val bogus: anotherint = "hello"
-<console>:11: error: type mismatch;
+<console>:12: error: type mismatch;
found : String("hello")
required: anotherint
(which expands to) Int
@@ -353,7 +353,7 @@ defined class Term
scala> def f(e: Exp) = e match { // non-exhaustive warning here
case _:Fact => 3
}
-<console>:21: warning: match may not be exhaustive.
+<console>:22: warning: match may not be exhaustive.
It would fail on the following inputs: Exp(), Term()
def f(e: Exp) = e match { // non-exhaustive warning here
^
@@ -363,6 +363,6 @@ scala> :quit
plusOne: (x: Int)Int
res0: Int = 6
res0: String = after reset
-<console>:11: error: not found: value plusOne
+<console>:12: error: not found: value plusOne
plusOne(5) // should be undefined now
^
diff --git a/test/files/run/constrained-types.check b/test/files/run/constrained-types.check
index 670d6f49aa..5444cf2088 100644
--- a/test/files/run/constrained-types.check
+++ b/test/files/run/constrained-types.check
@@ -133,16 +133,16 @@ y: String = hello
scala>
scala> val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message
-<console>:11: error: not found: value e
+<console>:12: error: not found: value e
val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message
^
-<console>:11: error: not found: value f
+<console>:12: error: not found: value f
val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message
^
-<console>:11: error: not found: value g
+<console>:12: error: not found: value g
val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message
^
-<console>:11: error: not found: value h
+<console>:12: error: not found: value h
val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message
^
diff --git a/test/files/run/kind-repl-command.check b/test/files/run/kind-repl-command.check
index e050fb4bc1..560529ba03 100644
--- a/test/files/run/kind-repl-command.check
+++ b/test/files/run/kind-repl-command.check
@@ -19,7 +19,7 @@ scala> :k new { def empty = false }
AnyRef{def empty: Boolean}'s kind is A
scala> :k Nonexisting
-<console>:11: error: not found: value Nonexisting
+<console>:12: error: not found: value Nonexisting
Nonexisting
^
diff --git a/test/files/run/reify-repl-fail-gracefully.check b/test/files/run/reify-repl-fail-gracefully.check
index 025d377a43..32ed876356 100644
--- a/test/files/run/reify-repl-fail-gracefully.check
+++ b/test/files/run/reify-repl-fail-gracefully.check
@@ -8,7 +8,7 @@ import scala.reflect.runtime.universe._
scala>
scala> reify
-<console>:15: error: too few argument lists for macro invocation
+<console>:16: error: too few argument lists for macro invocation
reify
^
diff --git a/test/files/run/reify_newimpl_22.check b/test/files/run/reify_newimpl_22.check
index e69dc60199..985f646579 100644
--- a/test/files/run/reify_newimpl_22.check
+++ b/test/files/run/reify_newimpl_22.check
@@ -15,7 +15,7 @@ scala> {
}
println(code.eval)
}
-<console>:18: free term: Ident(TermName("x")) defined by res0 in <console>:17:14
+<console>:19: free term: Ident(TermName("x")) defined by res0 in <console>:18:14
val code = reify {
^
2
diff --git a/test/files/run/reify_newimpl_23.check b/test/files/run/reify_newimpl_23.check
index 1356d509d3..f60113c69f 100644
--- a/test/files/run/reify_newimpl_23.check
+++ b/test/files/run/reify_newimpl_23.check
@@ -14,7 +14,7 @@ scala> def foo[T]{
}
println(code.eval)
}
-<console>:16: free type: Ident(TypeName("T")) defined by foo in <console>:15:16
+<console>:17: free type: Ident(TypeName("T")) defined by foo in <console>:16:16
val code = reify {
^
foo: [T]=> Unit
diff --git a/test/files/run/reify_newimpl_25.check b/test/files/run/reify_newimpl_25.check
index e512cfc52e..9104d8df0b 100644
--- a/test/files/run/reify_newimpl_25.check
+++ b/test/files/run/reify_newimpl_25.check
@@ -5,7 +5,7 @@ scala> {
val tt = implicitly[TypeTag[x.type]]
println(tt)
}
-<console>:14: free term: Ident(TermName("x")) defined by res0 in <console>:13:14
+<console>:15: free term: Ident(TermName("x")) defined by res0 in <console>:14:14
val tt = implicitly[TypeTag[x.type]]
^
TypeTag[x.type]
diff --git a/test/files/run/reify_newimpl_26.check b/test/files/run/reify_newimpl_26.check
index b203389db1..cbb21854ba 100644
--- a/test/files/run/reify_newimpl_26.check
+++ b/test/files/run/reify_newimpl_26.check
@@ -4,7 +4,7 @@ scala> def foo[T]{
val tt = implicitly[WeakTypeTag[List[T]]]
println(tt)
}
-<console>:12: free type: Ident(TypeName("T")) defined by foo in <console>:10:16
+<console>:13: free type: Ident(TypeName("T")) defined by foo in <console>:11:16
val tt = implicitly[WeakTypeTag[List[T]]]
^
foo: [T]=> Unit
diff --git a/test/files/run/repl-bare-expr.check b/test/files/run/repl-bare-expr.check
index f0c488455f..e0a1f4ecd6 100644
--- a/test/files/run/repl-bare-expr.check
+++ b/test/files/run/repl-bare-expr.check
@@ -1,12 +1,12 @@
scala> 2 ; 3
-<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
2 ;;
^
res0: Int = 3
scala> { 2 ; 3 }
-<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:12: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
{ 2 ; 3 }
^
res1: Int = 3
@@ -15,16 +15,16 @@ scala> 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Mooo
1 +
2 +
3 } ; bippy+88+11
-<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
^
-<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
^
-<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
^
-<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
^
defined object Cow
diff --git a/test/files/run/repl-parens.check b/test/files/run/repl-parens.check
index 35853f10da..6516f4ea90 100644
--- a/test/files/run/repl-parens.check
+++ b/test/files/run/repl-parens.check
@@ -18,10 +18,10 @@ scala> ( (2 + 2 ) )
res5: Int = 4
scala> 5 ; ( (2 + 2 ) ) ; ((5))
-<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
5 ; ( (2 + 2 ) ) ;;
^
-<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
5 ; ( (2 + 2 ) ) ;;
^
res6: Int = 5
@@ -38,16 +38,16 @@ res9: String = 4423
scala>
scala> 55 ; ((2 + 2)) ; (1, 2, 3)
-<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
55 ; ((2 + 2)) ;;
^
-<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
55 ; ((2 + 2)) ;;
^
res10: (Int, Int, Int) = (1,2,3)
scala> 55 ; (x: Int) => x + 1 ; () => ((5))
-<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
55 ; (x: Int) => x + 1 ;;
^
res11: () => Int = <function0>
@@ -58,7 +58,7 @@ scala> () => 5
res12: () => Int = <function0>
scala> 55 ; () => 5
-<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
55 ;;
^
res13: () => Int = <function0>
diff --git a/test/files/run/repl-paste-2.check b/test/files/run/repl-paste-2.check
index 5b6a84144d..dbf5363c0f 100644
--- a/test/files/run/repl-paste-2.check
+++ b/test/files/run/repl-paste-2.check
@@ -42,7 +42,7 @@ scala> res5 + res6
res1: Int = 690
scala> val x = dingus
-<console>:10: error: not found: value dingus
+<console>:11: error: not found: value dingus
val x = dingus
^
diff --git a/test/files/run/repl-reset.check b/test/files/run/repl-reset.check
index b0683fff79..cf4d9a149e 100644
--- a/test/files/run/repl-reset.check
+++ b/test/files/run/repl-reset.check
@@ -28,13 +28,13 @@ Forgetting all expression results and named terms: $intp, BippyBungus, x1, x2, x
Forgetting defined types: BippyBungus
scala> x1 + x2 + x3
-<console>:11: error: not found: value x1
+<console>:12: error: not found: value x1
x1 + x2 + x3
^
-<console>:11: error: not found: value x2
+<console>:12: error: not found: value x2
x1 + x2 + x3
^
-<console>:11: error: not found: value x3
+<console>:12: error: not found: value x3
x1 + x2 + x3
^
@@ -42,7 +42,7 @@ scala> val x1 = 4
x1: Int = 4
scala> new BippyBungus
-<console>:11: error: not found: type BippyBungus
+<console>:12: error: not found: type BippyBungus
new BippyBungus
^
diff --git a/test/files/run/repl-trim-stack-trace.scala b/test/files/run/repl-trim-stack-trace.scala
index ea91e32239..c0814905f9 100644
--- a/test/files/run/repl-trim-stack-trace.scala
+++ b/test/files/run/repl-trim-stack-trace.scala
@@ -12,7 +12,7 @@ f: Nothing
scala> f
java.lang.Exception: Uh-oh
- at .f(<console>:10)
+ at .f(<console>:11)
... 69 elided
scala> def f = throw new Exception("")
@@ -20,7 +20,7 @@ f: Nothing
scala> f
java.lang.Exception:
- at .f(<console>:10)
+ at .f(<console>:11)
... 69 elided
scala> def f = throw new Exception
@@ -28,7 +28,7 @@ f: Nothing
scala> f
java.lang.Exception
- at .f(<console>:10)
+ at .f(<console>:11)
... 69 elided
scala> :quit"""
diff --git a/test/files/run/t1931.scala b/test/files/run/t1931.scala
new file mode 100644
index 0000000000..eedfa9b03d
--- /dev/null
+++ b/test/files/run/t1931.scala
@@ -0,0 +1,43 @@
+
+import scala.tools.partest.SessionTest
+
+object Test extends SessionTest {
+
+ def session =
+"""
+scala> val x: Any = 42
+x: Any = 42
+
+scala> x + " works"
+res0: String = 42 works
+
+scala> import Predef.{ any2stringadd => _, _ }
+import Predef.{any2stringadd=>_, _}
+
+scala> x + " works"
+<console>:14: error: value + is not a member of Any
+ x + " works"
+ ^
+
+scala> import Predef._
+import Predef._
+
+scala> x + " works"
+res2: String = 42 works
+
+scala> object Predef { def f = 42 }
+defined object Predef
+
+scala> import Predef._
+import Predef._
+
+scala> f
+<console>:14: error: not found: value f
+ f
+ ^
+
+scala> Predef.f
+res4: Int = 42
+
+scala> :quit"""
+}
diff --git a/test/files/run/t4542.check b/test/files/run/t4542.check
index 3ab3eaffd8..6e099222b0 100644
--- a/test/files/run/t4542.check
+++ b/test/files/run/t4542.check
@@ -5,7 +5,7 @@ scala> @deprecated("foooo", "ReplTest version 1.0-FINAL") class Foo() {
defined class Foo
scala> val f = new Foo
-<console>:11: warning: class Foo is deprecated: foooo
+<console>:12: warning: class Foo is deprecated: foooo
val f = new Foo
^
f: Foo = Bippy
diff --git a/test/files/run/t4594-repl-settings.scala b/test/files/run/t4594-repl-settings.scala
index cbd87b5949..f2d1a8b3f8 100644
--- a/test/files/run/t4594-repl-settings.scala
+++ b/test/files/run/t4594-repl-settings.scala
@@ -15,7 +15,7 @@ object Test extends SessionTest {
|scala> :settings -deprecation
|
|scala> def b = depp
- |<console>:11: warning: method depp is deprecated: Please don't do that.
+ |<console>:12: warning: method depp is deprecated: Please don't do that.
| def b = depp
| ^
|b: String
diff --git a/test/files/run/t5655.check b/test/files/run/t5655.check
index 857a5ab556..9191997624 100644
--- a/test/files/run/t5655.check
+++ b/test/files/run/t5655.check
@@ -6,7 +6,7 @@ scala> import x._
import x._
scala> x
-<console>:15: error: reference to x is ambiguous;
+<console>:16: error: reference to x is ambiguous;
it is imported twice in the same scope by
import x._
and import x
@@ -14,7 +14,7 @@ and import x
^
scala> x
-<console>:15: error: reference to x is ambiguous;
+<console>:16: error: reference to x is ambiguous;
it is imported twice in the same scope by
import x._
and import x
diff --git a/test/files/run/t7319.check b/test/files/run/t7319.check
index 31923e7119..4d8429e8f2 100644
--- a/test/files/run/t7319.check
+++ b/test/files/run/t7319.check
@@ -15,21 +15,21 @@ 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))
-<console>:15: error: no type parameters for method convert: (builder: F[_ <: F[_]])Int exist so that it can be applied to arguments (Some[Int])
+<console>:16: error: no type parameters for method convert: (builder: F[_ <: F[_]])Int exist so that it can be applied to arguments (Some[Int])
--- because ---
argument expression's type is not compatible with formal parameter type;
found : Some[Int]
required: ?F[_$1] forSome { type _$1 <: ?F[_$2] forSome { type _$2 } }
convert(Some[Int](0))
^
-<console>:15: error: type mismatch;
+<console>:16: error: type mismatch;
found : Some[Int]
required: F[_ <: F[_]]
convert(Some[Int](0))
^
scala> Range(1,2).toArray: Seq[_]
-<console>:14: error: polymorphic expression cannot be instantiated to expected type;
+<console>:15: error: polymorphic expression cannot be instantiated to expected type;
found : [B >: Int]Array[B]
required: Seq[_]
Range(1,2).toArray: Seq[_]
diff --git a/test/files/run/t7747-repl.check b/test/files/run/t7747-repl.check
index f19c39e7e1..487daf4878 100644
--- a/test/files/run/t7747-repl.check
+++ b/test/files/run/t7747-repl.check
@@ -15,13 +15,13 @@ scala> val z = x * y
z: Int = 156
scala> 2 ; 3
-<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
2 ;;
^
res0: Int = 3
scala> { 2 ; 3 }
-<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:12: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
{ 2 ; 3 }
^
res1: Int = 3
@@ -30,16 +30,16 @@ scala> 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Mooo
1 +
2 +
3 } ; bippy+88+11
-<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
^
-<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
^
-<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
^
-<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
^
defined object Cow
@@ -81,10 +81,10 @@ scala> ( (2 + 2 ) )
res10: Int = 4
scala> 5 ; ( (2 + 2 ) ) ; ((5))
-<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
5 ; ( (2 + 2 ) ) ;;
^
-<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
5 ; ( (2 + 2 ) ) ;;
^
res11: Int = 5
@@ -101,16 +101,16 @@ res14: String = 4423
scala>
scala> 55 ; ((2 + 2)) ; (1, 2, 3)
-<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
55 ; ((2 + 2)) ;;
^
-<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
55 ; ((2 + 2)) ;;
^
res15: (Int, Int, Int) = (1,2,3)
scala> 55 ; (x: Int) => x + 1 ; () => ((5))
-<console>:12: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:13: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
55 ; (x: Int) => x + 1 ;;
^
res16: () => Int = <function0>
@@ -121,7 +121,7 @@ scala> () => 5
res17: () => Int = <function0>
scala> 55 ; () => 5
-<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
55 ;;
^
res18: () => Int = <function0>
@@ -209,13 +209,13 @@ Forgetting all expression results and named terms: $intp, BippyBungus, Bovine, C
Forgetting defined types: BippyBungus, Moo, Ruminant
scala> x1 + x2 + x3
-<console>:11: error: not found: value x1
+<console>:12: error: not found: value x1
x1 + x2 + x3
^
-<console>:11: error: not found: value x2
+<console>:12: error: not found: value x2
x1 + x2 + x3
^
-<console>:11: error: not found: value x3
+<console>:12: error: not found: value x3
x1 + x2 + x3
^
@@ -223,7 +223,7 @@ scala> val x1 = 4
x1: Int = 4
scala> new BippyBungus
-<console>:11: error: not found: type BippyBungus
+<console>:12: error: not found: type BippyBungus
new BippyBungus
^
diff --git a/test/files/run/t8346.check b/test/files/run/t8346.check
deleted file mode 100644
index 1ba5c31abe..0000000000
--- a/test/files/run/t8346.check
+++ /dev/null
@@ -1,6 +0,0 @@
-BitSet: List(invariant, invariant, invariant, invariant)
-HashSet: List(covariant (true), covariant (true), covariant (true), covariant (true))
-ListSet: List(covariant (true), covariant (true), covariant (true), covariant (true))
-SortedSet: List(invariant, invariant, invariant, invariant)
-TreeSet: List(invariant, invariant, invariant, invariant)
-ValueSet: invariant
diff --git a/test/files/run/t8346.scala b/test/files/run/t8346.scala
deleted file mode 100644
index 5f3df84174..0000000000
--- a/test/files/run/t8346.scala
+++ /dev/null
@@ -1,34 +0,0 @@
-object Test extends App {
- import reflect.ClassTag
-
- object SomeEnum extends Enumeration {
- val one, two, three, four = Value
- }
-
- def sctor[A <: Set[Int]](f: Int => A)(implicit A: ClassTag[A])
- : (String, Int => Set[Int]) =
- (A.runtimeClass.getSimpleName, f)
-
- val inits: Seq[(String, Int => Set[Int])] = {
- import collection.immutable.{Seq => _, _}
- Seq(sctor(BitSet(_)),
- sctor(HashSet(_)),
- sctor(ListSet(_)),
- sctor(SortedSet(_)),
- sctor(TreeSet(_)))
- }
-
- def sVarInfo[A](sa: Set[A]): String = {
- val saa = sa.toSet[Any]
- if (sa eq saa) s"""covariant (${(saa + "hi") contains "hi"})"""
- else "invariant"
- }
-
- inits foreach {case (name, singleton) =>
- print(s"${name}: ")
- val one = singleton(1)
- println(Seq(2,3,4).scanLeft(one)(_ + _) map sVarInfo toList)
- }
-
- println(s"ValueSet: ${sVarInfo(SomeEnum.values)}")
-}
diff --git a/test/files/run/t9170.scala b/test/files/run/t9170.scala
index d6cf516615..f39467bc25 100644
--- a/test/files/run/t9170.scala
+++ b/test/files/run/t9170.scala
@@ -8,17 +8,17 @@ object Test extends SessionTest {
def session =
"""
scala> object Y { def f[A](a: => A) = 1 ; def f[A](a: => Either[Exception, A]) = 2 }
-<console>:10: error: double definition:
-def f[A](a: => A): Int at line 10 and
-def f[A](a: => Either[Exception,A]): Int at line 10
+<console>:11: error: double definition:
+def f[A](a: => A): Int at line 11 and
+def f[A](a: => Either[Exception,A]): Int at line 11
have same type after erasure: (a: Function0)Int
object Y { def f[A](a: => A) = 1 ; def f[A](a: => Either[Exception, A]) = 2 }
^
scala> object Y { def f[A](a: => A) = 1 ; def f[A](a: => Either[Exception, A]) = 2 }
-<console>:10: error: double definition:
-def f[A](a: => A): Int at line 10 and
-def f[A](a: => Either[Exception,A]): Int at line 10
+<console>:11: error: double definition:
+def f[A](a: => A): Int at line 11 and
+def f[A](a: => Either[Exception,A]): Int at line 11
have same type after erasure: (a: Function0)Int
object Y { def f[A](a: => A) = 1 ; def f[A](a: => Either[Exception, A]) = 2 }
^
@@ -27,9 +27,9 @@ scala> object Y {
| def f[A](a: => A) = 1
| def f[A](a: => Either[Exception, A]) = 2
| }
-<console>:12: error: double definition:
-def f[A](a: => A): Int at line 11 and
-def f[A](a: => Either[Exception,A]): Int at line 12
+<console>:13: error: double definition:
+def f[A](a: => A): Int at line 12 and
+def f[A](a: => Either[Exception,A]): Int at line 13
have same type after erasure: (a: Function0)Int
def f[A](a: => Either[Exception, A]) = 2
^
@@ -44,9 +44,9 @@ object Y {
// Exiting paste mode, now interpreting.
-<console>:12: error: double definition:
-def f[A](a: => A): Int at line 11 and
-def f[A](a: => Either[Exception,A]): Int at line 12
+<console>:13: error: double definition:
+def f[A](a: => A): Int at line 12 and
+def f[A](a: => Either[Exception,A]): Int at line 13
have same type after erasure: (a: Function0)Int
def f[A](a: => Either[Exception, A]) = 2
^
diff --git a/test/files/run/t9206.scala b/test/files/run/t9206.scala
index 872c980fe4..406798104e 100644
--- a/test/files/run/t9206.scala
+++ b/test/files/run/t9206.scala
@@ -7,14 +7,14 @@ object Test extends SessionTest {
def session =
s"""|
|scala> val i: Int = "foo"
- |<console>:10: error: type mismatch;
+ |<console>:11: error: type mismatch;
| found : String("foo")
| required: Int
| val i: Int = "foo"
| ^
|
|scala> { val j = 42 ; val i: Int = "foo" + j }
- |<console>:11: error: type mismatch;
+ |<console>:12: error: type mismatch;
| found : String
| required: Int
| { val j = 42 ; val i: Int = "foo" + j }
diff --git a/test/files/run/t9425.scala b/test/files/run/t9425.scala
new file mode 100644
index 0000000000..f251cc8579
--- /dev/null
+++ b/test/files/run/t9425.scala
@@ -0,0 +1,8 @@
+class C { case class Foo private (x: Int); Foo.apply(0) }
+
+object Test {
+ def test(c: C) = {import c.Foo; Foo.apply(0)}
+ def main(args: Array[String]): Unit = {
+ test(new C)
+ }
+}
diff --git a/test/files/run/xMigration.check b/test/files/run/xMigration.check
index 79ce544493..cd860bf394 100644
--- a/test/files/run/xMigration.check
+++ b/test/files/run/xMigration.check
@@ -10,7 +10,7 @@ res1: Iterable[String] = MapLike(eis)
scala> :setting -Xmigration:any
scala> Map(1 -> "eis").values // warn
-<console>:11: warning: method values in trait MapLike has changed semantics in version 2.8.0:
+<console>:12: warning: method values in trait MapLike has changed semantics in version 2.8.0:
`values` returns `Iterable[B]` rather than `Iterator[B]`.
Map(1 -> "eis").values // warn
^
@@ -24,7 +24,7 @@ res3: Iterable[String] = MapLike(eis)
scala> :setting -Xmigration:2.7
scala> Map(1 -> "eis").values // warn
-<console>:11: warning: method values in trait MapLike has changed semantics in version 2.8.0:
+<console>:12: warning: method values in trait MapLike has changed semantics in version 2.8.0:
`values` returns `Iterable[B]` rather than `Iterator[B]`.
Map(1 -> "eis").values // warn
^
@@ -38,7 +38,7 @@ res5: Iterable[String] = MapLike(eis)
scala> :setting -Xmigration // same as :any
scala> Map(1 -> "eis").values // warn
-<console>:11: warning: method values in trait MapLike has changed semantics in version 2.8.0:
+<console>:12: warning: method values in trait MapLike has changed semantics in version 2.8.0:
`values` returns `Iterable[B]` rather than `Iterator[B]`.
Map(1 -> "eis").values // warn
^