Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix formatting #8125

Merged
merged 1 commit into from Jun 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions spec/06-expressions.md
Expand Up @@ -270,7 +270,7 @@ of evaluating the rewritten right-hand side is finally converted to
the function's declared result type, if one is given.

The case of a formal parameter with a parameterless
method type `=>$T$` is treated specially. In this case, the
method type `=> $T$` is treated specially. In this case, the
corresponding actual argument expression $e$ is not evaluated before the
application. Instead, every use of the formal parameter on the
right-hand side of the rewrite rule entails a re-evaluation of $e$.
Expand Down Expand Up @@ -419,7 +419,7 @@ type or if $e$ is a call-by-name parameter. If $e$ is a method with
parameters, `$e$ _` represents $e$ converted to a function
type by [eta expansion](#eta-expansion-section). If $e$ is a
parameterless method or call-by-name parameter of type
`=>$T$`, `$e$ _` represents the function of type
`=> $T$`, `$e$ _` represents the function of type
`() => $T$`, which evaluates $e$ when it is applied to the empty
parameter list `()`.

Expand Down
2 changes: 1 addition & 1 deletion spec/07-implicits.md
Expand Up @@ -335,7 +335,7 @@ will issue an error signalling a divergent implicit expansion.
Implicit parameters and methods can also define implicit conversions
called views. A _view_ from type $S$ to type $T$ is
defined by an implicit value which has function type
`$S$=>$T$` or `(=>$S$)=>$T$` or by a method convertible to a value of that
`$S$ => $T$` or `(=> $S$) => $T$` or by a method convertible to a value of that
type.

Views are applied in three situations:
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
Expand Up @@ -292,7 +292,7 @@ self =>
/** Perform an operation while peeking ahead.
* Pushback if the operation yields an empty tree or blows to pieces.
*/
@inline def peekingAhead(tree: =>Tree): Tree = {
@inline def peekingAhead(tree: => Tree): Tree = {
@inline def peekahead() = {
in.prev copyFrom in
in.nextToken()
Expand Down Expand Up @@ -1340,7 +1340,7 @@ self =>
/** Handle placeholder syntax.
* If evaluating the tree produces placeholders, then make it a function.
*/
private def withPlaceholders(tree: =>Tree, isAny: Boolean): Tree = {
private def withPlaceholders(tree: => Tree, isAny: Boolean): Tree = {
val savedPlaceholderParams = placeholderParams
placeholderParams = List()
var res = tree
Expand Down
6 changes: 3 additions & 3 deletions src/compiler/scala/tools/nsc/transform/UnCurry.scala
Expand Up @@ -753,9 +753,9 @@ abstract class UnCurry extends InfoTransform
// 1. when varargs and byname params are involved, the uncurry transformation desugars these special
// cases to actual typerefs, eg:
// ```
// T* ~> Seq[T] (Scala-defined varargs)
// T* ~> Array[T] (Java-defined varargs)
// =>T ~> Function0[T] (by name params)
// T* ~> Seq[T] (Scala-defined varargs)
// T* ~> Array[T] (Java-defined varargs)
// => T ~> Function0[T] (by name params)
// ```
// we use the DesugaredParameterType object (defined in scala.reflect.internal.transform.UnCurry)
// to redo this desugaring manually here
Expand Down
6 changes: 3 additions & 3 deletions src/compiler/scala/tools/nsc/typechecker/Infer.scala
Expand Up @@ -312,11 +312,11 @@ trait Infer extends Checkable {

/** "Compatible" means conforming after conversions.
* "Raising to a thunk" is not implicit; therefore, for purposes of applicability and
* specificity, an arg type `A` is considered compatible with cbn formal parameter type `=>A`.
* specificity, an arg type `A` is considered compatible with cbn formal parameter type `=> A`.
* For this behavior, the type `pt` must have cbn params preserved; for instance, `formalTypes(removeByName = false)`.
*
* `isAsSpecific` no longer prefers A by testing applicability to A for both m(A) and m(=>A)
* since that induces a tie between m(=>A) and m(=>A,B*) [scala/bug#3761]
* `isAsSpecific` no longer prefers A by testing applicability to A for both m(A) and m(=> A)
* since that induces a tie between m(=> A) and m(=> A, B*) [scala/bug#3761]
*/
private def isCompatible(tp: Type, pt: Type): Boolean = {
def isCompatibleByName(tp: Type, pt: Type): Boolean = (
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/scala/tools/nsc/typechecker/Typers.scala
Expand Up @@ -4746,7 +4746,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
* The expression `$e$ _` is well-formed if $e$ is of method type or if $e$ is a call-by-name parameter.
* (1) If $e$ is a method with parameters, `$e$ _` represents $e$ converted to a function type
* by [eta expansion](#eta-expansion).
* (2) If $e$ is a parameterless method or call-by-name parameter of type `=>$T$`, `$e$ _` represents
* (2) If $e$ is a parameterless method or call-by-name parameter of type `=> $T$`, `$e$ _` represents
* the function of type `() => $T$`, which evaluates $e$ when it is applied to the empty parameter list `()`.
*/
def typedEta(methodValue: Tree): Tree = methodValue.tpe match {
Expand Down
20 changes: 10 additions & 10 deletions src/library/scala/Console.scala
Expand Up @@ -162,7 +162,7 @@ object Console extends AnsiColor {
* @see `withOut[T](out:OutputStream)(thunk: => T)`
* @group io-redefinition
*/
def withOut[T](out: PrintStream)(thunk: =>T): T =
def withOut[T](out: PrintStream)(thunk: => T): T =
outVar.withValue(out)(thunk)

/** Sets the default output stream for the duration
Expand All @@ -175,7 +175,7 @@ object Console extends AnsiColor {
* @see `withOut[T](out:PrintStream)(thunk: => T)`
* @group io-redefinition
*/
def withOut[T](out: OutputStream)(thunk: =>T): T =
def withOut[T](out: OutputStream)(thunk: => T): T =
withOut(new PrintStream(out))(thunk)

/** Set the default error stream for the duration
Expand All @@ -188,10 +188,10 @@ object Console extends AnsiColor {
* @param thunk the code to execute with
* the new error stream active
* @return the results of `thunk`
* @see `withErr[T](err:OutputStream)(thunk: =>T)`
* @see `withErr[T](err:OutputStream)(thunk: => T)`
* @group io-redefinition
*/
def withErr[T](err: PrintStream)(thunk: =>T): T =
def withErr[T](err: PrintStream)(thunk: => T): T =
errVar.withValue(err)(thunk)

/** Sets the default error stream for the duration
Expand All @@ -201,10 +201,10 @@ object Console extends AnsiColor {
* @param thunk the code to execute with
* the new error stream active
* @return the results of `thunk`
* @see `withErr[T](err:PrintStream)(thunk: =>T)`
* @see `withErr[T](err:PrintStream)(thunk: => T)`
* @group io-redefinition
*/
def withErr[T](err: OutputStream)(thunk: =>T): T =
def withErr[T](err: OutputStream)(thunk: => T): T =
withErr(new PrintStream(err))(thunk)

/** Sets the default input stream for the duration
Expand All @@ -222,10 +222,10 @@ object Console extends AnsiColor {
* the new input stream active
*
* @return the results of `thunk`
* @see `withIn[T](in:InputStream)(thunk: =>T)`
* @see `withIn[T](in:InputStream)(thunk: => T)`
* @group io-redefinition
*/
def withIn[T](reader: Reader)(thunk: =>T): T =
def withIn[T](reader: Reader)(thunk: => T): T =
inVar.withValue(new BufferedReader(reader))(thunk)

/** Sets the default input stream for the duration
Expand All @@ -235,10 +235,10 @@ object Console extends AnsiColor {
* @param thunk the code to execute with
* the new input stream active
* @return the results of `thunk`
* @see `withIn[T](reader:Reader)(thunk: =>T)`
* @see `withIn[T](reader:Reader)(thunk: => T)`
* @group io-redefinition
*/
def withIn[T](in: InputStream)(thunk: =>T): T =
def withIn[T](in: InputStream)(thunk: => T): T =
withIn(new InputStreamReader(in))(thunk)

/** Prints an object to `out` using its `toString` method.
Expand Down
2 changes: 1 addition & 1 deletion src/library/scala/collection/concurrent/Map.scala
Expand Up @@ -94,7 +94,7 @@ trait Map[K, V] extends scala.collection.mutable.Map[K, V] {
*/
def replace(k: K, v: V): Option[V]

override def getOrElseUpdate(key: K, op: =>V): V = get(key) match {
override def getOrElseUpdate(key: K, op: => V): V = get(key) match {
case Some(v) => v
case None =>
val v = op
Expand Down
2 changes: 1 addition & 1 deletion src/library/scala/collection/concurrent/TrieMap.scala
Expand Up @@ -944,7 +944,7 @@ final class TrieMap[K, V] private (r: AnyRef, rtupd: AtomicReferenceFieldUpdater
* @param op the expression that computes the value
* @return the newly added value
*/
override def getOrElseUpdate(k: K, op: =>V): V = {
override def getOrElseUpdate(k: K, op: => V): V = {
val hc = computeHash(k)
lookuphc(k, hc) match {
case INodeBase.NO_SUCH_ELEMENT_SENTINEL =>
Expand Down
6 changes: 3 additions & 3 deletions src/library/scala/concurrent/BlockContext.scala
Expand Up @@ -29,7 +29,7 @@ package scala.concurrent
* {{{
* val oldContext = BlockContext.current
* val myContext = new BlockContext {
* override def blockOn[T](thunk: =>T)(implicit permission: CanAwait): T = {
* override def blockOn[T](thunk: => T)(implicit permission: CanAwait): T = {
* // you'd have code here doing whatever you need to do
* // when the thread is about to block.
* // Then you'd chain to the previous context:
Expand All @@ -54,12 +54,12 @@ trait BlockContext {
*
* @throws IllegalArgumentException if the `permission` is `null`
*/
def blockOn[T](thunk: =>T)(implicit permission: CanAwait): T
def blockOn[T](thunk: => T)(implicit permission: CanAwait): T
}

object BlockContext {
private[this] object DefaultBlockContext extends BlockContext {
override final def blockOn[T](thunk: =>T)(implicit permission: CanAwait): T = thunk
override final def blockOn[T](thunk: => T)(implicit permission: CanAwait): T = thunk
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/library/scala/concurrent/Future.scala
Expand Up @@ -656,7 +656,7 @@ object Future {
* @param executor the execution context on which the future is run
* @return the `Future` holding the result of the computation
*/
final def apply[T](body: =>T)(implicit executor: ExecutionContext): Future[T] =
final def apply[T](body: => T)(implicit executor: ExecutionContext): Future[T] =
unit.map(_ => body)

/** Starts an asynchronous computation and returns a `Future` instance with the result of that computation once it completes.
Expand Down
Expand Up @@ -49,7 +49,7 @@ private[concurrent] object ExecutionContextImpl {
def newThread(fjp: ForkJoinPool): ForkJoinWorkerThread =
wire(new ForkJoinWorkerThread(fjp) with BlockContext {
private[this] final var isBlocked: Boolean = false // This is only ever read & written if this thread is the current thread
final override def blockOn[T](thunk: =>T)(implicit permission: CanAwait): T =
final override def blockOn[T](thunk: => T)(implicit permission: CanAwait): T =
if ((Thread.currentThread eq this) && !isBlocked && blockerPermits.tryAcquire()) {
try {
val b: ForkJoinPool.ManagedBlocker with (() => T) =
Expand Down
2 changes: 1 addition & 1 deletion src/library/scala/concurrent/package.scala
Expand Up @@ -121,7 +121,7 @@ package object concurrent {
* @throws InterruptedException in the case that a wait within the blocking `body` was interrupted
*/
@throws(classOf[Exception])
final def blocking[T](body: =>T): T = BlockContext.current.blockOn(body)(scala.concurrent.AwaitPermission)
final def blocking[T](body: => T): T = BlockContext.current.blockOn(body)(scala.concurrent.AwaitPermission)
}

package concurrent {
Expand Down
2 changes: 1 addition & 1 deletion src/library/scala/jdk/Accumulator.scala
Expand Up @@ -54,7 +54,7 @@ import scala.collection.{Stepper, StepperShape, mutable}
* There are two possibilities to process elements of a primitive Accumulator without boxing:
* specialized operations of the Accumulator, or the Stepper interface. The most common collection
* operations are overloaded or overridden in the primitive Accumulator classes, for example
* [[IntAccumulator.map(f:Int=>Int)* IntAccumulator.map]] or [[IntAccumulator.exists]]. Thanks to Scala's function specialization,
* [[IntAccumulator.map(f: Int => Int)* IntAccumulator.map]] or [[IntAccumulator.exists]]. Thanks to Scala's function specialization,
* `intAcc.exists(x => testOn(x))` does not incur boxing.
*
* The [[Stepper]] interface provides iterator-like `hasStep` and `nextStep` methods, and is
Expand Down
6 changes: 3 additions & 3 deletions src/library/scala/util/control/Breaks.scala
Expand Up @@ -47,7 +47,7 @@ class Breaks {
}

sealed trait TryBlock[T] {
def catchBreak(onBreak: =>T): T
def catchBreak(onBreak: => T): T
}

/**
Expand All @@ -62,8 +62,8 @@ class Breaks {
* }
* }}}
*/
def tryBreakable[T](op: =>T) = new TryBlock[T] {
def catchBreak(onBreak: =>T) = try {
def tryBreakable[T](op: => T) = new TryBlock[T] {
def catchBreak(onBreak: => T) = try {
op
} catch {
case ex: BreakControl =>
Expand Down
4 changes: 2 additions & 2 deletions src/partest/scala/tools/partest/DirectTest.scala
Expand Up @@ -111,7 +111,7 @@ abstract class DirectTest extends App {
/**
* Run a test only if the current java version is at least the version specified.
*/
def testUnderJavaAtLeast[A](version: String)(yesRun: =>A) = new TestUnderJavaAtLeast(version, { yesRun })
def testUnderJavaAtLeast[A](version: String)(yesRun: => A) = new TestUnderJavaAtLeast(version, { yesRun })

class TestUnderJavaAtLeast[A](version: String, yesRun: => A) {
val javaVersion = System.getProperty("java.specification.version")
Expand All @@ -128,7 +128,7 @@ abstract class DirectTest extends App {
* If the current java version is at least 'version' then 'yesRun' is evaluated
* otherwise 'fallback' is
*/
def otherwise(fallback: =>A): A = {
def otherwise(fallback: => A): A = {
logInfo()
if (shouldRun) yesRun else fallback
}
Expand Down
2 changes: 1 addition & 1 deletion src/reflect/scala/reflect/internal/Types.scala
Expand Up @@ -4648,7 +4648,7 @@ trait Types
* The specification-enumerated non-value types are method types, polymorphic
* method types, and type constructors. Supplements to the specified set of
* non-value types include: types which wrap non-value symbols (packages
* and statics), overloaded types. Varargs and by-name types T* and (=>T) are
* and statics), overloaded types. Varargs and by-name types T* and (=> T) are
* not designated non-value types because there is code which depends on using
* them as type arguments, but their precise status is unclear.
*/
Expand Down
Expand Up @@ -166,7 +166,7 @@ class PickleBuffer(data: Array[Byte], from: Int, to: Int) {
/** Perform operation `op` the number of
* times specified. Concatenate the results into a list.
*/
def times[T](n: Int, op: ()=>T): List[T] =
def times[T](n: Int, op: () => T): List[T] =
if (n == 0) List() else op() :: times(n-1, op)

/** Pickle = majorVersion_Nat minorVersion_Nat nbEntries_Nat {Entry}
Expand Down
8 changes: 4 additions & 4 deletions src/reflect/scala/reflect/internal/tpe/TypeMaps.scala
Expand Up @@ -176,7 +176,7 @@ private[internal] trait TypeMaps {
* The default is to transform the tree with
* TypeMapTransformer.
*/
def mapOver(tree: Tree, giveup: ()=>Nothing): Tree =
def mapOver(tree: Tree, giveup: () => Nothing): Tree =
(new TypeMapTransformer).transform(tree)

/** This transformer leaves the tree alone except to remap
Expand Down Expand Up @@ -614,7 +614,7 @@ private[internal] trait TypeMaps {
// was touched. This takes us to one allocation per AsSeenFromMap rather
// than an allocation on every call to mapOver, and no extra work when the
// tree only has its types remapped.
override def mapOver(tree: Tree, giveup: ()=>Nothing): Tree = {
override def mapOver(tree: Tree, giveup: () => Nothing): Tree = {
if (isStablePrefix)
annotationArgRewriter transform tree
else {
Expand Down Expand Up @@ -815,7 +815,7 @@ private[internal] trait TypeMaps {
}
}
}
override def mapOver(tree: Tree, giveup: ()=>Nothing): Tree = {
override def mapOver(tree: Tree, giveup: () => Nothing): Tree = {
mapTreeSymbols.transform(tree)
}
}
Expand Down Expand Up @@ -968,7 +968,7 @@ private[internal] trait TypeMaps {
}

//AM propagate more info to annotations -- this seems a bit ad-hoc... (based on code by spoon)
override def mapOver(arg: Tree, giveup: ()=>Nothing): Tree = {
override def mapOver(arg: Tree, giveup: () => Nothing): Tree = {
// TODO: this should be simplified; in the stable case, one can
// probably just use an Ident to the tree.symbol.
//
Expand Down
Expand Up @@ -139,8 +139,8 @@ class JavapClass(
type ByteAry = Array[Byte]
type Input = Tuple2[String, Try[ByteAry]]

implicit protected class Failer[A](a: =>A) {
def orFailed[B >: A](b: =>B) = if (failed) b else a
implicit protected class Failer[A](a: => A) {
def orFailed[B >: A](b: => B) = if (failed) b else a
}
protected def noToolError = new JpError(s"No javap tool available: ${getClass.getName} failed to initialize.")

Expand Down
2 changes: 1 addition & 1 deletion src/scalacheck/org/scalacheck/commands/Commands.scala
Expand Up @@ -339,7 +339,7 @@ trait Commands {
}

/** A property that runs the given actions in the given SUT */
private def runActions(sut: Sut, as: Actions, finalize : =>Unit): Prop = {
private def runActions(sut: Sut, as: Actions, finalize: => Unit): Prop = {
try{
val (p1, s, rs1) = runSeqCmds(sut, as.s, as.seqCmds)
val l1 = s"initialstate = ${as.s}\nseqcmds = ${prettyCmdsRes(as.seqCmds zip rs1)}"
Expand Down
4 changes: 2 additions & 2 deletions src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala
Expand Up @@ -49,8 +49,8 @@ trait MemberLookupBase {
| - [[scala.collection.immutable.List!.apply class List's apply method]] and
| - [[scala.collection.immutable.List$.apply object List's apply method]]
|Disambiguating overloaded members: If a term is overloaded, you can indicate the first part of its signature followed by *:
| - [[[scala.collection.immutable.List$.fill[A](Int)(=>A):List[A]* Fill with a single parameter]]]
| - [[[scala.collection.immutable.List$.fill[A](Int,Int)(=>A):List[List[A]]* Fill with a two parameters]]]
| - [[[scala.collection.immutable.List$.fill[A](Int)(=> A):List[A]* Fill with a single parameter]]]
| - [[[scala.collection.immutable.List$.fill[A](Int, Int)(=> A):List[List[A]]* Fill with a two parameters]]]
|Notes:
| - you can use any number of matching square brackets to avoid interference with the signature
| - you can use \\. to escape dots in prefixes (don't forget to use * at the end to match the signature!)
Expand Down
4 changes: 2 additions & 2 deletions src/scaladoc/scala/tools/nsc/doc/doclet/Generator.scala
Expand Up @@ -26,8 +26,8 @@ abstract class Generator {

/** A series of tests that must be true before generation can be done. This is used by data provider traits to
* confirm that they have been correctly initialised before allowing generation to proceed. */
protected val checks: mutable.Set[()=>Boolean] =
mutable.Set.empty[()=>Boolean]
protected val checks: mutable.Set[() => Boolean] =
mutable.Set.empty[() => Boolean]

/** Outputs documentation (as a side effect). */
def generate(): Unit = {
Expand Down
2 changes: 1 addition & 1 deletion src/scaladoc/scala/tools/nsc/doc/html/page/Entity.scala
Expand Up @@ -629,7 +629,7 @@ trait EntityPage extends HtmlPage {

val mainComment: Elems = mbr.comment match {
case Some(comment) if (! isReduced) =>
def orEmpty[T](it: Iterable[T])(gen: =>Elems): Elems =
def orEmpty[T](it: Iterable[T])(gen: => Elems): Elems =
if (it.isEmpty) NoElems else gen

val example =
Expand Down
6 changes: 3 additions & 3 deletions test/files/jvm/future-spec/main.scala
Expand Up @@ -42,12 +42,12 @@ trait MinimalScalaTest extends Output with Features with Vigil {

implicit def stringops(s: String) = new {

def should[U](snippets: =>U) = {
def should[U](snippets: => U) = {
bufferPrintln(s + " should:")
snippets
}

def in[U](snippet: =>U) = {
def in[U](snippet: => U) = {
try {
bufferPrintln("- " + s)
snippet
Expand All @@ -69,7 +69,7 @@ trait MinimalScalaTest extends Output with Features with Vigil {

}

def intercept[T <: Throwable: Manifest](body: =>Any): T = {
def intercept[T <: Throwable: Manifest](body: => Any): T = {
try {
body
throw new Exception("Exception of type %s was not thrown".format(manifest[T]))
Expand Down