From 1531900bffb2bed6288eda4e0945b0e6dea3f23d Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Sun, 21 Jun 2015 06:17:59 +1000 Subject: SI-6895 Test cases to explain the limitations in tcpoly inference I've determined that the failure in this bug report boils down to SI-2712. Submitting my working as neg tests for posterity. The type error disabmiguator develops a serious stutter with this example. I'll fix that in the following commit. --- test/files/neg/t6895.check | 6 ++++++ test/files/neg/t6895.scala | 26 ++++++++++++++++++++++++++ test/files/neg/t6895b.check | 9 +++++++++ test/files/neg/t6895b.scala | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 80 insertions(+) create mode 100644 test/files/neg/t6895.check create mode 100644 test/files/neg/t6895.scala create mode 100644 test/files/neg/t6895b.check create mode 100644 test/files/neg/t6895b.scala (limited to 'test/files') diff --git a/test/files/neg/t6895.check b/test/files/neg/t6895.check new file mode 100644 index 0000000000..df01031fff --- /dev/null +++ b/test/files/neg/t6895.check @@ -0,0 +1,6 @@ +t6895.scala:19: error: polymorphic expression cannot be instantiated to expected type; + found : [F3[F3_P]]Foo[F3] + required: Foo[[X3]Bar[[X1]String]] + val nok: Foo[({type L[X3] = Bar[M]})#L] = barFoo /* Type inference can't unify F with L */ + ^ +one error found diff --git a/test/files/neg/t6895.scala b/test/files/neg/t6895.scala new file mode 100644 index 0000000000..5fb20d8c61 --- /dev/null +++ b/test/files/neg/t6895.scala @@ -0,0 +1,26 @@ +trait Foo[F1[F1_P]] +trait Bar[F2[F2_P]] + +class Test { + def barFoo[F3[F3_P]]: Foo[F3] = ??? + + // Now we can define a couple of type aliases: + type M[X1] = String + type N[X2] = Bar[M] + + // val ok1: Foo[N] = barFoo + // Foo[?F3] <:< Foo[Test.this.N] + // [X2]Test.this.N[X2] <:< [F3_P]?F3[F3_P] + // Test.this.N[X2] <:< ?F3[X2] + // true, ?F3=N + + // val ok2: Foo[({type L[X] = Bar[M]})#L] = barFoo[N] + + val nok: Foo[({type L[X3] = Bar[M]})#L] = barFoo /* Type inference can't unify F with L */ + // Foo[?F3] <:< Foo[[X3]Bar[[X1]String]] + // [X3]Bar[[X1]String] <:< ?F3 + // [X3]Bar[[X1]String] <:< [F3_P]?F3[F3_P] + // Bar[[X1]String] <:< ?F3[X3] + // X3 <:< [X1]String + // false +} diff --git a/test/files/neg/t6895b.check b/test/files/neg/t6895b.check new file mode 100644 index 0000000000..3ebdb69309 --- /dev/null +++ b/test/files/neg/t6895b.check @@ -0,0 +1,9 @@ +t6895b.scala:20: error: could not find implicit value for parameter e: Foo[[X]Bar[[X]Or[String,X],X]] + implicitly[Foo[({type L[X] = Bar[StringOr, X]})#L]] + ^ +t6895b.scala:23: error: polymorphic expression cannot be instantiated to expected type; + found : [F[_]]Foo[[X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]Bar[F,X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]] + required: Foo[[X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]Bar[[X]Or[String,X],X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]] + barFoo(null) : Foo[({type L[X] = Bar[StringOr, X]})#L] + ^ +two errors found diff --git a/test/files/neg/t6895b.scala b/test/files/neg/t6895b.scala new file mode 100644 index 0000000000..c465065011 --- /dev/null +++ b/test/files/neg/t6895b.scala @@ -0,0 +1,39 @@ +trait Foo[F[_]] +trait Bar[F[_], A] + +trait Or[A, B] + +class Test { + implicit def orFoo[A]: Foo[({type L[X] = Or[A, X]})#L] = ??? + implicit def barFoo[F[_]](implicit f: Foo[F]): Foo[({type L[X] = Bar[F, X]})#L] = ??? + + // Now we can define a couple of type aliases: + type StringOr[X] = Or[String, X] + type BarStringOr[X] = Bar[StringOr, X] + + // ok + implicitly[Foo[BarStringOr]] + barFoo[StringOr](null) : Foo[BarStringOr] + barFoo(null) : Foo[BarStringOr] + + // nok + implicitly[Foo[({type L[X] = Bar[StringOr, X]})#L]] + // Let's write the application explicitly, and then + // compile with just this line enabled and -explaintypes. + barFoo(null) : Foo[({type L[X] = Bar[StringOr, X]})#L] + + // Foo[[X]Bar[F,X]] <: Foo[[X]Bar[[X]Or[String,X],X]]? + // Bar[[X]Or[String,X],X] <: Bar[F,X]? + // F[_] <: Or[String,_]? + // false + // false + // false + + // Note that the type annotation above is typechecked as + // Foo[[X]Bar[[X]Or[String,X],X]], ie the type alias `L` + // is eta expanded. + // + // This is done so that it does not escape its defining scope. + // However, one this is done, higher kinded inference + // no longer is able to unify F with `StringOr` (SI-2712) +} -- cgit v1.2.3 From f8d816086f56096c05dfc769aa1ab0f6e583bb5a Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Wed, 16 Jul 2014 18:40:44 +0200 Subject: SI-8777 Avoid redundant disambiguation in error messages When printing types in error messages, we attempt to disambiguate symbol names by qualifying them in various ways. Type paramters symbols are qualified by adding `(in someMethod)`. However, the type errors generated by higher kinded subtyping can contain clones of type parameter symbols, as creater in `isPolySubType`. The disambiguation tries fruitlessly to distinguish them but ended up adding the same suffix to both names repeatedly. ``` found : [F[_]]Foo[[X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]Bar[F,X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]] required: Foo[[X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]Bar[[X]Or[String,X],X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]] ``` This commit limits the post qualification of type parameter symbols to a single attempt to limit the damage. An alternative might be to mark a clone (we could determine its status by checking whether it is a type parameter of its owner.) But I'm not sure how to present this information in a comphrenensible way, so for now I'm limiting my ambitions to stopping the stutter. --- src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala | 3 ++- test/files/neg/t6895b.check | 4 ++-- test/files/neg/t8777.check | 6 ++++++ test/files/neg/t8777.scala | 4 ++++ 4 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 test/files/neg/t8777.check create mode 100644 test/files/neg/t8777.scala (limited to 'test/files') diff --git a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala index 059981aa37..65dea3178b 100644 --- a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala +++ b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala @@ -309,6 +309,7 @@ trait TypeDiagnostics { // save the name because it will be mutated until it has been // distinguished from the other types in the same error message private val savedName = sym.name + private var postQualifiedWith: List[Symbol] = Nil def restoreName() = sym.name = savedName def modifyName(f: String => String) = sym setName newTypeName(f(sym.name.toString)) @@ -322,7 +323,7 @@ trait TypeDiagnostics { // functions to manipulate the name def preQualify() = modifyName(trueOwner.fullName + "." + _) - def postQualify() = modifyName(_ + "(in " + trueOwner + ")") + def postQualify() = if (!(postQualifiedWith contains trueOwner)) { postQualifiedWith ::= trueOwner; modifyName(_ + "(in " + trueOwner + ")") } def typeQualify() = if (sym.isTypeParameterOrSkolem) postQualify() def nameQualify() = if (trueOwner.isPackageClass) preQualify() else postQualify() diff --git a/test/files/neg/t6895b.check b/test/files/neg/t6895b.check index 3ebdb69309..565925127b 100644 --- a/test/files/neg/t6895b.check +++ b/test/files/neg/t6895b.check @@ -2,8 +2,8 @@ t6895b.scala:20: error: could not find implicit value for parameter e: Foo[[X]Ba implicitly[Foo[({type L[X] = Bar[StringOr, X]})#L]] ^ t6895b.scala:23: error: polymorphic expression cannot be instantiated to expected type; - found : [F[_]]Foo[[X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]Bar[F,X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]] - required: Foo[[X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]Bar[[X]Or[String,X],X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]] + found : [F[_]]Foo[[X(in type L)]Bar[F,X(in type L)]] + required: Foo[[X(in type L)]Bar[[X]Or[String,X],X(in type L)]] barFoo(null) : Foo[({type L[X] = Bar[StringOr, X]})#L] ^ two errors found diff --git a/test/files/neg/t8777.check b/test/files/neg/t8777.check new file mode 100644 index 0000000000..cd05f1ec11 --- /dev/null +++ b/test/files/neg/t8777.check @@ -0,0 +1,6 @@ +t8777.scala:3: error: type mismatch; + found : Foo.this.TreePrinter(in trait Printers) + required: Foo.this.TreePrinter(in trait Printers) + super.newCodePrinter(out, tree, printRootPkg) + ^ +one error found diff --git a/test/files/neg/t8777.scala b/test/files/neg/t8777.scala new file mode 100644 index 0000000000..5b7d123202 --- /dev/null +++ b/test/files/neg/t8777.scala @@ -0,0 +1,4 @@ +trait Foo extends scala.tools.nsc.Global { + override def newCodePrinter(out: java.io.PrintWriter, tree: Tree, printRootPkg: Boolean): TreePrinter = + super.newCodePrinter(out, tree, printRootPkg) +} -- cgit v1.2.3 From 4a61719c1a3b57b47aa65409e83b87cff39145d3 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Sun, 21 Jun 2015 06:53:38 +1000 Subject: SI-8892 Fix incorrect qualification in error message Since beadafa2, we've ended up with nutty error messages for type errors involving aliases that target types in `java.lang` and `scala` packages. I think the intent of that change was to force the error messages to qualify types like `String` when needed, but to leave them unqualified by default. However, this led to this flat out wrong message in the enclosed test. found : B required: C.this.java.lang.B (which expands to) String I've changed the heuristic slightly limit this code to aliases that are eponymous with their targets. Still feels pretty kludgy, but we can at least book a little progress. --- src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala | 2 +- test/files/neg/t8892.check | 7 +++++++ test/files/neg/t8892.scala | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 test/files/neg/t8892.check create mode 100644 test/files/neg/t8892.scala (limited to 'test/files') diff --git a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala index 65dea3178b..5f2643cb25 100644 --- a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala +++ b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala @@ -318,7 +318,7 @@ trait TypeDiagnostics { */ def qualifyDefaultNamespaces() = { val intersect = Set(trueOwner, aliasOwner) intersect UnqualifiedOwners - if (intersect.nonEmpty) preQualify() + if (intersect.nonEmpty && tp.typeSymbolDirect.name == tp.typeSymbol.name) preQualify() } // functions to manipulate the name diff --git a/test/files/neg/t8892.check b/test/files/neg/t8892.check new file mode 100644 index 0000000000..5930be58c5 --- /dev/null +++ b/test/files/neg/t8892.check @@ -0,0 +1,7 @@ +t8892.scala:2: error: type mismatch; + found : B + required: C.this.B + (which expands to) String +class C[B](x: B) extends A { def f: B = x } + ^ +one error found diff --git a/test/files/neg/t8892.scala b/test/files/neg/t8892.scala new file mode 100644 index 0000000000..f857e6f115 --- /dev/null +++ b/test/files/neg/t8892.scala @@ -0,0 +1,2 @@ +trait A { type B = String } +class C[B](x: B) extends A { def f: B = x } -- cgit v1.2.3 From 1b9cb466430b6300355185917257493ca2e6a240 Mon Sep 17 00:00:00 2001 From: Igor Racic Date: Mon, 13 Apr 2015 19:46:21 +0200 Subject: SI-9206: No REPL message on :silent, unless -Dscala.repl.info Anyone who doesn't understand why result printing was turned off after they entered `:silent` mode will start the REPL with `-Dscala.repl.debug` and be enlightened. For infotainment purposes, the verbose message is also emitted under info mode. --- src/repl/scala/tools/nsc/interpreter/ILoop.scala | 5 ++--- test/files/run/t6507.check | 2 -- 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'test/files') diff --git a/src/repl/scala/tools/nsc/interpreter/ILoop.scala b/src/repl/scala/tools/nsc/interpreter/ILoop.scala index 525609171e..b95789a16d 100644 --- a/src/repl/scala/tools/nsc/interpreter/ILoop.scala +++ b/src/repl/scala/tools/nsc/interpreter/ILoop.scala @@ -680,9 +680,8 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) } def verbosity() = { - val old = intp.printResults - intp.printResults = !old - echo("Switched " + (if (old) "off" else "on") + " result printing.") + intp.printResults = !intp.printResults + replinfo(s"Result printing is ${ if (intp.printResults) "on" else "off" }.") } /** Run one command submitted by the user. Two values are returned: diff --git a/test/files/run/t6507.check b/test/files/run/t6507.check index 5da4aa3a24..3ca5e8e55c 100644 --- a/test/files/run/t6507.check +++ b/test/files/run/t6507.check @@ -2,7 +2,6 @@ Type in expressions to have them evaluated. Type :help for more information. scala> :silent -Switched off result printing. scala> class A { override def toString() = { println("!"); "A" } } @@ -15,7 +14,6 @@ scala> b = new A scala> new A scala> :silent -Switched on result printing. scala> res0 ! -- cgit v1.2.3 From 91243694982f10d6061edac562b9af32b7bc9f4f Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Wed, 24 Jun 2015 21:32:07 -0700 Subject: SI-9206 Update REPL welcome message Everyone knows that a `help` command will result in `more information`. This commit moves the version string to the second line and adds some verve to the welcome. If anyone can't live without the old banner, they are now able to configure it explicitly, so there is still no blood on our hands. ``` $ scala Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_40). Type in expressions to have them evaluated. Type :help for more information. scala> :quit $ skala Welcome to Scala! version 2.11.7-20150623-155244-eab44dd092 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_40). Type in expressions for evaluation. Or try :help. scala> :quit ``` REPL tests now lop off the actual length of the welcome header; or, if necessary, remove the version number from a header embedded in output. --- src/compiler/scala/tools/nsc/Properties.scala | 6 ++-- .../scala/tools/partest/ReplTest.scala | 32 ++++++++++--------- .../scala/tools/nsc/interpreter/ReplProps.scala | 5 +-- test/files/jvm/interpreter.check | 2 -- test/files/jvm/throws-annot-from-java.check | 2 -- test/files/jvm/xml05.check | 2 -- test/files/run/class-symbol-contravariant.check | 2 -- test/files/run/constant-type.check | 2 -- test/files/run/constrained-types.check | 2 -- test/files/run/kind-repl-command.check | 2 -- test/files/run/lub-visibility.check | 2 -- test/files/run/macro-bundle-repl.check | 2 -- test/files/run/macro-repl-basic.check | 2 -- test/files/run/macro-repl-dontexpand.check | 2 -- test/files/run/macro-system-properties.check | 2 -- test/files/run/reflection-equality.check | 2 -- test/files/run/reflection-magicsymbols-repl.check | 2 -- test/files/run/reflection-repl-classes.check | 2 -- test/files/run/reflection-repl-elementary.check | 2 -- test/files/run/reify-repl-fail-gracefully.check | 2 -- test/files/run/reify_newimpl_22.check | 2 -- test/files/run/reify_newimpl_23.check | 2 -- test/files/run/reify_newimpl_25.check | 2 -- test/files/run/reify_newimpl_26.check | 2 -- test/files/run/reify_newimpl_35.check | 2 -- test/files/run/repl-assign.check | 2 -- test/files/run/repl-bare-expr.check | 2 -- test/files/run/repl-colon-type.check | 2 -- test/files/run/repl-empty-package.check | 2 -- test/files/run/repl-javap-app.check | 18 +++++------ test/files/run/repl-out-dir.check | 2 -- test/files/run/repl-parens.check | 2 -- test/files/run/repl-paste-2.check | 2 -- test/files/run/repl-paste-3.check | 2 -- test/files/run/repl-paste-4.scala | 4 +-- test/files/run/repl-paste-raw.scala | 4 +-- test/files/run/repl-paste.check | 2 -- test/files/run/repl-power.check | 2 -- test/files/run/repl-reset.check | 2 -- test/files/run/repl-save.scala | 4 +-- test/files/run/repl-term-macros.check | 2 -- test/files/run/repl-transcript.check | 2 -- test/files/run/repl-trim-stack-trace.scala | 7 ++--- test/files/run/repl-type-verbose.check | 2 -- test/files/run/t3376.check | 2 -- test/files/run/t4025.check | 2 -- test/files/run/t4172.check | 2 -- test/files/run/t4216.check | 2 -- test/files/run/t4285.check | 2 -- test/files/run/t4542.check | 2 -- test/files/run/t4594-repl-settings.scala | 36 ++++++++++------------ test/files/run/t4671.check | 2 -- test/files/run/t4710.check | 2 -- test/files/run/t4950.check | 2 -- test/files/run/t5072.check | 2 -- test/files/run/t5256d.check | 2 -- test/files/run/t5535.check | 2 -- test/files/run/t5537.check | 2 -- test/files/run/t5583.check | 2 -- test/files/run/t5655.check | 2 -- test/files/run/t5789.check | 2 -- test/files/run/t6086-repl.check | 2 -- test/files/run/t6146b.check | 2 -- test/files/run/t6187.check | 2 -- test/files/run/t6273.check | 2 -- test/files/run/t6320.check | 2 -- test/files/run/t6329_repl.check | 2 -- test/files/run/t6329_repl_bug.check | 2 -- test/files/run/t6381.check | 2 -- test/files/run/t6434.check | 2 -- test/files/run/t6439.check | 2 -- test/files/run/t6507.check | 2 -- test/files/run/t6549.check | 2 -- test/files/run/t6937.check | 2 -- test/files/run/t7185.check | 2 -- test/files/run/t7319.check | 2 -- test/files/run/t7482a.check | 2 -- test/files/run/t7634.check | 2 -- test/files/run/t7747-repl.check | 2 -- test/files/run/t7801.check | 2 -- test/files/run/t7805-repl-i.check | 6 ++-- test/files/run/t8843-repl-xlat.scala | 4 +-- test/files/run/t9170.scala | 4 +-- test/files/run/t9206.scala | 4 +-- test/files/run/tpeCache-tyconCache.check | 2 -- test/files/run/xMigration.check | 2 -- 86 files changed, 61 insertions(+), 219 deletions(-) (limited to 'test/files') diff --git a/src/compiler/scala/tools/nsc/Properties.scala b/src/compiler/scala/tools/nsc/Properties.scala index c8b9922623..3da02ebe37 100644 --- a/src/compiler/scala/tools/nsc/Properties.scala +++ b/src/compiler/scala/tools/nsc/Properties.scala @@ -18,9 +18,9 @@ object Properties extends scala.util.PropertiesTrait { def residentPromptString = scalaPropOrElse("resident.prompt", "\nnsc> ") def shellPromptString = scalaPropOrElse("shell.prompt", "%nscala> ") def shellWelcomeString = scalaPropOrElse("shell.welcome", - """Welcome to Scala %1$s (%3$s, Java %2$s). - |Type in expressions to have them evaluated. - |Type :help for more information.""".stripMargin + """Welcome to Scala! + |%1$s (%3$s, Java %2$s). + |Type in expressions for evaluation. Or try :help.""".stripMargin ) // message to display at EOF (which by default ends with diff --git a/src/partest-extras/scala/tools/partest/ReplTest.scala b/src/partest-extras/scala/tools/partest/ReplTest.scala index 1fde2370d3..756ae21b43 100644 --- a/src/partest-extras/scala/tools/partest/ReplTest.scala +++ b/src/partest-extras/scala/tools/partest/ReplTest.scala @@ -6,8 +6,9 @@ package scala.tools.partest import scala.tools.nsc.Settings -import scala.tools.nsc.interpreter.ILoop +import scala.tools.nsc.interpreter.{ ILoop, replProps } import java.lang.reflect.{ Method => JMethod, Field => JField } +import scala.util.matching.Regex import scala.util.matching.Regex.Match /** A class for testing repl code. @@ -19,30 +20,31 @@ abstract class ReplTest extends DirectTest { // final because we need to enforce the existence of a couple settings. final override def settings: Settings = { val s = super.settings - // s.Yreplsync.value = true s.Xnojline.value = true transformSettings(s) } + def normalize(s: String) = s /** True for SessionTest to preserve session text. */ def inSession: Boolean = false - /** True to preserve welcome text. */ + /** True to preserve welcome header, eliding version number. */ def welcoming: Boolean = false - lazy val welcome = "(Welcome to Scala) version .*".r - def normalize(s: String) = s match { - case welcome(w) => w - case s => s - } - def unwelcoming(s: String) = s match { - case welcome(w) => false - case _ => true - } + lazy val header = replProps.welcome def eval() = { val s = settings log("eval(): settings = " + s) - //ILoop.runForTranscript(code, s).lines drop 1 // not always first line val lines = ILoop.runForTranscript(code, s, inSession = inSession).lines - if (welcoming) lines map normalize - else lines filter unwelcoming + (if (welcoming) { + val welcome = Regex.quote(header.lines.next).r + val version = "(.*version).*".r + var inHead = false + lines map { + case s @ welcome() => inHead = true ; s + case version(s) if inHead => inHead = false ; s + case s => s + } + } else { + lines drop header.lines.size + }) map normalize } def show() = eval() foreach println } diff --git a/src/repl/scala/tools/nsc/interpreter/ReplProps.scala b/src/repl/scala/tools/nsc/interpreter/ReplProps.scala index c2da1f6eca..588d92f81b 100644 --- a/src/repl/scala/tools/nsc/interpreter/ReplProps.scala +++ b/src/repl/scala/tools/nsc/interpreter/ReplProps.scala @@ -44,7 +44,7 @@ class ReplProps { } // Handy system prop for shell prompt, or else pick it up from compiler.properties - val promptString = Prop[String]("scala.repl.prompt").option getOrElse (if (info) "%nscala %s> " else shellPromptString) + val promptString = Prop[String]("scala.repl.prompt").option getOrElse (if (info) "%nscala %#s> " else shellPromptString) val promptText = enversion(promptString) val prompt = encolor(promptText) @@ -57,10 +57,11 @@ class ReplProps { } val continuePrompt = encolor(continueText) + // Next time. //def welcome = enversion(Prop[String]("scala.repl.welcome") or shellWelcomeString) def welcome = enversion { val p = Prop[String]("scala.repl.welcome") - if (p.isSet) p.value else shellWelcomeString + if (p.isSet) p.get else shellWelcomeString } /** CSV of paged,across to enable pagination or `-x` style diff --git a/test/files/jvm/interpreter.check b/test/files/jvm/interpreter.check index 9e875235c7..08372685d6 100644 --- a/test/files/jvm/interpreter.check +++ b/test/files/jvm/interpreter.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> // basics diff --git a/test/files/jvm/throws-annot-from-java.check b/test/files/jvm/throws-annot-from-java.check index c541b26fcc..ace264a4f5 100644 --- a/test/files/jvm/throws-annot-from-java.check +++ b/test/files/jvm/throws-annot-from-java.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> :power ** Power User mode enabled - BEEP WHIR GYVE ** diff --git a/test/files/jvm/xml05.check b/test/files/jvm/xml05.check index cad907525d..d456c5e1e4 100644 --- a/test/files/jvm/xml05.check +++ b/test/files/jvm/xml05.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> res0: scala.xml.Elem = diff --git a/test/files/run/class-symbol-contravariant.check b/test/files/run/class-symbol-contravariant.check index cbb90b52c2..1d95273b50 100644 --- a/test/files/run/class-symbol-contravariant.check +++ b/test/files/run/class-symbol-contravariant.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> :power ** Power User mode enabled - BEEP WHIR GYVE ** diff --git a/test/files/run/constant-type.check b/test/files/run/constant-type.check index a7ba5a46c2..b92f1481a3 100644 --- a/test/files/run/constant-type.check +++ b/test/files/run/constant-type.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> :power ** Power User mode enabled - BEEP WHIR GYVE ** diff --git a/test/files/run/constrained-types.check b/test/files/run/constrained-types.check index 6dbf8088c9..670d6f49aa 100644 --- a/test/files/run/constrained-types.check +++ b/test/files/run/constrained-types.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> class Annot(obj: Any) extends annotation.Annotation with annotation.TypeConstraint defined class Annot diff --git a/test/files/run/kind-repl-command.check b/test/files/run/kind-repl-command.check index 1853213555..e050fb4bc1 100644 --- a/test/files/run/kind-repl-command.check +++ b/test/files/run/kind-repl-command.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> :kind scala.Option scala.Option's kind is F[+A] diff --git a/test/files/run/lub-visibility.check b/test/files/run/lub-visibility.check index 70734966f0..757f0f5917 100644 --- a/test/files/run/lub-visibility.check +++ b/test/files/run/lub-visibility.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> // should infer List[scala.collection.immutable.Seq[Nothing]] diff --git a/test/files/run/macro-bundle-repl.check b/test/files/run/macro-bundle-repl.check index 75c5c2adda..ce5c980f6e 100644 --- a/test/files/run/macro-bundle-repl.check +++ b/test/files/run/macro-bundle-repl.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.language.experimental.macros import scala.language.experimental.macros diff --git a/test/files/run/macro-repl-basic.check b/test/files/run/macro-repl-basic.check index fab03d1558..7e1cb61583 100644 --- a/test/files/run/macro-repl-basic.check +++ b/test/files/run/macro-repl-basic.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import language.experimental.macros import language.experimental.macros diff --git a/test/files/run/macro-repl-dontexpand.check b/test/files/run/macro-repl-dontexpand.check index 6ecc9245fa..a307ffb26e 100644 --- a/test/files/run/macro-repl-dontexpand.check +++ b/test/files/run/macro-repl-dontexpand.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> def bar1(c: scala.reflect.macros.blackbox.Context) = ??? bar1: (c: scala.reflect.macros.blackbox.Context)Nothing diff --git a/test/files/run/macro-system-properties.check b/test/files/run/macro-system-properties.check index e2e2bd32b9..e20a5bbdfb 100644 --- a/test/files/run/macro-system-properties.check +++ b/test/files/run/macro-system-properties.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.language.experimental._, scala.reflect.macros.blackbox.Context import scala.language.experimental._ diff --git a/test/files/run/reflection-equality.check b/test/files/run/reflection-equality.check index d60d861a90..09a0858630 100644 --- a/test/files/run/reflection-equality.check +++ b/test/files/run/reflection-equality.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> class X { def methodIntIntInt(x: Int, y: Int) = x+y diff --git a/test/files/run/reflection-magicsymbols-repl.check b/test/files/run/reflection-magicsymbols-repl.check index ca8857ada4..dd26c08349 100644 --- a/test/files/run/reflection-magicsymbols-repl.check +++ b/test/files/run/reflection-magicsymbols-repl.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ diff --git a/test/files/run/reflection-repl-classes.check b/test/files/run/reflection-repl-classes.check index 5ebf993a87..df889b9da6 100644 --- a/test/files/run/reflection-repl-classes.check +++ b/test/files/run/reflection-repl-classes.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> class A defined class A diff --git a/test/files/run/reflection-repl-elementary.check b/test/files/run/reflection-repl-elementary.check index e948c9fd61..2a7f5d90fe 100644 --- a/test/files/run/reflection-repl-elementary.check +++ b/test/files/run/reflection-repl-elementary.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> scala.reflect.runtime.universe.typeOf[List[Nothing]] res0: reflect.runtime.universe.Type = scala.List[Nothing] diff --git a/test/files/run/reify-repl-fail-gracefully.check b/test/files/run/reify-repl-fail-gracefully.check index eac4d25869..025d377a43 100644 --- a/test/files/run/reify-repl-fail-gracefully.check +++ b/test/files/run/reify-repl-fail-gracefully.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import language.experimental.macros import language.experimental.macros diff --git a/test/files/run/reify_newimpl_22.check b/test/files/run/reify_newimpl_22.check index 24334df92c..e69dc60199 100644 --- a/test/files/run/reify_newimpl_22.check +++ b/test/files/run/reify_newimpl_22.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ diff --git a/test/files/run/reify_newimpl_23.check b/test/files/run/reify_newimpl_23.check index f8379958db..1356d509d3 100644 --- a/test/files/run/reify_newimpl_23.check +++ b/test/files/run/reify_newimpl_23.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ diff --git a/test/files/run/reify_newimpl_25.check b/test/files/run/reify_newimpl_25.check index f9a5d7b578..e512cfc52e 100644 --- a/test/files/run/reify_newimpl_25.check +++ b/test/files/run/reify_newimpl_25.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> { import scala.reflect.runtime.universe._ diff --git a/test/files/run/reify_newimpl_26.check b/test/files/run/reify_newimpl_26.check index bd77d3d707..b203389db1 100644 --- a/test/files/run/reify_newimpl_26.check +++ b/test/files/run/reify_newimpl_26.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> def foo[T]{ import scala.reflect.runtime.universe._ diff --git a/test/files/run/reify_newimpl_35.check b/test/files/run/reify_newimpl_35.check index bd9b3a2fb1..4f9b43dbbf 100644 --- a/test/files/run/reify_newimpl_35.check +++ b/test/files/run/reify_newimpl_35.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ diff --git a/test/files/run/repl-assign.check b/test/files/run/repl-assign.check index faa8a93244..a9e0a2204a 100644 --- a/test/files/run/repl-assign.check +++ b/test/files/run/repl-assign.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> var x = 10 x: Int = 10 diff --git a/test/files/run/repl-bare-expr.check b/test/files/run/repl-bare-expr.check index 38ad7e818d..f0c488455f 100644 --- a/test/files/run/repl-bare-expr.check +++ b/test/files/run/repl-bare-expr.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> 2 ; 3 :10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses diff --git a/test/files/run/repl-colon-type.check b/test/files/run/repl-colon-type.check index fa33af3beb..21fbe34d96 100644 --- a/test/files/run/repl-colon-type.check +++ b/test/files/run/repl-colon-type.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> :type List[1, 2, 3] :1: error: identifier expected but integer literal found. diff --git a/test/files/run/repl-empty-package.check b/test/files/run/repl-empty-package.check index d3b75f685e..69488ecdcf 100644 --- a/test/files/run/repl-empty-package.check +++ b/test/files/run/repl-empty-package.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> println(Bippy.bippy) bippy! diff --git a/test/files/run/repl-javap-app.check b/test/files/run/repl-javap-app.check index eb3718f44b..d29682cca5 100644 --- a/test/files/run/repl-javap-app.check +++ b/test/files/run/repl-javap-app.check @@ -1,7 +1,7 @@ #partest java6 -Welcome to Scala -Type in expressions to have them evaluated. -Type :help for more information. +Welcome to Scala! +version +Type in expressions for evaluation. Or try :help. scala> :javap -app MyApp$ public final void delayedEndpoint$MyApp$1(); @@ -17,9 +17,9 @@ public final void delayedEndpoint$MyApp$1(); scala> :quit #partest java7 -Welcome to Scala -Type in expressions to have them evaluated. -Type :help for more information. +Welcome to Scala! +version +Type in expressions for evaluation. Or try :help. scala> :javap -app MyApp$ public final void delayedEndpoint$MyApp$1(); @@ -39,9 +39,9 @@ scala> :javap -app MyApp$ scala> :quit #partest java8 -Welcome to Scala -Type in expressions to have them evaluated. -Type :help for more information. +Welcome to Scala! +version +Type in expressions for evaluation. Or try :help. scala> :javap -app MyApp$ public final void delayedEndpoint$MyApp$1(); diff --git a/test/files/run/repl-out-dir.check b/test/files/run/repl-out-dir.check index c354492898..6fd85f5bba 100644 --- a/test/files/run/repl-out-dir.check +++ b/test/files/run/repl-out-dir.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> case class Bippy(x: Int) defined class Bippy diff --git a/test/files/run/repl-parens.check b/test/files/run/repl-parens.check index 756a063b68..35853f10da 100644 --- a/test/files/run/repl-parens.check +++ b/test/files/run/repl-parens.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> (2) res0: Int = 2 diff --git a/test/files/run/repl-paste-2.check b/test/files/run/repl-paste-2.check index bc80615107..5b6a84144d 100644 --- a/test/files/run/repl-paste-2.check +++ b/test/files/run/repl-paste-2.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> scala> 999l diff --git a/test/files/run/repl-paste-3.check b/test/files/run/repl-paste-3.check index 23e402852f..603fcfa174 100644 --- a/test/files/run/repl-paste-3.check +++ b/test/files/run/repl-paste-3.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> println(3) 3 diff --git a/test/files/run/repl-paste-4.scala b/test/files/run/repl-paste-4.scala index cb0a6aa768..90f0c1802b 100644 --- a/test/files/run/repl-paste-4.scala +++ b/test/files/run/repl-paste-4.scala @@ -3,9 +3,7 @@ import scala.tools.partest.SessionTest object Test extends SessionTest { def session = -s"""|Type in expressions to have them evaluated. - |Type :help for more information. - | +s"""| |scala> :paste $pastie |Pasting file $pastie... |defined class Foo diff --git a/test/files/run/repl-paste-raw.scala b/test/files/run/repl-paste-raw.scala index 3b41254e96..9bd5e8e63e 100644 --- a/test/files/run/repl-paste-raw.scala +++ b/test/files/run/repl-paste-raw.scala @@ -3,9 +3,7 @@ import scala.tools.partest.SessionTest object Test extends SessionTest { def session = -s"""|Type in expressions to have them evaluated. - |Type :help for more information. - | +s"""| |scala> :paste -raw $pastie |Pasting file $pastie... | diff --git a/test/files/run/repl-paste.check b/test/files/run/repl-paste.check index 171447214f..3bcfd33c94 100644 --- a/test/files/run/repl-paste.check +++ b/test/files/run/repl-paste.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> :paste // Entering paste mode (ctrl-D to finish) diff --git a/test/files/run/repl-power.check b/test/files/run/repl-power.check index e2318c93f2..2a7b7783d9 100644 --- a/test/files/run/repl-power.check +++ b/test/files/run/repl-power.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> :power ** Power User mode enabled - BEEP WHIR GYVE ** diff --git a/test/files/run/repl-reset.check b/test/files/run/repl-reset.check index a2d88fd445..b0683fff79 100644 --- a/test/files/run/repl-reset.check +++ b/test/files/run/repl-reset.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> val x1 = 1 x1: Int = 1 diff --git a/test/files/run/repl-save.scala b/test/files/run/repl-save.scala index c98e6aebc3..8a3a887a8c 100644 --- a/test/files/run/repl-save.scala +++ b/test/files/run/repl-save.scala @@ -2,9 +2,7 @@ import scala.tools.partest.SessionTest object Test extends SessionTest { def session = -s"""|Type in expressions to have them evaluated. - |Type :help for more information. - | +s"""| |scala> val i = 7 |i: Int = 7 | diff --git a/test/files/run/repl-term-macros.check b/test/files/run/repl-term-macros.check index 2cd0b93cd0..b020611167 100644 --- a/test/files/run/repl-term-macros.check +++ b/test/files/run/repl-term-macros.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.reflect.macros.blackbox.Context import scala.reflect.macros.blackbox.Context diff --git a/test/files/run/repl-transcript.check b/test/files/run/repl-transcript.check index b0f106387b..762a96b9cc 100644 --- a/test/files/run/repl-transcript.check +++ b/test/files/run/repl-transcript.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> scala> class Bippity diff --git a/test/files/run/repl-trim-stack-trace.scala b/test/files/run/repl-trim-stack-trace.scala index b8c1668691..d128d4c39a 100644 --- a/test/files/run/repl-trim-stack-trace.scala +++ b/test/files/run/repl-trim-stack-trace.scala @@ -4,9 +4,9 @@ import scala.tools.partest.{ SessionTest, Welcoming } // SI-7740 object Test extends SessionTest with Welcoming { def session = -"""Welcome to Scala -Type in expressions to have them evaluated. -Type :help for more information. +"""Welcome to Scala! +version +Type in expressions for evaluation. Or try :help. scala> def f = throw new Exception("Uh-oh") f: Nothing @@ -37,7 +37,6 @@ scala> :quit""" // normalize the "elided" lines because the frame count depends on test context lazy val elided = """(\s+\.{3} )\d+( elided)""".r override def normalize(line: String) = line match { - case welcome(w) => w case elided(ellipsis, suffix) => s"$ellipsis???$suffix" case s => s } diff --git a/test/files/run/repl-type-verbose.check b/test/files/run/repl-type-verbose.check index 6f6b47b86d..10a9c1217c 100644 --- a/test/files/run/repl-type-verbose.check +++ b/test/files/run/repl-type-verbose.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> // verbose! diff --git a/test/files/run/t3376.check b/test/files/run/t3376.check index b8fd2843f6..0af54d6a53 100644 --- a/test/files/run/t3376.check +++ b/test/files/run/t3376.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> class M[@specialized T] { override def toString = "mmm" } defined class M diff --git a/test/files/run/t4025.check b/test/files/run/t4025.check index e8c6851236..ed3f254024 100644 --- a/test/files/run/t4025.check +++ b/test/files/run/t4025.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> class Color(val red: Int) defined class Color diff --git a/test/files/run/t4172.check b/test/files/run/t4172.check index 315c1c9dbd..3141647dba 100644 --- a/test/files/run/t4172.check +++ b/test/files/run/t4172.check @@ -1,5 +1,3 @@ -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 was one feature warning; re-run with -feature for details diff --git a/test/files/run/t4216.check b/test/files/run/t4216.check index e4610e87d3..3ec394b939 100644 --- a/test/files/run/t4216.check +++ b/test/files/run/t4216.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.reflect.ClassTag import scala.reflect.ClassTag diff --git a/test/files/run/t4285.check b/test/files/run/t4285.check index b952cb8e1b..465aee75f1 100644 --- a/test/files/run/t4285.check +++ b/test/files/run/t4285.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> val x = Array(1,2,3,4,5,6,7) x: Array[Int] = Array(1, 2, 3, 4, 5, 6, 7) diff --git a/test/files/run/t4542.check b/test/files/run/t4542.check index f7aad3deb2..3ab3eaffd8 100644 --- a/test/files/run/t4542.check +++ b/test/files/run/t4542.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> @deprecated("foooo", "ReplTest version 1.0-FINAL") class Foo() { override def toString = "Bippy" diff --git a/test/files/run/t4594-repl-settings.scala b/test/files/run/t4594-repl-settings.scala index 1b883983cf..cbd87b5949 100644 --- a/test/files/run/t4594-repl-settings.scala +++ b/test/files/run/t4594-repl-settings.scala @@ -4,23 +4,21 @@ import scala.tools.partest.SessionTest // Detected repl transcript paste: ctrl-D to finish. object Test extends SessionTest { def session = -""" |Type in expressions to have them evaluated. - |Type :help for more information. - | - |scala> @deprecated(message="Please don't do that.", since="Time began.") def depp = "john" - |depp: String - | - |scala> def a = depp - |warning: there was one deprecation warning; re-run with -deprecation for details - |a: String - | - |scala> :settings -deprecation - | - |scala> def b = depp - |:11: warning: method depp is deprecated: Please don't do that. - | def b = depp - | ^ - |b: String - | - |scala> :quit""" +"""| + |scala> @deprecated(message="Please don't do that.", since="Time began.") def depp = "john" + |depp: String + | + |scala> def a = depp + |warning: there was one deprecation warning; re-run with -deprecation for details + |a: String + | + |scala> :settings -deprecation + | + |scala> def b = depp + |:11: warning: method depp is deprecated: Please don't do that. + | def b = depp + | ^ + |b: String + | + |scala> :quit""" } diff --git a/test/files/run/t4671.check b/test/files/run/t4671.check index 1640dac8e4..b267befee9 100644 --- a/test/files/run/t4671.check +++ b/test/files/run/t4671.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> object o { val file = sys.props("partest.cwd") + "/t4671.scala" } defined object o diff --git a/test/files/run/t4710.check b/test/files/run/t4710.check index 0dd49dfbd3..5f90c68ed1 100644 --- a/test/files/run/t4710.check +++ b/test/files/run/t4710.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> def method : String = { implicit def f(s: Symbol) = "" ; 'symbol } warning: there was one feature warning; re-run with -feature for details diff --git a/test/files/run/t4950.check b/test/files/run/t4950.check index 3f3a302b62..8994441163 100644 --- a/test/files/run/t4950.check +++ b/test/files/run/t4950.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> val 1 = 2 scala.MatchError: 2 (of class java.lang.Integer) diff --git a/test/files/run/t5072.check b/test/files/run/t5072.check index ab34e49869..586c0a6004 100644 --- a/test/files/run/t5072.check +++ b/test/files/run/t5072.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> class C defined class C diff --git a/test/files/run/t5256d.check b/test/files/run/t5256d.check index c2b49989ab..3cdcb577b0 100644 --- a/test/files/run/t5256d.check +++ b/test/files/run/t5256d.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ diff --git a/test/files/run/t5535.check b/test/files/run/t5535.check index 84097ccea9..11d298c602 100644 --- a/test/files/run/t5535.check +++ b/test/files/run/t5535.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> def h()(i: Int) = 1 + i h: ()(i: Int)Int diff --git a/test/files/run/t5537.check b/test/files/run/t5537.check index 98265ccc92..bffa02f334 100644 --- a/test/files/run/t5537.check +++ b/test/files/run/t5537.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> List[Predef.type]() res0: List[scala.Predef.type] = List() diff --git a/test/files/run/t5583.check b/test/files/run/t5583.check index 32d285cbb3..72ad898e90 100644 --- a/test/files/run/t5583.check +++ b/test/files/run/t5583.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> var s = 0 s: Int = 0 diff --git a/test/files/run/t5655.check b/test/files/run/t5655.check index e8375c3e90..857a5ab556 100644 --- a/test/files/run/t5655.check +++ b/test/files/run/t5655.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> object x { def x={} } defined object x diff --git a/test/files/run/t5789.check b/test/files/run/t5789.check index 193abfaff0..d286922acc 100644 --- a/test/files/run/t5789.check +++ b/test/files/run/t5789.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> val n = 2 n: Int = 2 diff --git a/test/files/run/t6086-repl.check b/test/files/run/t6086-repl.check index b904f118e8..f022e841cd 100644 --- a/test/files/run/t6086-repl.check +++ b/test/files/run/t6086-repl.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> case class X(s: String) defined class X diff --git a/test/files/run/t6146b.check b/test/files/run/t6146b.check index 6998873fb7..0e0c216cd7 100644 --- a/test/files/run/t6146b.check +++ b/test/files/run/t6146b.check @@ -2,8 +2,6 @@ t6146b.scala:15: warning: match may not be exhaustive. It would fail on the following inputs: S2(), S3() def foo(f: F[Int]) = f match { case X.S1 => } ^ -Type in expressions to have them evaluated. -Type :help for more information. scala> :power ** Power User mode enabled - BEEP WHIR GYVE ** diff --git a/test/files/run/t6187.check b/test/files/run/t6187.check index 9a9e266ec6..28bc7e34b6 100644 --- a/test/files/run/t6187.check +++ b/test/files/run/t6187.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.language.experimental.macros, scala.reflect.macros.blackbox.Context import scala.language.experimental.macros diff --git a/test/files/run/t6273.check b/test/files/run/t6273.check index 3b682800df..6190ff254e 100644 --- a/test/files/run/t6273.check +++ b/test/files/run/t6273.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> val y = 55 y: Int = 55 diff --git a/test/files/run/t6320.check b/test/files/run/t6320.check index af7c865690..08ef7fc211 100644 --- a/test/files/run/t6320.check +++ b/test/files/run/t6320.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.language.dynamics import scala.language.dynamics diff --git a/test/files/run/t6329_repl.check b/test/files/run/t6329_repl.check index ebb1aace7c..8909c47e79 100644 --- a/test/files/run/t6329_repl.check +++ b/test/files/run/t6329_repl.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.reflect.classTag import scala.reflect.classTag diff --git a/test/files/run/t6329_repl_bug.check b/test/files/run/t6329_repl_bug.check index 84297a629f..4b539f9e58 100644 --- a/test/files/run/t6329_repl_bug.check +++ b/test/files/run/t6329_repl_bug.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ diff --git a/test/files/run/t6381.check b/test/files/run/t6381.check index 49c6a784ad..c66eb4c376 100644 --- a/test/files/run/t6381.check +++ b/test/files/run/t6381.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.language.experimental.macros import scala.language.experimental.macros diff --git a/test/files/run/t6434.check b/test/files/run/t6434.check index 0a75ae2bd5..1f123ee9cd 100644 --- a/test/files/run/t6434.check +++ b/test/files/run/t6434.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> def f(x: => Int): Int = x f: (x: => Int)Int diff --git a/test/files/run/t6439.check b/test/files/run/t6439.check index c4b7591069..eee2da1b12 100644 --- a/test/files/run/t6439.check +++ b/test/files/run/t6439.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> class A defined class A diff --git a/test/files/run/t6507.check b/test/files/run/t6507.check index 3ca5e8e55c..75cf392304 100644 --- a/test/files/run/t6507.check +++ b/test/files/run/t6507.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> :silent diff --git a/test/files/run/t6549.check b/test/files/run/t6549.check index be3445927e..00203d5cc7 100644 --- a/test/files/run/t6549.check +++ b/test/files/run/t6549.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> case class `X"`(var xxx: Any) defined class X$u0022 diff --git a/test/files/run/t6937.check b/test/files/run/t6937.check index 5c5d4485b6..b7b2f45385 100644 --- a/test/files/run/t6937.check +++ b/test/files/run/t6937.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.reflect.runtime.{universe => ru} import scala.reflect.runtime.{universe=>ru} diff --git a/test/files/run/t7185.check b/test/files/run/t7185.check index e4f80a8ff9..6b7fbaf0b1 100644 --- a/test/files/run/t7185.check +++ b/test/files/run/t7185.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.tools.reflect.ToolBox import scala.tools.reflect.ToolBox diff --git a/test/files/run/t7319.check b/test/files/run/t7319.check index 885136b432..31923e7119 100644 --- a/test/files/run/t7319.check +++ b/test/files/run/t7319.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> class M[A] defined class M diff --git a/test/files/run/t7482a.check b/test/files/run/t7482a.check index a21ef7b68f..1120bb0271 100644 --- a/test/files/run/t7482a.check +++ b/test/files/run/t7482a.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> val v: java.util.ArrayList[String] = new java.util.ArrayList[String](5) v: java.util.ArrayList[String] = [] diff --git a/test/files/run/t7634.check b/test/files/run/t7634.check index 9c6b8b47dd..879aea67a2 100644 --- a/test/files/run/t7634.check +++ b/test/files/run/t7634.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> .lines diff --git a/test/files/run/t7747-repl.check b/test/files/run/t7747-repl.check index 98e3d3b821..f19c39e7e1 100644 --- a/test/files/run/t7747-repl.check +++ b/test/files/run/t7747-repl.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> var x = 10 x: Int = 10 diff --git a/test/files/run/t7801.check b/test/files/run/t7801.check index e0b656b784..4ec89f0de6 100644 --- a/test/files/run/t7801.check +++ b/test/files/run/t7801.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> val g: scala.reflect.internal.SymbolTable = null; import g.abort g: scala.reflect.internal.SymbolTable = null diff --git a/test/files/run/t7805-repl-i.check b/test/files/run/t7805-repl-i.check index 7f66c06a11..977de0b047 100644 --- a/test/files/run/t7805-repl-i.check +++ b/test/files/run/t7805-repl-i.check @@ -1,9 +1,9 @@ Loading t7805-repl-i.script... import util._ -Welcome to Scala -Type in expressions to have them evaluated. -Type :help for more information. +Welcome to Scala! +version +Type in expressions for evaluation. Or try :help. scala> Console println Try(8) Success(8) diff --git a/test/files/run/t8843-repl-xlat.scala b/test/files/run/t8843-repl-xlat.scala index 6426dbe7d4..215dd97061 100644 --- a/test/files/run/t8843-repl-xlat.scala +++ b/test/files/run/t8843-repl-xlat.scala @@ -4,9 +4,7 @@ import scala.tools.partest.SessionTest // Handy hamburger helper for repl resources object Test extends SessionTest { def session = -"""Type in expressions to have them evaluated. -Type :help for more information. - +""" scala> $intp.isettings.unwrapStrings = false $intp.isettings.unwrapStrings: Boolean = false diff --git a/test/files/run/t9170.scala b/test/files/run/t9170.scala index 67a58d6803..d6cf516615 100644 --- a/test/files/run/t9170.scala +++ b/test/files/run/t9170.scala @@ -6,9 +6,7 @@ object Test extends SessionTest { override def stripMargins = false def session = -"""Type in expressions to have them evaluated. -Type :help for more information. - +""" scala> object Y { def f[A](a: => A) = 1 ; def f[A](a: => Either[Exception, A]) = 2 } :10: error: double definition: def f[A](a: => A): Int at line 10 and diff --git a/test/files/run/t9206.scala b/test/files/run/t9206.scala index 2942d0f73e..872c980fe4 100644 --- a/test/files/run/t9206.scala +++ b/test/files/run/t9206.scala @@ -5,9 +5,7 @@ object Test extends SessionTest { //override def prompt = "XXX> " //Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_40). def session = - s"""|Type in expressions to have them evaluated. - |Type :help for more information. - | + s"""| |scala> val i: Int = "foo" |:10: error: type mismatch; | found : String("foo") diff --git a/test/files/run/tpeCache-tyconCache.check b/test/files/run/tpeCache-tyconCache.check index ff604819e0..ac13d32f91 100644 --- a/test/files/run/tpeCache-tyconCache.check +++ b/test/files/run/tpeCache-tyconCache.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> :power ** Power User mode enabled - BEEP WHIR GYVE ** diff --git a/test/files/run/xMigration.check b/test/files/run/xMigration.check index 304132a848..79ce544493 100644 --- a/test/files/run/xMigration.check +++ b/test/files/run/xMigration.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> Map(1 -> "eis").values // no warn res0: Iterable[String] = MapLike(eis) -- cgit v1.2.3 From fac81d705ff0bfdeb3320fd9e46b6d3d34e47ddf Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Thu, 25 Jun 2015 10:16:58 -0700 Subject: SI-9206 De-perk the welcome message The welcome message defaults to a sober header followed by one line of instructions. --- src/compiler/scala/tools/nsc/Properties.scala | 3 +- .../scala/tools/partest/ReplTest.scala | 14 ++-- test/files/run/repl-javap-app.check | 9 +-- test/files/run/repl-trim-stack-trace.scala | 3 +- test/files/run/t6502.scala | 76 +++++++++++++++------- test/files/run/t7805-repl-i.check | 3 +- 6 files changed, 68 insertions(+), 40 deletions(-) (limited to 'test/files') diff --git a/src/compiler/scala/tools/nsc/Properties.scala b/src/compiler/scala/tools/nsc/Properties.scala index 3da02ebe37..cb523edfe5 100644 --- a/src/compiler/scala/tools/nsc/Properties.scala +++ b/src/compiler/scala/tools/nsc/Properties.scala @@ -18,8 +18,7 @@ object Properties extends scala.util.PropertiesTrait { def residentPromptString = scalaPropOrElse("resident.prompt", "\nnsc> ") def shellPromptString = scalaPropOrElse("shell.prompt", "%nscala> ") def shellWelcomeString = scalaPropOrElse("shell.welcome", - """Welcome to Scala! - |%1$s (%3$s, Java %2$s). + """Welcome to Scala %1$#s (%3$s, Java %2$s). |Type in expressions for evaluation. Or try :help.""".stripMargin ) diff --git a/src/partest-extras/scala/tools/partest/ReplTest.scala b/src/partest-extras/scala/tools/partest/ReplTest.scala index 756ae21b43..20dfe0eb16 100644 --- a/src/partest-extras/scala/tools/partest/ReplTest.scala +++ b/src/partest-extras/scala/tools/partest/ReplTest.scala @@ -34,13 +34,15 @@ abstract class ReplTest extends DirectTest { log("eval(): settings = " + s) val lines = ILoop.runForTranscript(code, s, inSession = inSession).lines (if (welcoming) { - val welcome = Regex.quote(header.lines.next).r - val version = "(.*version).*".r - var inHead = false + val welcome = "(Welcome to Scala).*".r + //val welcome = Regex.quote(header.lines.next).r + //val version = "(.*version).*".r // version on separate line? + //var inHead = false lines map { - case s @ welcome() => inHead = true ; s - case version(s) if inHead => inHead = false ; s - case s => s + //case s @ welcome() => inHead = true ; s + //case version(s) if inHead => inHead = false ; s + case welcome(s) => s + case s => s } } else { lines drop header.lines.size diff --git a/test/files/run/repl-javap-app.check b/test/files/run/repl-javap-app.check index d29682cca5..bace9534da 100644 --- a/test/files/run/repl-javap-app.check +++ b/test/files/run/repl-javap-app.check @@ -1,6 +1,5 @@ #partest java6 -Welcome to Scala! -version +Welcome to Scala Type in expressions for evaluation. Or try :help. scala> :javap -app MyApp$ @@ -17,8 +16,7 @@ public final void delayedEndpoint$MyApp$1(); scala> :quit #partest java7 -Welcome to Scala! -version +Welcome to Scala Type in expressions for evaluation. Or try :help. scala> :javap -app MyApp$ @@ -39,8 +37,7 @@ scala> :javap -app MyApp$ scala> :quit #partest java8 -Welcome to Scala! -version +Welcome to Scala Type in expressions for evaluation. Or try :help. scala> :javap -app MyApp$ diff --git a/test/files/run/repl-trim-stack-trace.scala b/test/files/run/repl-trim-stack-trace.scala index d128d4c39a..ea91e32239 100644 --- a/test/files/run/repl-trim-stack-trace.scala +++ b/test/files/run/repl-trim-stack-trace.scala @@ -4,8 +4,7 @@ import scala.tools.partest.{ SessionTest, Welcoming } // SI-7740 object Test extends SessionTest with Welcoming { def session = -"""Welcome to Scala! -version +"""Welcome to Scala Type in expressions for evaluation. Or try :help. scala> def f = throw new Exception("Uh-oh") diff --git a/test/files/run/t6502.scala b/test/files/run/t6502.scala index d6b15a0189..f4fc39a03d 100644 --- a/test/files/run/t6502.scala +++ b/test/files/run/t6502.scala @@ -1,11 +1,14 @@ import scala.tools.nsc.Settings -import scala.tools.nsc.interpreter.ILoop +import scala.tools.nsc.interpreter.{ ILoop, replProps } import scala.tools.nsc.settings.ClassPathRepresentationType import scala.tools.partest._ object Test extends StoreReporterDirectTest { def code = ??? + lazy val headerLength = replProps.welcome.lines.size + lazy val promptLength = replProps.prompt.lines.size - 1 // extra newlines + def compileCode(code: String, jarFileName: String) = { val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator") compileString(newCompiler("-cp", classpath, "-d", s"${testOutput.path}/$jarFileName"))(code) @@ -56,14 +59,21 @@ object Test extends StoreReporterDirectTest { val jar = "test1.jar" compileCode(app1, jar) - val codeToRun = toCodeInSeparateLines(s":require ${testOutput.path}/$jar", "test.Test.test()") + val codeToRun = s""" + |:require ${testOutput.path}/$jar + |test.Test.test() + |""".stripMargin.trim val output = ILoop.run(codeToRun, settings) - val lines = output.split("\n") - assert { - lines(4).contains("Added") && lines(4).contains("test1.jar") - } + var lines = output.lines.drop(headerLength) + lines = lines drop promptLength + val added = lines.next + assert ( + added.contains("Added") && added.contains("test1.jar"), + s"[${added}] in [${output.lines.mkString("/")}]" + ) + lines = lines drop promptLength assert { - lines(lines.length-3).contains("testing...") + lines.next.contains("testing...") } } @@ -73,14 +83,21 @@ object Test extends StoreReporterDirectTest { val jar2 = "test2.jar" compileCode(app2, jar2) - val codeToRun = toCodeInSeparateLines(s":require ${testOutput.path}/$jar1", s":require ${testOutput.path}/$jar2") + val codeToRun = s""" + |:require ${testOutput.path}/$jar1 + |:require ${testOutput.path}/$jar2 + |""".stripMargin.trim val output = ILoop.run(codeToRun, settings) - val lines = output.split("\n") + var lines = output.lines.drop(headerLength) + lines = lines drop promptLength + val added = lines.next assert { - lines(4).contains("Added") && lines(4).contains("test1.jar") + added.contains("Added") && added.contains("test1.jar") } + lines = lines drop promptLength + val msg = lines.next assert { - lines(lines.length-3).contains("test2.jar") && lines(lines.length-3).contains("existing classpath entries conflict") + msg.contains("test2.jar") && msg.contains("existing classpath entries conflict") } } @@ -90,28 +107,42 @@ object Test extends StoreReporterDirectTest { val jar3 = "test3.jar" compileCode(app3, jar3) - val codeToRun = toCodeInSeparateLines(s":require ${testOutput.path}/$jar1", s":require ${testOutput.path}/$jar3", "test.Test3.test()") + val codeToRun = s""" + |:require ${testOutput.path}/$jar1 + |:require ${testOutput.path}/$jar3 + |test.Test3.test() + |""".stripMargin.trim val output = ILoop.run(codeToRun, settings) - val lines = output.split("\n") + var lines = output.lines.drop(headerLength) + lines = lines drop promptLength + val added = lines.next assert { - lines(4).contains("Added") && lines(4).contains("test1.jar") + added.contains("Added") && added.contains("test1.jar") } + lines = lines drop (2 * promptLength + 1) assert { - lines(lines.length-3).contains("new object in existing package") + lines.next.contains("new object in existing package") } } def test4(): Unit = { // twice the same jar should be rejected val jar1 = "test1.jar" - val codeToRun = toCodeInSeparateLines(s":require ${testOutput.path}/$jar1", s":require ${testOutput.path}/$jar1") + val codeToRun = s""" + |:require ${testOutput.path}/$jar1 + |:require ${testOutput.path}/$jar1 + |""".stripMargin.trim val output = ILoop.run(codeToRun, settings) - val lines = output.split("\n") + var lines = output.lines.drop(headerLength) + lines = lines drop promptLength + val added = lines.next assert { - lines(4).contains("Added") && lines(4).contains("test1.jar") + added.contains("Added") && added.contains("test1.jar") } + lines = lines drop promptLength + val msg = lines.next assert { - lines(lines.length-3).contains("test1.jar") && lines(lines.length-3).contains("existing classpath entries conflict") + msg.contains("test1.jar") && msg.contains("existing classpath entries conflict") } } @@ -127,7 +158,10 @@ object Test extends StoreReporterDirectTest { // classloader to parse .class files in order to read their names. val jar = "test6.jar" compileCode(app6, jar) - val codeToRun = toCodeInSeparateLines(s":require ${testOutput.path}/$jar", "import test6._; new A; new Z") + val codeToRun = s""" + |:require ${testOutput.path}/$jar + |import test6._; new A; new Z + |""".stripMargin.trim val output = ILoop.run(codeToRun, settings) assert(output.contains("created test6.A"), output) assert(output.contains("created test6.Z"), output) @@ -141,6 +175,4 @@ object Test extends StoreReporterDirectTest { test5() test6() } - - def toCodeInSeparateLines(lines: String*): String = lines mkString "\n" } diff --git a/test/files/run/t7805-repl-i.check b/test/files/run/t7805-repl-i.check index 977de0b047..24512c0067 100644 --- a/test/files/run/t7805-repl-i.check +++ b/test/files/run/t7805-repl-i.check @@ -1,8 +1,7 @@ Loading t7805-repl-i.script... import util._ -Welcome to Scala! -version +Welcome to Scala Type in expressions for evaluation. Or try :help. scala> Console println Try(8) -- cgit v1.2.3 From 96b012aa48e3d91f8ec6d5221df2f455f278c9e0 Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Fri, 26 Jun 2015 21:32:29 -0700 Subject: Improved message for missing argument list Clarifies the language and rules for eta-expansion. A missing argument in a list, as opposed to a missing argument list, results in a different message. The comical expansion in parens does not attempt to show what was already applied, but succeeds in showing at a glance the shape of the method in question. ``` scala> def m(i: Int, j: Int)(x: Int) = ??? m: (i: Int, j: Int)(x: Int)Nothing scala> m :12: error: missing argument list for method m Unapplied methods are only converted to functions when a function type is expected. You can make this conversion explicit by writing `m _` or `m(_,_)(_)` instead of `m`. m ^ ``` The original submission was due to sschaef and the wording due to adriaanm, with a minor tweak. --- .../tools/nsc/typechecker/ContextErrors.scala | 37 +++++++++++----------- test/files/neg/macro-invalidshape.check | 5 +-- test/files/neg/missing-arg-list.check | 21 ++++++++++++ test/files/neg/missing-arg-list.scala | 13 ++++++++ 4 files changed, 55 insertions(+), 21 deletions(-) create mode 100644 test/files/neg/missing-arg-list.check create mode 100644 test/files/neg/missing-arg-list.scala (limited to 'test/files') diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala index c80aaea160..b0bd9977a8 100644 --- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala +++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala @@ -550,23 +550,18 @@ trait ContextErrors { def ModuleUsingCompanionClassDefaultArgsErrror(tree: Tree) = NormalTypeError(tree, "module extending its companion class cannot use default constructor arguments") - def NotEnoughArgsError(tree: Tree, fun0: Tree, missing0: List[Symbol]) = { - def notEnoughArgumentsMsg(fun: Tree, missing: List[Symbol]) = { - val suffix = { - if (missing.isEmpty) "" - else { - val keep = missing take 3 map (_.name) - ".\nUnspecified value parameter%s %s".format( - if (missing.tail.isEmpty) "" else "s", - if ((missing drop 3).nonEmpty) (keep :+ "...").mkString(", ") - else keep.mkString("", ", ", ".") - ) - } + def NotEnoughArgsError(tree: Tree, fun: Tree, missing: List[Symbol]) = { + val notEnoughArgumentsMsg = { + val suffix = if (missing.isEmpty) "" else { + val keep = missing take 3 map (_.name) + val ess = if (missing.tail.isEmpty) "" else "s" + f".%nUnspecified value parameter$ess ${ + keep.mkString("", ", ", if ((missing drop 3).nonEmpty) "..." else ".") + }" } - - "not enough arguments for " + treeSymTypeMsg(fun) + suffix + s"not enough arguments for ${ treeSymTypeMsg(fun) }$suffix" } - NormalTypeError(tree, notEnoughArgumentsMsg(fun0, missing0)) + NormalTypeError(tree, notEnoughArgumentsMsg) } //doTypedApply - patternMode @@ -632,12 +627,16 @@ trait ContextErrors { //adapt def MissingArgsForMethodTpeError(tree: Tree, meth: Symbol) = { + val f = meth.name + val paf = s"$f(${ meth.asMethod.paramLists map (_ map (_ => "_") mkString ",") mkString ")(" })" + val advice = s""" + |Unapplied methods are only converted to functions when a function type is expected. + |You can make this conversion explicit by writing `$f _` or `$paf` instead of `$f`.""".stripMargin val message = if (meth.isMacro) MacroTooFewArgumentListsMessage - else "missing arguments for " + meth.fullLocationString + ( - if (meth.isConstructor) "" - else ";\nfollow this method with `_' if you want to treat it as a partially applied function" - ) + else s"""missing argument list for ${meth.fullLocationString}${ + if (!meth.isConstructor) advice else "" + }""" issueNormalTypeError(tree, message) setError(tree) } diff --git a/test/files/neg/macro-invalidshape.check b/test/files/neg/macro-invalidshape.check index aa694df6d6..5093b87598 100644 --- a/test/files/neg/macro-invalidshape.check +++ b/test/files/neg/macro-invalidshape.check @@ -8,8 +8,9 @@ macro [].[[]] or macro [].[[]] def foo2(x: Any) = macro Impls.foo(null)(null) ^ -Macros_Test_2.scala:4: error: missing arguments for method foo in object Impls; -follow this method with `_' if you want to treat it as a partially applied function +Macros_Test_2.scala:4: error: missing argument list for method foo in object Impls +Unapplied methods are only converted to functions when a function type is expected. +You can make this conversion explicit by writing `foo _` or `foo(_)(_)` instead of `foo`. def foo3(x: Any) = macro {2; Impls.foo} ^ Macros_Test_2.scala:7: error: macro implementation reference has wrong shape. required: diff --git a/test/files/neg/missing-arg-list.check b/test/files/neg/missing-arg-list.check new file mode 100644 index 0000000000..5a011c36f2 --- /dev/null +++ b/test/files/neg/missing-arg-list.check @@ -0,0 +1,21 @@ +missing-arg-list.scala:9: error: missing argument list for method id in trait T +Unapplied methods are only converted to functions when a function type is expected. +You can make this conversion explicit by writing `id _` or `id(_)` instead of `id`. + val w = id + ^ +missing-arg-list.scala:10: error: missing argument list for method f in trait T +Unapplied methods are only converted to functions when a function type is expected. +You can make this conversion explicit by writing `f _` or `f(_)(_)` instead of `f`. + val x = f + ^ +missing-arg-list.scala:11: error: missing argument list for method g in trait T +Unapplied methods are only converted to functions when a function type is expected. +You can make this conversion explicit by writing `g _` or `g(_,_,_)` instead of `g`. + val y = g + ^ +missing-arg-list.scala:12: error: missing argument list for method h in trait T +Unapplied methods are only converted to functions when a function type is expected. +You can make this conversion explicit by writing `h _` or `h(_,_,_)(_)` instead of `h`. + val z = h + ^ +four errors found diff --git a/test/files/neg/missing-arg-list.scala b/test/files/neg/missing-arg-list.scala new file mode 100644 index 0000000000..c422dd32fe --- /dev/null +++ b/test/files/neg/missing-arg-list.scala @@ -0,0 +1,13 @@ + +trait T { + + def id(i: Int) = i + def f(i: Int)(j: Int) = i+j + def g(i: Int, j: Int, k: Int) = i+j+k + def h(i: Int, j: Int, k: Int)(implicit s: String) = s*(i+j+k) + + val w = id + val x = f + val y = g + val z = h +} -- cgit v1.2.3 From b17a291c2edf28aca1713aa4a30d8bba3886bc8d Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Sun, 28 Jun 2015 23:10:12 +1000 Subject: GenBCode: fix incrementatal compilation by mimicing GenASM The incremental compiler in SBT uses an implementation detail of the compiler backend to enumerate the classes that are actually written to disk. This commit mimics this in GenBCode by populating `Run#icode` with an `IClass` for each `ClassDef` processed. We should revisit this by creating a dedicated API for this purpose and migrating SBT to use that. We should also revisit this code as we implement closure elimination in the GenBCode; this commit assumes that all `ClassDef`s that enter the backend will generate classfile products. The enclosed test is extracted from the incrementatl compiler. I've also manually integration tested this with SBT: https://gist.github.com/retronym/fabf6f92787ea9c1ce67 --- .../scala/tools/nsc/backend/jvm/GenBCode.scala | 5 +++ test/files/run/sbt-icode-interface.scala | 42 ++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 test/files/run/sbt-icode-interface.scala (limited to 'test/files') diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala index 455117d837..af962c4ce0 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala @@ -167,6 +167,11 @@ abstract class GenBCode extends BCodeSyncAndTry { ) } + // shim for SBT, see https://github.com/sbt/sbt/issues/2076 + // TODO put this closer to classfile writing once we have closure elimination + // TODO create a nicer public API to find out the correspondence between sourcefile and ultimate classfiles + currentUnit.icode += new icodes.IClass(cd.symbol) + // -------------- mirror class, if needed -------------- val mirrorC = if (isTopLevelModuleClass(claszSymbol)) { diff --git a/test/files/run/sbt-icode-interface.scala b/test/files/run/sbt-icode-interface.scala new file mode 100644 index 0000000000..84d38cc65a --- /dev/null +++ b/test/files/run/sbt-icode-interface.scala @@ -0,0 +1,42 @@ +import scala.tools.partest._ +import scala.tools.nsc._ + +object Test extends DirectTest { + + def code = """ + class C { class D } + object O + """.trim + + def show() { + for (b <- List("GenASM", "GenBCode")) { + val global = newCompiler("-usejavacp", s"-Ybackend:$b") + import global._ + val r = new Run + r.compileSources(newSourceFile(code) :: Nil) + + val results = collection.mutable.Buffer[(Boolean, String)]() + + // Nailing down defacto compiler API from SBT's usage + // https://github.com/sbt/sbt/blob/adb41611cf73260938274915d8462d924df200c8/compile/interface/src/main/scala/xsbt/Analyzer.scala#L29-L41 + def isTopLevelModule(sym: Symbol) = sym.isTopLevel && sym.isModule + for (unit <- currentRun.units if !unit.isJava) { + val sourceFile = unit.source.file.file + for (iclass <- unit.icode) { + val sym = iclass.symbol + def addGenerated(separatorRequired: Boolean) { + results += (separatorRequired -> sym.fullName) + } + if (sym.isModuleClass && !sym.isImplClass) { + if (isTopLevelModule(sym) && sym.companionClass == NoSymbol) + addGenerated(false) + addGenerated(true) + } else + addGenerated(false) + } + } + val expected = List((false, "C"), (true, "O"), (false, "C$D")) + assert(results.toList == expected, b + ": " + results.toList) + } + } +} -- cgit v1.2.3 From 39ab6a3dff800c2e63b3749f44d1ebfbfe86ea8b Mon Sep 17 00:00:00 2001 From: Janek Bogucki Date: Sun, 28 Jun 2015 21:32:05 +0100 Subject: Fix 23 typos (m-o) --- spec/04-basic-declarations-and-definitions.md | 2 +- src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala | 4 ++-- src/compiler/scala/tools/nsc/reporters/Reporter.scala | 2 +- src/compiler/scala/tools/nsc/transform/patmat/MatchWarnings.scala | 2 +- src/compiler/scala/tools/nsc/typechecker/Contexts.scala | 2 +- src/partest-extras/scala/tools/partest/ASMConverters.scala | 2 +- src/reflect/scala/reflect/internal/Types.scala | 4 ++-- src/reflect/scala/reflect/internal/tpe/TypeConstraints.scala | 2 +- src/reflect/scala/reflect/macros/FrontEnds.scala | 2 +- .../src/scala/collection/parallel/benchmarks/misc/Coder.scala | 4 ++-- test/disabled/coder/Coder.scala | 4 ++-- test/disabled/run/coder2/Coder2.scala | 2 +- test/files/neg/t836.scala | 2 +- test/files/neg/warn-unused-privates.scala | 2 +- test/files/run/ReplacementMatching.scala | 4 ++-- test/files/run/t6440b.scala | 2 +- test/junit/scala/tools/nsc/backend/jvm/DirectCompileTest.scala | 2 +- test/junit/scala/tools/nsc/classpath/FlatClassPathResolverTest.scala | 2 +- 18 files changed, 23 insertions(+), 23 deletions(-) (limited to 'test/files') diff --git a/spec/04-basic-declarations-and-definitions.md b/spec/04-basic-declarations-and-definitions.md index 8437d2ea71..7790428ca8 100644 --- a/spec/04-basic-declarations-and-definitions.md +++ b/spec/04-basic-declarations-and-definitions.md @@ -627,7 +627,7 @@ parameters and associate them with their types. Each value parameter declaration may optionally define a default argument. The default argument expression $e$ is type-checked with an expected type $T'$ obtained -by replacing all occurences of the function's type parameters in $T$ by +by replacing all occurrences of the function's type parameters in $T$ by the undefined type. For every parameter $p_{i,j}$ with a default argument a method named diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala b/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala index 7f0aaa7305..8720da84e8 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala @@ -648,7 +648,7 @@ abstract class BTypes { * JVMS 4.7.7: the attribute must be present "if and only if it represents a local class * or an anonymous class" (i.e. not for member classes). * - * The attribute is mis-named, it should be called "EnclosingClass". It has to be defined for all + * The attribute is misnamed, it should be called "EnclosingClass". It has to be defined for all * local and anonymous classes, no matter if there is an enclosing method or not. Accordingly, the * "class" field (see below) must be always defined, while the "method" field may be null. * @@ -798,7 +798,7 @@ abstract class BTypes { * 2. The ClassBType should be built from a classfile, but the class could not be found on the * compilation classpath. * - * Note that all ClassBTypes required in a non-optimzied run are built during code generation from + * Note that all ClassBTypes required in a non-optimized run are built during code generation from * the class symbols referenced by the ASTs, so they have a valid info. Therefore the backend * often invokes `info.get` (which asserts the info to exist) when reading data from the ClassBType. * diff --git a/src/compiler/scala/tools/nsc/reporters/Reporter.scala b/src/compiler/scala/tools/nsc/reporters/Reporter.scala index 3d688efae1..bd438f0e75 100644 --- a/src/compiler/scala/tools/nsc/reporters/Reporter.scala +++ b/src/compiler/scala/tools/nsc/reporters/Reporter.scala @@ -20,7 +20,7 @@ abstract class Reporter extends scala.reflect.internal.Reporter { /** Informational messages. If `!force`, they may be suppressed. */ final def info(pos: Position, msg: String, force: Boolean): Unit = info0(pos, msg, INFO, force) - /** For sending a message which should not be labeled as a warning/error, + /** For sending a message which should not be labelled as a warning/error, * but also shouldn't require -verbose to be visible. */ def echo(msg: String): Unit = info(NoPosition, msg, force = true) diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchWarnings.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchWarnings.scala index 9e9372f709..8beb1837ad 100644 --- a/src/compiler/scala/tools/nsc/transform/patmat/MatchWarnings.scala +++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchWarnings.scala @@ -40,7 +40,7 @@ trait MatchWarnings { } } - // Issue better warnings than "unreachable code" when people mis-use + // Issue better warnings than "unreachable code" when people misuse // variable patterns thinking they bind to existing identifiers. // // Possible TODO: more deeply nested variable patterns, like diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index 542f58795a..a7ef5d5d2f 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -1537,7 +1537,7 @@ object ContextMode { final val TypeConstructorAllowed: ContextMode = 1 << 16 /** TODO: The "sticky modes" are EXPRmode, PATTERNmode, TYPEmode. - * To mimick the sticky mode behavior, when captain stickyfingers + * To mimic the sticky mode behavior, when captain stickyfingers * comes around we need to propagate those modes but forget the other * context modes which were once mode bits; those being so far the * ones listed here. diff --git a/src/partest-extras/scala/tools/partest/ASMConverters.scala b/src/partest-extras/scala/tools/partest/ASMConverters.scala index f6e2d2a9ec..90f314428b 100644 --- a/src/partest-extras/scala/tools/partest/ASMConverters.scala +++ b/src/partest-extras/scala/tools/partest/ASMConverters.scala @@ -131,7 +131,7 @@ object ASMConverters { import collection.mutable.{Map => MMap} /** - * Bytecode is equal modula local variable numbering and label numbering. + * Bytecode is equal modulo local variable numbering and label numbering. */ def equivalentBytecode(as: List[Instruction], bs: List[Instruction], varMap: MMap[Int, Int] = MMap(), labelMap: MMap[Int, Int] = MMap()): Boolean = { def same(v1: Int, v2: Int, m: MMap[Int, Int]) = { diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala index f74d976b82..c760db3864 100644 --- a/src/reflect/scala/reflect/internal/Types.scala +++ b/src/reflect/scala/reflect/internal/Types.scala @@ -918,7 +918,7 @@ trait Types def prefixString = trimPrefix(toString) + "#" /** Convert toString avoiding infinite recursions by cutting off - * after `maxTostringRecursions` recursion levels. Uses `safeToString` + * after `maxToStringRecursions` recursion levels. Uses `safeToString` * to produce a string on each level. */ override final def toString: String = { @@ -1489,7 +1489,7 @@ trait Types } finally { if (Statistics.canEnable) Statistics.popTimer(typeOpsStack, start) } - // [Martin] suppressing memo-ization solves the problem with "same type after erasure" errors + // [Martin] suppressing memoization solves the problem with "same type after erasure" errors // when compiling with // scalac scala.collection.IterableViewLike.scala scala.collection.IterableLike.scala // I have not yet figured out precisely why this is the case. diff --git a/src/reflect/scala/reflect/internal/tpe/TypeConstraints.scala b/src/reflect/scala/reflect/internal/tpe/TypeConstraints.scala index f79099213a..e321a07f51 100644 --- a/src/reflect/scala/reflect/internal/tpe/TypeConstraints.scala +++ b/src/reflect/scala/reflect/internal/tpe/TypeConstraints.scala @@ -99,7 +99,7 @@ private[internal] trait TypeConstraints { // a lower bound despite the fact that Nothing is always a lower bound. My current // supposition is that the side-effecting type constraint accumulation mechanism // depends on these subtype tests being performed to make forward progress when - // there are mutally recursive type vars. + // there are mutually recursive type vars. // See pos/t6367 and pos/t6499 for the competing test cases. val mustConsider = tp.typeSymbol match { case NothingClass => true diff --git a/src/reflect/scala/reflect/macros/FrontEnds.scala b/src/reflect/scala/reflect/macros/FrontEnds.scala index a770f325b2..8ad41382a8 100644 --- a/src/reflect/scala/reflect/macros/FrontEnds.scala +++ b/src/reflect/scala/reflect/macros/FrontEnds.scala @@ -12,7 +12,7 @@ package macros trait FrontEnds { self: blackbox.Context => - /** For sending a message which should not be labeled as a warning/error, + /** For sending a message which should not be labelled as a warning/error, * but also shouldn't require -verbose to be visible. * Use `enclosingPosition` if you're in doubt what position to pass to `pos`. */ diff --git a/test/benchmarks/src/scala/collection/parallel/benchmarks/misc/Coder.scala b/test/benchmarks/src/scala/collection/parallel/benchmarks/misc/Coder.scala index 9cc1f4a0f6..04e37085b8 100644 --- a/test/benchmarks/src/scala/collection/parallel/benchmarks/misc/Coder.scala +++ b/test/benchmarks/src/scala/collection/parallel/benchmarks/misc/Coder.scala @@ -16,7 +16,7 @@ class SeqCoder(words: List[String]) { '2' -> "ABC", '3' -> "DEF", '4' -> "GHI", '5' -> "JKL", '6' -> "MNO", '7' -> "PQRS", '8' -> "TUV", '9' -> "WXYZ") - /** Invert the mnemnonics map to give a map from chars 'A' ... 'Z' to '2' ... '9' */ + /** Invert the mnemonics map to give a map from chars 'A' ... 'Z' to '2' ... '9' */ private val charCode: Map[Char, Char] = for ((digit, letters) <- m; letter <- letters) yield letter -> digit @@ -63,7 +63,7 @@ class ParCoder(words: List[String]) { '2' -> "ABC", '3' -> "DEF", '4' -> "GHI", '5' -> "JKL", '6' -> "MNO", '7' -> "PQRS", '8' -> "TUV", '9' -> "WXYZ") - /** Invert the mnemnonics map to give a map from chars 'A' ... 'Z' to '2' ... '9' */ + /** Invert the mnemonics map to give a map from chars 'A' ... 'Z' to '2' ... '9' */ private val charCode: Map[Char, Char] = for ((digit, letters) <- m; letter <- letters) yield letter -> digit diff --git a/test/disabled/coder/Coder.scala b/test/disabled/coder/Coder.scala index 4e29c2a6ee..62b99e0cf0 100644 --- a/test/disabled/coder/Coder.scala +++ b/test/disabled/coder/Coder.scala @@ -10,7 +10,7 @@ class SeqCoder(words: List[String]) { '2' -> "ABC", '3' -> "DEF", '4' -> "GHI", '5' -> "JKL", '6' -> "MNO", '7' -> "PQRS", '8' -> "TUV", '9' -> "WXYZ") - /** Invert the mnemnonics map to give a map from chars 'A' ... 'Z' to '2' ... '9' */ + /** Invert the mnemonics map to give a map from chars 'A' ... 'Z' to '2' ... '9' */ private val charCode: Map[Char, Char] = for ((digit, letters) <- m; letter <- letters) yield letter -> digit @@ -65,7 +65,7 @@ class ParCoder(words: List[String]) { '2' -> "ABC", '3' -> "DEF", '4' -> "GHI", '5' -> "JKL", '6' -> "MNO", '7' -> "PQRS", '8' -> "TUV", '9' -> "WXYZ") - /** Invert the mnemnonics map to give a map from chars 'A' ... 'Z' to '2' ... '9' */ + /** Invert the mnemonics map to give a map from chars 'A' ... 'Z' to '2' ... '9' */ private val charCode: Map[Char, Char] = for ((digit, letters) <- m; letter <- letters) yield letter -> digit diff --git a/test/disabled/run/coder2/Coder2.scala b/test/disabled/run/coder2/Coder2.scala index 43b2e9bcb8..c1ec70b842 100644 --- a/test/disabled/run/coder2/Coder2.scala +++ b/test/disabled/run/coder2/Coder2.scala @@ -10,7 +10,7 @@ class SeqCoder(words: List[String]) { '2' -> "ABC", '3' -> "DEF", '4' -> "GHI", '5' -> "JKL", '6' -> "MNO", '7' -> "PQRS", '8' -> "TUV", '9' -> "WXYZ") - /** Invert the mnemnonics map to give a map from chars 'A' ... 'Z' to '2' ... '9' */ + /** Invert the mnemonics map to give a map from chars 'A' ... 'Z' to '2' ... '9' */ private val charCode: Map[Char, Char] = for ((digit, letters) <- m; letter <- letters) yield letter -> digit diff --git a/test/files/neg/t836.scala b/test/files/neg/t836.scala index 3633b816c6..4b86d04013 100644 --- a/test/files/neg/t836.scala +++ b/test/files/neg/t836.scala @@ -12,5 +12,5 @@ abstract class A { class B extends A { type MyObj = ObjImpl val myString: S = "hello" - val realString: String = myString // error: type missmatch + val realString: String = myString // error: type mismatch } diff --git a/test/files/neg/warn-unused-privates.scala b/test/files/neg/warn-unused-privates.scala index 2faa07e759..2eda280d40 100644 --- a/test/files/neg/warn-unused-privates.scala +++ b/test/files/neg/warn-unused-privates.scala @@ -21,7 +21,7 @@ class B3(msg0: String) extends A("msg") /*** Early defs warnings disabled primarily due to SI-6595. * The test case is here to assure we aren't issuing false positives; - * the ones labeled "warn" don't warn. + * the ones labelled "warn" don't warn. ***/ class Boppy extends { private val hmm: String = "abc" // no warn, used in early defs diff --git a/test/files/run/ReplacementMatching.scala b/test/files/run/ReplacementMatching.scala index 05040d98a3..81034aa510 100644 --- a/test/files/run/ReplacementMatching.scala +++ b/test/files/run/ReplacementMatching.scala @@ -32,12 +32,12 @@ object Test { def groupsMatching { val Date = """(\d+)/(\d+)/(\d+)""".r - for (Regex.Groups(a, b, c) <- Date findFirstMatchIn "1/1/2001 marks the start of the millenium. 31/12/2000 doesn't.") { + for (Regex.Groups(a, b, c) <- Date findFirstMatchIn "1/1/2001 marks the start of the millennium. 31/12/2000 doesn't.") { assert(a == "1") assert(b == "1") assert(c == "2001") } - for (Regex.Groups(a, b, c) <- (Date findAllIn "1/1/2001 marks the start of the millenium. 31/12/2000 doesn't.").matchData) { + for (Regex.Groups(a, b, c) <- (Date findAllIn "1/1/2001 marks the start of the millennium. 31/12/2000 doesn't.").matchData) { assert(a == "1" || a == "31") assert(b == "1" || b == "12") assert(c == "2001" || c == "2000") diff --git a/test/files/run/t6440b.scala b/test/files/run/t6440b.scala index 974aca2844..7ab9529ccb 100644 --- a/test/files/run/t6440b.scala +++ b/test/files/run/t6440b.scala @@ -35,7 +35,7 @@ object Test extends StoreReporterDirectTest { def app2 = """ package pack3 object Test { - pack2.V.u.t // we have to fail if T.class is misisng + pack2.V.u.t // we have to fail if T.class is missing } """ diff --git a/test/junit/scala/tools/nsc/backend/jvm/DirectCompileTest.scala b/test/junit/scala/tools/nsc/backend/jvm/DirectCompileTest.scala index 4086f7dd7b..240d3523f1 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/DirectCompileTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/DirectCompileTest.scala @@ -28,7 +28,7 @@ class DirectCompileTest extends ClearAfterClass { |} """.stripMargin) def s(i: Int, n: Int) = (bytes(i) & 0xff) << n - assertTrue((s(0, 24) | s(1, 16) | s(2, 8) | s(3, 0)) == 0xcafebabe) // mocha java latte machiatto surpreme dark roasted espresso + assertTrue((s(0, 24) | s(1, 16) | s(2, 8) | s(3, 0)) == 0xcafebabe) // mocha java latte macchiato surpreme dark roasted espresso } @Test diff --git a/test/junit/scala/tools/nsc/classpath/FlatClassPathResolverTest.scala b/test/junit/scala/tools/nsc/classpath/FlatClassPathResolverTest.scala index a37ba31b31..5dee488285 100644 --- a/test/junit/scala/tools/nsc/classpath/FlatClassPathResolverTest.scala +++ b/test/junit/scala/tools/nsc/classpath/FlatClassPathResolverTest.scala @@ -42,7 +42,7 @@ class FlatClassPathResolverTest { // In Java TemporaryFolder in JUnit is managed automatically using @Rule. // It would work also in Scala after adding and extending a class like // TestWithTempFolder.java containing it. But in this case it doesn't work when running tests - // from the command line - java class is not compiled due to some, misterious reasons. + // from the command line - java class is not compiled due to some, mysterious reasons. // That's why such dirs are here created and deleted manually. tempDir.create() tempDir.newFile("TestSourceInRootPackage.scala") -- cgit v1.2.3 From 0ff6c81dd3e3e3a60d8f2db845ada167c8266395 Mon Sep 17 00:00:00 2001 From: Janek Bogucki Date: Sun, 28 Jun 2015 21:42:11 +0100 Subject: Improve method names (m-o) --- src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala | 4 ++-- .../parallel/benchmarks/parallel_array/SequentialOps.scala | 6 +++--- test/files/run/finally.check | 2 +- test/files/run/finally.scala | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'test/files') diff --git a/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala b/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala index 8a66c7d274..a702b3cdf5 100644 --- a/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala @@ -305,7 +305,7 @@ trait PatternTypers { // clearing the type is necessary so that ref will be stabilized; see bug 881 val fun1 = typedPos(fun.pos)(Apply(Select(fun.clearType(), unapplyMethod), unapplyArgTree :: Nil)) - def makeTypedUnApply() = { + def makeTypedUnapply() = { // the union of the expected type and the inferred type of the argument to unapply val glbType = glb(ensureFullyDefined(pt) :: unapplyArg.tpe_* :: Nil) val wrapInTypeTest = canRemedy && !(fun1.symbol.owner isNonBottomSubClass ClassTagClass) @@ -325,7 +325,7 @@ trait PatternTypers { if (isBlackbox(unapplyMethod)) duplErrorTree(BlackboxExtractorExpansion(tree)) else duplErrorTree(WrongShapeExtractorExpansion(tree)) } else - makeTypedUnApply() + makeTypedUnapply() } def wrapClassTagUnapply(uncheckedPattern: Tree, classTagExtractor: Tree, pt: Type): Tree = { diff --git a/test/benchmarks/src/scala/collection/parallel/benchmarks/parallel_array/SequentialOps.scala b/test/benchmarks/src/scala/collection/parallel/benchmarks/parallel_array/SequentialOps.scala index ba32036002..9300851b5f 100644 --- a/test/benchmarks/src/scala/collection/parallel/benchmarks/parallel_array/SequentialOps.scala +++ b/test/benchmarks/src/scala/collection/parallel/benchmarks/parallel_array/SequentialOps.scala @@ -425,7 +425,7 @@ trait SequentialOps[T] { } def sequentialDiff(sq: Seq[T], sz: Int) = { - val occmap = occurences(sq) + val occmap = occurrences(sq) val b = new collection.mutable.ArrayBuffer[T] var i = 0 @@ -442,7 +442,7 @@ trait SequentialOps[T] { } def sequentialIntersect(sq: Seq[T], sz: Int) = { - val occmap = occurences(sq) + val occmap = occurrences(sq) val b = new collection.mutable.ArrayBuffer[T] var i = 0 @@ -461,7 +461,7 @@ trait SequentialOps[T] { res } - private def occurences(sq: Seq[T]) = { + private def occurrences(sq: Seq[T]) = { val occmap = new collection.mutable.HashMap[T, Int] { override def default(k: T) = 0 } for (elem <- sq.iterator) occmap(elem) += 1 occmap diff --git a/test/files/run/finally.check b/test/files/run/finally.check index 901a797426..b0f2293d11 100644 --- a/test/files/run/finally.check +++ b/test/files/run/finally.check @@ -29,7 +29,7 @@ body in finally java.lang.Exception ---------------------------------------- -Running nestedFinalies +Running nestedFinallyBlocks in finally 1 in finally 2 ---------------------------------------- diff --git a/test/files/run/finally.scala b/test/files/run/finally.scala index b66354ca03..467c9e5868 100644 --- a/test/files/run/finally.scala +++ b/test/files/run/finally.scala @@ -94,7 +94,7 @@ object Test extends App { } // nested finally blocks with return value - def nestedFinalies: Int = + def nestedFinallyBlocks: Int = try { try { return 10 @@ -123,5 +123,5 @@ object Test extends App { test(throwBody, "throwBody") test(retFinally, "retFinally") test(throwFinally, "throwFinally") - test(nestedFinalies, "nestedFinalies") + test(nestedFinallyBlocks, "nestedFinallyBlocks") } -- cgit v1.2.3 From 3fc4dd8b9656cf7e2947a4b0be2b0aab7261bd22 Mon Sep 17 00:00:00 2001 From: Janek Bogucki Date: Tue, 30 Jun 2015 22:55:28 +0100 Subject: Fix 27 typos (p-r) --- src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala | 2 +- src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala | 2 +- src/compiler/scala/tools/nsc/typechecker/Namers.scala | 4 ++-- src/library/scala/collection/generic/MutableSortedSetFactory.scala | 2 +- src/manual/scala/tools/docutil/ManMaker.scala | 2 +- src/reflect/scala/reflect/api/Internals.scala | 2 +- src/reflect/scala/reflect/internal/Types.scala | 4 ++-- src/reflect/scala/reflect/runtime/SymbolTable.scala | 2 +- src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala | 2 +- src/scaladoc/scala/tools/nsc/doc/base/comment/Comment.scala | 2 +- .../scala/tools/nsc/doc/html/page/diagram/DiagramStats.scala | 2 +- src/scaladoc/scala/tools/nsc/doc/model/Entity.scala | 2 +- src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala | 4 ++-- .../scala/tools/nsc/doc/model/ModelFactoryTypeSupport.scala | 2 +- test/disabled/pos/spec-List.scala | 2 +- test/files/jvm/innerClassEnclMethodJavaReflection.scala | 2 +- test/files/neg/t8675b.scala | 2 +- test/files/pos/t8111.scala | 6 +++--- test/files/run/t1987b/cce_test.scala | 2 +- test/files/run/t8893b.scala | 2 +- test/files/scalacheck/quasiquotes/ErrorProps.scala | 2 +- 21 files changed, 26 insertions(+), 26 deletions(-) (limited to 'test/files') diff --git a/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala b/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala index 076f84ce7a..351a8e33d3 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala @@ -86,7 +86,7 @@ trait Opcodes { self: ICodes => * Each case subclass will represent a specific operation. */ abstract class Instruction extends Cloneable { - // Vlad: I used these for checking the quality of the implementation, and we should regularely run a build with them + // Vlad: I used these for checking the quality of the implementation, and we should regularly run a build with them // enabled. But for production these should definitely be disabled, unless we enjoy getting angry emails from Greg :) //if (!this.isInstanceOf[opcodes.LOAD_EXCEPTION]) // assert(consumed == consumedTypes.length) diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala b/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala index 5f8f0e167c..cf29c8090b 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala @@ -355,7 +355,7 @@ class BTypesFromSymbols[G <: Global](val global: G) extends BTypes { // See comment in BTypes, when is a class marked static in the InnerClass table. val isStaticNestedClass = isOriginallyStaticOwner(innerClassSym.originalOwner) - // After lambdalift (which is where we are), the rawowoner field contains the enclosing class. + // After lambdalift (which is where we are), the rawowner field contains the enclosing class. val enclosingClass = { // (1) Example java source: class C { static class D { } } // The Scala compiler creates a class and a module symbol for C. Because D is a static diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 77c49a862a..c1655467e9 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -204,7 +204,7 @@ trait Namers extends MethodSynthesis { } // FIXME - this logic needs to be thoroughly explained - // and justified. I know it's wrong with repect to package + // and justified. I know it's wrong with respect to package // objects, but I think it's also wrong in other ways. protected def conflict(newS: Symbol, oldS: Symbol) = ( ( !oldS.isSourceMethod @@ -1106,7 +1106,7 @@ trait Namers extends MethodSynthesis { * As a first side effect, this method assigns a MethodType constructed using this * return type to `meth`. This allows omitting the result type for recursive methods. * - * As another side effect, this method also assigns paramter types from the overridden + * As another side effect, this method also assigns parameter types from the overridden * method to parameters of `meth` that have missing types (the parser accepts missing * parameter types under -Yinfer-argument-types). */ diff --git a/src/library/scala/collection/generic/MutableSortedSetFactory.scala b/src/library/scala/collection/generic/MutableSortedSetFactory.scala index 0339a523e9..9bb12c2317 100644 --- a/src/library/scala/collection/generic/MutableSortedSetFactory.scala +++ b/src/library/scala/collection/generic/MutableSortedSetFactory.scala @@ -24,7 +24,7 @@ abstract class MutableSortedSetFactory[CC[A] <: mutable.SortedSet[A] with Sorted /** * mutable.SetBuilder uses '+' which is not a primitive for anything extending mutable.SetLike, - * this causes serious perfomances issues since each time 'elems = elems + x' + * this causes serious performance issues since each time 'elems = elems + x' * is evaluated elems is cloned (which is O(n)). * * Fortunately GrowingBuilder comes to rescue. diff --git a/src/manual/scala/tools/docutil/ManMaker.scala b/src/manual/scala/tools/docutil/ManMaker.scala index 47b861a80f..802b357f5f 100644 --- a/src/manual/scala/tools/docutil/ManMaker.scala +++ b/src/manual/scala/tools/docutil/ManMaker.scala @@ -18,7 +18,7 @@ class ManMaker extends Task { /** The directory to put html pages in */ private var htmlout: Option[File] = None - /** The directory to put man pags in */ + /** The directory to put man pages in */ private var manout: Option[File] = None diff --git a/src/reflect/scala/reflect/api/Internals.scala b/src/reflect/scala/reflect/api/Internals.scala index 577cd09295..1457fdc133 100644 --- a/src/reflect/scala/reflect/api/Internals.scala +++ b/src/reflect/scala/reflect/api/Internals.scala @@ -114,7 +114,7 @@ trait Internals { self: Universe => def substituteTypes(tree: Tree, from: List[Symbol], to: List[Type]): Tree /** Substitute given tree `to` for occurrences of nodes that represent - * `C.this`, where `C` referes to the given class `clazz`. + * `C.this`, where `C` refers to the given class `clazz`. */ def substituteThis(tree: Tree, clazz: Symbol, to: Tree): Tree diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala index c760db3864..8c72405c8d 100644 --- a/src/reflect/scala/reflect/internal/Types.scala +++ b/src/reflect/scala/reflect/internal/Types.scala @@ -2588,7 +2588,7 @@ trait Types * based on the bounds of the type parameters of the quantified type * In Scala syntax, given a java-defined class C[T <: String], the existential type C[_] * is improved to C[_ <: String] before skolemization, which captures (get it?) what Java does: - * enter the type paramers' bounds into the context when checking subtyping/type equality of existential types + * enter the type parameters' bounds into the context when checking subtyping/type equality of existential types * * Also tried doing this once during class file parsing or when creating the existential type, * but that causes cyclic errors because it happens too early. @@ -4263,7 +4263,7 @@ trait Types matchesType(res1, res2.substSym(tparams2, tparams1), alwaysMatchSimple) (tp1, tp2) match { case (MethodType(params1, res1), MethodType(params2, res2)) => - params1.length == params2.length && // useful pre-secreening optimization + params1.length == params2.length && // useful pre-screening optimization matchingParams(params1, params2, tp1.isInstanceOf[JavaMethodType], tp2.isInstanceOf[JavaMethodType]) && matchesType(res1, res2, alwaysMatchSimple) && tp1.isImplicit == tp2.isImplicit diff --git a/src/reflect/scala/reflect/runtime/SymbolTable.scala b/src/reflect/scala/reflect/runtime/SymbolTable.scala index 092bbd711f..eee2118898 100644 --- a/src/reflect/scala/reflect/runtime/SymbolTable.scala +++ b/src/reflect/scala/reflect/runtime/SymbolTable.scala @@ -3,7 +3,7 @@ package reflect package runtime /** - * This symbol table trait fills in the definitions so that class information is obtained by refection. + * This symbol table trait fills in the definitions so that class information is obtained by reflection. * It can be used either from a reflexive universe (class scala.reflect.runtime.JavaUniverse), or else from * a runtime compiler that uses reflection to get a class information (class scala.tools.reflect.ReflectGlobal) */ diff --git a/src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala b/src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala index cc217d2f80..839598a15f 100755 --- a/src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala +++ b/src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala @@ -114,7 +114,7 @@ trait MemberLookupBase { // Maintaining compatibility with previous links is a bit tricky here: // we have a preference for term names for all terms except for the last, where we prefer a class: // How to do this: - // - at each step we do a DFS search with the prefered strategy + // - at each step we do a DFS search with the preferred strategy // - if the search doesn't return any members, we backtrack on the last decision // * we look for terms with the last member's name // * we look for types with the same name, all the way up diff --git a/src/scaladoc/scala/tools/nsc/doc/base/comment/Comment.scala b/src/scaladoc/scala/tools/nsc/doc/base/comment/Comment.scala index a3d05ae50b..e5eb68d65a 100644 --- a/src/scaladoc/scala/tools/nsc/doc/base/comment/Comment.scala +++ b/src/scaladoc/scala/tools/nsc/doc/base/comment/Comment.scala @@ -93,7 +93,7 @@ abstract class Comment { def todo: List[Body] /** Whether the entity is deprecated. Using the `@deprecated` Scala attribute - * is prefereable to using this Scaladoc tag. */ + * is preferable to using this Scaladoc tag. */ def deprecated: Option[Body] /** An additional note concerning the contract of the entity. */ diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DiagramStats.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DiagramStats.scala index ab8e9e2756..12c609af49 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DiagramStats.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DiagramStats.scala @@ -36,7 +36,7 @@ object DiagramStats { private[this] val filterTrack = new TimeTracker("diagrams model filtering") private[this] val modelTrack = new TimeTracker("diagrams model generation") private[this] val dotGenTrack = new TimeTracker("dot diagram generation") - private[this] val dotRunTrack = new TimeTracker("dot process runnning") + private[this] val dotRunTrack = new TimeTracker("dot process running") private[this] val svgTrack = new TimeTracker("svg processing") private[this] var brokenImages = 0 private[this] var fixedImages = 0 diff --git a/src/scaladoc/scala/tools/nsc/doc/model/Entity.scala b/src/scaladoc/scala/tools/nsc/doc/model/Entity.scala index 90de51d763..d55c51b19c 100644 --- a/src/scaladoc/scala/tools/nsc/doc/model/Entity.scala +++ b/src/scaladoc/scala/tools/nsc/doc/model/Entity.scala @@ -183,7 +183,7 @@ trait MemberEntity extends Entity { /** Indicates whether the member is inherited by implicit conversion */ def isImplicitlyInherited: Boolean - /** Indicates whether there is another member with the same name in the template that will take precendence */ + /** Indicates whether there is another member with the same name in the template that will take precedence */ def isShadowedImplicit: Boolean /** Indicates whether there are other implicitly inherited members that have similar signatures (and thus they all diff --git a/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala b/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala index 3cbcbc433e..8ae31ce1c3 100644 --- a/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala +++ b/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala @@ -478,7 +478,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { override lazy val comment = { def nonRootTemplate(sym: Symbol): Option[DocTemplateImpl] = if (sym eq RootPackage) None else findTemplateMaybe(sym) - /* Variable precendence order for implicitly added members: Take the variable definitions from ... + /* Variable precedence order for implicitly added members: Take the variable definitions from ... * 1. the target of the implicit conversion * 2. the definition template (owner) * 3. the current template @@ -994,7 +994,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { // pruning modules that shouldn't be documented // Why Symbol.isInitialized? Well, because we need to avoid exploring all the space available to scaladoc // from the classpath -- scaladoc is a hog, it will explore everything starting from the root package unless we - // somehow prune the tree. And isInitialized is a good heuristic for prunning -- if the package was not explored + // somehow prune the tree. And isInitialized is a good heuristic for pruning -- if the package was not explored // during typer and refchecks, it's not necessary for the current application and there's no need to explore it. (!sym.isModule || sym.moduleClass.isInitialized) && // documenting only public and protected members diff --git a/src/scaladoc/scala/tools/nsc/doc/model/ModelFactoryTypeSupport.scala b/src/scaladoc/scala/tools/nsc/doc/model/ModelFactoryTypeSupport.scala index 2b7e2506d4..8834bc3efd 100644 --- a/src/scaladoc/scala/tools/nsc/doc/model/ModelFactoryTypeSupport.scala +++ b/src/scaladoc/scala/tools/nsc/doc/model/ModelFactoryTypeSupport.scala @@ -112,7 +112,7 @@ trait ModelFactoryTypeSupport { def needsPrefix: Boolean = { if ((owner != bSym.owner || preSym.isRefinementClass) && (normalizeTemplate(owner) != inTpl.sym)) return true - // don't get tricked into prefixng method type params and existentials: + // don't get tricked into prefixing method type params and existentials: // I tried several tricks BUT adding the method for which I'm creating the type => that simply won't scale, // as ValueParams are independent of their parent member, and I really don't want to add this information to // all terms, as we're already over the allowed memory footprint diff --git a/test/disabled/pos/spec-List.scala b/test/disabled/pos/spec-List.scala index b31e035c1b..6bed08ae8a 100644 --- a/test/disabled/pos/spec-List.scala +++ b/test/disabled/pos/spec-List.scala @@ -438,7 +438,7 @@ case object Nil extends List[Nothing] { throw new NoSuchElementException("head of empty list") override def tail: List[Nothing] = throw new NoSuchElementException("tail of empty list") - // Removal of equals method here might lead to an infinite recusion similar to IntMap.equals. + // Removal of equals method here might lead to an infinite recursion similar to IntMap.equals. override def equals(that: Any) = that match { case that1: Seq[_] => that1.isEmpty case _ => false diff --git a/test/files/jvm/innerClassEnclMethodJavaReflection.scala b/test/files/jvm/innerClassEnclMethodJavaReflection.scala index ee39cb43bf..a4d64d0b67 100644 --- a/test/files/jvm/innerClassEnclMethodJavaReflection.scala +++ b/test/files/jvm/innerClassEnclMethodJavaReflection.scala @@ -8,7 +8,7 @@ object Test extends App { // Some classes in scala-compiler.jar have references to jline / ant classes, which seem to be // not on the classpath. We just skip over those classes. // PENDING: for now we also allow missing $anonfun classes: the optimizer may eliminate some closures - // that are refferred to in EnclosingClass attributes. SI-9136 + // that are referred to in EnclosingClass attributes. SI-9136 val allowedMissingPackages = Set("jline", "org.apache.tools.ant", "$anonfun") def ok(t: Throwable) = { diff --git a/test/files/neg/t8675b.scala b/test/files/neg/t8675b.scala index 2c5015b1d0..bffed2141c 100644 --- a/test/files/neg/t8675b.scala +++ b/test/files/neg/t8675b.scala @@ -13,7 +13,7 @@ object Test { // in the backend. // // This error is itself a regression (or at least a change) in 2.11.0-M7, - // specifically in SI-7944. The type paramaters to the implicit view + // specifically in SI-7944. The type parameters to the implicit view // `EngineTools1` are undetermined, and are now treated as type variables // in the expected type of the closure argument to `withFilter`. for (path: List[Any] <- (null : Engine1).asRequirement.pathsIncludingSelf.toList) { diff --git a/test/files/pos/t8111.scala b/test/files/pos/t8111.scala index 0d63a16ba4..09463ce697 100644 --- a/test/files/pos/t8111.scala +++ b/test/files/pos/t8111.scala @@ -7,10 +7,10 @@ trait T { foo((u: Unit) => ma) foo(0, (u: Any) => ma) apply () - // crash due to side effects on the onwer of the symbol in the + // crash due to side effects on the owner of the symbol in the // qualifier or arguments of the application during an abandoned - // names/defaults transform. The code type checkes because of - // autp-tupling which promotes and empty parmater list to `(): Unit` + // names/defaults transform. The code type checks because of + // auto-tupling which promotes an empty parameter list to `(): Unit` foo((u: Any) => ma)() {{(u: Any) => ma}; this}.foo(0)() diff --git a/test/files/run/t1987b/cce_test.scala b/test/files/run/t1987b/cce_test.scala index 4f9acf0264..e131df7956 100644 --- a/test/files/run/t1987b/cce_test.scala +++ b/test/files/run/t1987b/cce_test.scala @@ -1,5 +1,5 @@ package scales.xml -//import scales.xml._ // using another pacakge and importing doesn't CCE +//import scales.xml._ // using another package and importing doesn't CCE object CCE_Test { def main(args: Array[String]): Unit = { diff --git a/test/files/run/t8893b.scala b/test/files/run/t8893b.scala index 19120871aa..066425aab6 100644 --- a/test/files/run/t8893b.scala +++ b/test/files/run/t8893b.scala @@ -5,7 +5,7 @@ object Test { def tick(i : Int): Unit = if (i == 0) () else if (i == 42) { - tick(0) /*not in tail posiiton*/ + tick(0) /*not in tail position*/ tick(i - 1) } else tick(i - 1) diff --git a/test/files/scalacheck/quasiquotes/ErrorProps.scala b/test/files/scalacheck/quasiquotes/ErrorProps.scala index 2cba07abf2..0c24149372 100644 --- a/test/files/scalacheck/quasiquotes/ErrorProps.scala +++ b/test/files/scalacheck/quasiquotes/ErrorProps.scala @@ -162,7 +162,7 @@ object ErrorProps extends QuasiquoteProperties("errors") { q"$n" """) - property("SI-8211: check unbound placeholder paremeters") = fails( + property("SI-8211: check unbound placeholder parameters") = fails( "unbound placeholder parameter", """ q"_" -- cgit v1.2.3 From d2199c53788bec16101ec2c1048cfe4a6331a49b Mon Sep 17 00:00:00 2001 From: Janek Bogucki Date: Mon, 6 Jul 2015 08:42:59 +0100 Subject: Fix 25 typos (s) --- src/compiler/scala/reflect/quasiquotes/Reifiers.scala | 2 +- src/compiler/scala/tools/nsc/ast/TreeGen.scala | 2 +- src/compiler/scala/tools/nsc/typechecker/Implicits.scala | 2 +- src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala | 2 +- src/reflect/scala/reflect/internal/Definitions.scala | 2 +- src/reflect/scala/reflect/internal/StdNames.scala | 2 +- src/reflect/scala/reflect/runtime/SynchronizedTypes.scala | 4 ++-- src/repl-jline/scala/tools/nsc/interpreter/jline/JLineHistory.scala | 2 +- test/disabled/presentation/akka/src/akka/actor/ActorRef.scala | 2 +- test/files/pos/t6601/UsePrivateValueClass_2.scala | 2 +- test/files/pos/t8954/t2.scala | 2 +- test/files/presentation/t8941b/IdempotencyTest.scala | 6 +++--- test/files/run/classfile-format-51.scala | 2 +- test/files/run/complicatedmatch.scala | 2 +- test/files/run/nothingTypeNoFramesNoDce.scala | 2 +- test/files/run/t8010.scala | 4 ++-- test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala | 4 ++-- test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala | 4 ++-- 18 files changed, 24 insertions(+), 24 deletions(-) (limited to 'test/files') diff --git a/src/compiler/scala/reflect/quasiquotes/Reifiers.scala b/src/compiler/scala/reflect/quasiquotes/Reifiers.scala index 8462debe21..b2002a07ea 100644 --- a/src/compiler/scala/reflect/quasiquotes/Reifiers.scala +++ b/src/compiler/scala/reflect/quasiquotes/Reifiers.scala @@ -317,7 +317,7 @@ trait Reifiers { self: Quasiquotes => * Reification of non-trivial list is done in two steps: * * 1. split the list into groups where every placeholder is always - * put in a group of its own and all subsquent non-holeMap are + * put in a group of its own and all subsequent non-holeMap are * grouped together; element is considered to be a placeholder if it's * in the domain of the fill function; * diff --git a/src/compiler/scala/tools/nsc/ast/TreeGen.scala b/src/compiler/scala/tools/nsc/ast/TreeGen.scala index 0575b9703e..bf53c47e9a 100644 --- a/src/compiler/scala/tools/nsc/ast/TreeGen.scala +++ b/src/compiler/scala/tools/nsc/ast/TreeGen.scala @@ -233,7 +233,7 @@ abstract class TreeGen extends scala.reflect.internal.TreeGen with TreeDSL { } /** Return the synchronized part of the double-checked locking idiom around the syncBody tree. It guards with `cond` and - * synchronizez on `clazz.this`. Additional statements can be included after initialization, + * synchronizes on `clazz.this`. Additional statements can be included after initialization, * (outside the synchronized block). * * The idiom works only if the condition is using a volatile field. diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index 80e06eb8fa..11984da0d7 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -846,7 +846,7 @@ trait Implicits { errors.collectFirst { case err: DivergentImplicitTypeError => err } foreach saveDivergent if (search.isDivergent && divergentError.isEmpty) { - // Divergence triggered by `i` at this level of the implicit serach. We haven't + // Divergence triggered by `i` at this level of the implicit search. We haven't // seen divergence so far, we won't issue this error just yet, and instead temporarily // treat `i` as a failed candidate. saveDivergent(DivergentImplicitTypeError(tree, pt, i.sym)) diff --git a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala index f90e32ce8a..f3856db552 100644 --- a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala +++ b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala @@ -436,7 +436,7 @@ trait MethodSynthesis { if (tree.symbol.owner.isTrait || hasUnitType(basisSym)) rhs1 else gen.mkAssignAndReturn(basisSym, rhs1) ) - derivedSym setPos tree.pos // cannot set it at createAndEnterSymbol because basisSym can possible stil have NoPosition + derivedSym setPos tree.pos // cannot set it at createAndEnterSymbol because basisSym can possibly still have NoPosition val ddefRes = DefDef(derivedSym, new ChangeOwnerAndModuleClassTraverser(basisSym, derivedSym)(body)) // ValDef will have its position focused whereas DefDef will have original correct rangepos // ideally positions would be correct at the creation time but lazy vals are really a special case diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala index f3dd6a3280..4e0fc1e36e 100644 --- a/src/reflect/scala/reflect/internal/Definitions.scala +++ b/src/reflect/scala/reflect/internal/Definitions.scala @@ -103,7 +103,7 @@ trait Definitions extends api.StandardDefinitions { def isNumericValueClass(sym: Symbol) = ScalaNumericValueClasses contains sym def isGetClass(sym: Symbol) = ( - sym.name == nme.getClass_ // this condition is for performance only, this is called from `Typer#stabliize`. + sym.name == nme.getClass_ // this condition is for performance only, this is called from `Typer#stabilize`. && getClassMethods(sym) ) diff --git a/src/reflect/scala/reflect/internal/StdNames.scala b/src/reflect/scala/reflect/internal/StdNames.scala index 63e2ca0dbe..52558d9395 100644 --- a/src/reflect/scala/reflect/internal/StdNames.scala +++ b/src/reflect/scala/reflect/internal/StdNames.scala @@ -870,7 +870,7 @@ trait StdNames { val toFloat: NameType = "toFloat" val toDouble: NameType = "toDouble" - // primitive operation methods for structual types mostly + // primitive operation methods for structural types mostly // overlap with the above, but not for these two. val toCharacter: NameType = "toCharacter" val toInteger: NameType = "toInteger" diff --git a/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala b/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala index 9bcf85dd6f..1d02cc7e89 100644 --- a/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala +++ b/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala @@ -82,9 +82,9 @@ private[reflect] trait SynchronizedTypes extends internal.Types { self: SymbolTa override def toStringSubjects = _toStringSubjects.get /* The idea of caches is as follows. - * When in reflexive mode, a cache is either null, or one sentinal + * When in reflexive mode, a cache is either null, or one sentinel * value representing undefined or the final defined - * value. Hence, we can ask in non-synchronized ode whether the cache field + * value. Hence, we can ask in non-synchronized mode whether the cache field * is non null and different from the sentinel (if a sentinel exists). * If that's true, the cache value is current. * Otherwise we arrive in one of the defined... methods listed below diff --git a/src/repl-jline/scala/tools/nsc/interpreter/jline/JLineHistory.scala b/src/repl-jline/scala/tools/nsc/interpreter/jline/JLineHistory.scala index 1f6a1f7022..3bc259252a 100644 --- a/src/repl-jline/scala/tools/nsc/interpreter/jline/JLineHistory.scala +++ b/src/repl-jline/scala/tools/nsc/interpreter/jline/JLineHistory.scala @@ -15,7 +15,7 @@ import scala.tools.nsc.interpreter import scala.tools.nsc.interpreter.session.{History, SimpleHistory} -/** A straight scalification of the jline interface which mixes +/** A straight scalafication of the jline interface which mixes * in the sparse jline-independent one too. */ trait JLineHistory extends JHistory with History { diff --git a/test/disabled/presentation/akka/src/akka/actor/ActorRef.scala b/test/disabled/presentation/akka/src/akka/actor/ActorRef.scala index da0b63006a..97bb710e29 100644 --- a/test/disabled/presentation/akka/src/akka/actor/ActorRef.scala +++ b/test/disabled/presentation/akka/src/akka/actor/ActorRef.scala @@ -1384,7 +1384,7 @@ trait ScalaActorRef extends ActorRefShared { ref: ActorRef => "\n\tYou have probably: " + "\n\t\t1. Sent a message to an Actor from an instance that is NOT an Actor." + "\n\t\t2. Invoked a method on an TypedActor from an instance NOT an TypedActor." + - "\n\tElse you might want to use 'reply_?' which returns Boolean(true) if succes and Boolean(false) if no sender in scope") + "\n\tElse you might want to use 'reply_?' which returns Boolean(true) if success and Boolean(false) if no sender in scope") /** * Use reply_?(..) to reply with a message to the original sender of the message currently diff --git a/test/files/pos/t6601/UsePrivateValueClass_2.scala b/test/files/pos/t6601/UsePrivateValueClass_2.scala index 461b8397b2..3b2b3dcc21 100644 --- a/test/files/pos/t6601/UsePrivateValueClass_2.scala +++ b/test/files/pos/t6601/UsePrivateValueClass_2.scala @@ -1,5 +1,5 @@ object Test { - // After the first attempt to make seprately compiled value + // After the first attempt to make separately compiled value // classes respect the privacy of constructors, we got: // // exception when typing v.a().==(v.a())/class scala.reflect.internal.Trees$Apply diff --git a/test/files/pos/t8954/t2.scala b/test/files/pos/t8954/t2.scala index 4def127832..c178486bc9 100644 --- a/test/files/pos/t8954/t2.scala +++ b/test/files/pos/t8954/t2.scala @@ -19,7 +19,7 @@ class C { } // 2.1 overriding with a deprecated def should be fine -// and also shoudln't trigger the "deprecation is useless" +// and also should not trigger the "deprecation is useless" // warning class D extends C { @deprecated("","") override def foo(): Unit = ??? diff --git a/test/files/presentation/t8941b/IdempotencyTest.scala b/test/files/presentation/t8941b/IdempotencyTest.scala index af01b36898..ffbbc0d03b 100644 --- a/test/files/presentation/t8941b/IdempotencyTest.scala +++ b/test/files/presentation/t8941b/IdempotencyTest.scala @@ -6,9 +6,9 @@ import reporters.{Reporter => CompilerReporter} import scala.tools.nsc.interactive.InteractiveReporter import scala.reflect.internal.util.SourceFile -/** Determistically interrupts typechecking of `code` when a defintion named - * `MagicInterruptionMarker` is typechecked, and then performs a targetted - * typecheck of the tree at the specal comment marker marker +/** Deterministically interrupts typechecking of `code` when a definition named + * `MagicInterruptionMarker` is typechecked, and then performs a targeted + * typecheck of the tree at the special comment marker marker */ abstract class IdempotencyTest { self => private val settings = new Settings diff --git a/test/files/run/classfile-format-51.scala b/test/files/run/classfile-format-51.scala index 7523130afa..81df2f08d9 100644 --- a/test/files/run/classfile-format-51.scala +++ b/test/files/run/classfile-format-51.scala @@ -14,7 +14,7 @@ import Opcodes._ // // By its nature the test can only work on JDK 7+ because under JDK 6 some of the // classes referred to by DynamicInvoker won't be available and DynamicInvoker won't -// verify. So the test includes a version check that short-circuites the whole test +// verify. So the test includes a version check that short-circuits the whole test // on JDK 6 object Test extends DirectTest { override def extraSettings: String = "-optimise -usejavacp -d " + testOutput.path + " -cp " + testOutput.path diff --git a/test/files/run/complicatedmatch.scala b/test/files/run/complicatedmatch.scala index 681029aa13..1676a4115a 100644 --- a/test/files/run/complicatedmatch.scala +++ b/test/files/run/complicatedmatch.scala @@ -7,7 +7,7 @@ object Even{ } object Test extends App{ - val LongWord = "supercalifragilisticexpialadocious"; + val LongWord = "supercalifragilisticexpialidocious"; def foo(x : Int, y : String) : Int = (x, y) match { case (Even(i), "bar") => 1 diff --git a/test/files/run/nothingTypeNoFramesNoDce.scala b/test/files/run/nothingTypeNoFramesNoDce.scala index 3d1298303a..7f63faeaa7 100644 --- a/test/files/run/nothingTypeNoFramesNoDce.scala +++ b/test/files/run/nothingTypeNoFramesNoDce.scala @@ -26,7 +26,7 @@ class C { } def f5(x: Boolean) = { - // stack heights need to be the smae. ??? looks to the jvm like returning a value of + // stack heights need to be the same. ??? looks to the jvm like returning a value of // type Nothing$, need to drop or throw it. println( if (x) { ???; 10 } diff --git a/test/files/run/t8010.scala b/test/files/run/t8010.scala index 8636bbd12e..c78d45a43b 100644 --- a/test/files/run/t8010.scala +++ b/test/files/run/t8010.scala @@ -5,7 +5,7 @@ trait Base { def bt(n: Int) = n } trait Derived extends Base { - // was: double defintion error + // was: double definition error override def t = 1 + super.t override def t(n: Int) = 1 + super.t(n) override def bt = 1 + super.bt @@ -14,7 +14,7 @@ trait Derived extends Base { object Test extends App { val d = new Derived {} - // not the focus of thie bug, but let's just check the runtime behaviour while we're here. + // not the focus of this bug, but let's just check the runtime behaviour while we're here. assert(d.t == 2) assert(d.t(1) == 2) assert(d.bt == 3) diff --git a/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala b/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala index 7bd37140a7..ab1056dd86 100644 --- a/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala +++ b/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala @@ -250,8 +250,8 @@ trait ArbitraryTreesAndNames { genAppliedTypeTree(size - 1), genTypeBoundsTree(size - 1)) /* These are marker types that allow to write tests that - * depend specificly on Trees that are terms or types. - * They are transparently tranformed to trees through + * depend specifically on Trees that are terms or types. + * They are transparently transformed to trees through * implicit conversions and liftables for quasiquotes. */ diff --git a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala b/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala index fd810674f5..4ab8bb8531 100644 --- a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala @@ -346,7 +346,7 @@ trait MethodConstruction { self: QuasiquoteProperties => } } - property("can't unquote annotations with arguments specificed twice") = test { + property("can't unquote annotations with arguments specified twice") = test { val a = q"new a(x)" assertThrows[IllegalArgumentException] { q"@$a(y) def foo" @@ -370,7 +370,7 @@ trait PackageConstruction { self: QuasiquoteProperties => assertEqAst(q"package $name { }", "package foo.bar { }") } - property("splce name into package name") = test{ + property("splice name into package name") = test{ val name = TermName("bippy") assertEqAst(q"package $name { }", "package bippy { }") } -- cgit v1.2.3