From 167e25641bf1e82552bd9dde1c174d170ab07d5b Mon Sep 17 00:00:00 2001 From: etorreborre Date: Mon, 13 May 2024 12:20:49 +0200 Subject: [PATCH] refactor: add some missing types for implicits --- .../specs2/matcher/DependencyMatchers.scala | 2 +- .../org/specs2/concurrent/ExecutionEnv.scala | 10 +- .../scala/org/specs2/collection/BiMap.scala | 3 +- .../org/specs2/control/FutureInstances.scala | 3 +- .../org/specs2/control/LanguageFeatures.scala | 6 +- .../scala/org/specs2/control/Property.scala | 6 +- .../scala/org/specs2/control/Throwablex.scala | 2 +- .../main/scala/org/specs2/data/NamedTag.scala | 3 +- .../scala/org/specs2/execute/Snippets.scala | 5 +- .../main/scala/org/specs2/text/Quote.scala | 2 +- .../main/scala/org/specs2/time/Timer.scala | 2 +- .../specs2/specification/ContextSpec.scala | 2 +- .../scala/org/specs2/runner/SbtRunner.scala | 4 +- .../specs2/specification/dsl/ExampleDsl.scala | 2 +- .../specs2/specification/dsl/TitleDsl.scala | 3 +- .../dsl/mutable/ExampleDsl.scala | 2 +- .../specification/dsl/mutable/TitleDsl.scala | 4 +- .../mutable/ForEachWithCommandLine.scala | 2 +- .../specification/script/StepParsers.scala | 6 +- core/shared/src/main/scala/specs2/run.scala | 2 +- .../org/specs2/form/DecoratedProperties.scala | 4 +- .../main/scala/org/specs2/json/JSONType.scala | 8 +- .../org/specs2/matcher/FileMatchers.scala | 92 +++++++++---------- .../org/specs2/matcher/ParserMatchers.scala | 4 +- .../scala/org/specs2/matcher/DataTable.scala | 31 +++---- .../org/specs2/matcher/MapMatchers.scala | 8 +- .../org/specs2/matcher/OptionMatchers.scala | 4 +- .../org/specs2/matcher/ResultMatchers.scala | 4 +- .../org/specs2/matcher/StringMatchers.scala | 49 +++++----- .../org/specs2/matcher/TryMatchers.scala | 2 +- .../specs2/mock/mockito/MockitoStubs.scala | 16 ++-- .../specs2/mock/mockito/MocksCreation.scala | 12 +-- .../scalacheck/ScalaCheckProperty.scala | 48 +++++----- .../org/specs2/control/FutureInstances.scala | 2 +- .../describe/CaseClassIntrospection.scala | 3 +- .../org/specs2/shapeless/Projection.scala | 2 +- .../org/specs2/matcher/AnyMatchersSpec.scala | 4 +- .../specs2/matcher/ContentMatchersSpec.scala | 2 +- .../specs2/matcher/FutureMatchersSpec.scala | 5 +- .../specs2/matcher/LogicalMatcherSpec.scala | 4 +- 40 files changed, 186 insertions(+), 189 deletions(-) diff --git a/analysis/shared/src/main/scala/org/specs2/matcher/DependencyMatchers.scala b/analysis/shared/src/main/scala/org/specs2/matcher/DependencyMatchers.scala index 2d1762ee0e..20f81b5d7d 100644 --- a/analysis/shared/src/main/scala/org/specs2/matcher/DependencyMatchers.scala +++ b/analysis/shared/src/main/scala/org/specs2/matcher/DependencyMatchers.scala @@ -49,7 +49,7 @@ trait DependencyBaseMatchers extends LayersAnalysis { trait DependencyBeHaveMatchers extends BeHaveMatchers { outer: DependencyBaseMatchers => - implicit def toLayersResultMatcher(result: MatchResult[Layers]) = new LayersResultMatcher(result) + implicit def toLayersResultMatcher(result: MatchResult[Layers]): DependencyBeHaveMatchers.this.LayersResultMatcher = new LayersResultMatcher(result) class LayersResultMatcher(result: MatchResult[Layers]) { def beRespected = result(outer.beRespected) } diff --git a/common/jvm/src/main/scala/org/specs2/concurrent/ExecutionEnv.scala b/common/jvm/src/main/scala/org/specs2/concurrent/ExecutionEnv.scala index 028fbec892..ec83a65cee 100644 --- a/common/jvm/src/main/scala/org/specs2/concurrent/ExecutionEnv.scala +++ b/common/jvm/src/main/scala/org/specs2/concurrent/ExecutionEnv.scala @@ -1,10 +1,12 @@ package org.specs2 package concurrent +import java.util.concurrent._ +import scala.concurrent._ + import org.specs2.control.Logger import org.specs2.main.Arguments -import scala.concurrent.ExecutionContext case class ExecutionEnv(executorServices: ExecutorServices, timeFactor: Int, @@ -18,9 +20,9 @@ case class ExecutionEnv(executorServices: ExecutorServices, lazy val scheduledExecutorService = executorServices.scheduledExecutorService lazy val scheduler = executorServices.scheduler - implicit lazy val es = executorService - implicit lazy val ses = scheduledExecutorService - implicit lazy val ec = executionContext + implicit lazy val es: ExecutorService = executorService + implicit lazy val ses: ScheduledExecutorService = scheduledExecutorService + implicit lazy val ec: ExecutionContext = executionContext def setTimeFactor(tf: Int): ExecutionEnv = copy(timeFactor = tf) diff --git a/common/shared/src/main/scala/org/specs2/collection/BiMap.scala b/common/shared/src/main/scala/org/specs2/collection/BiMap.scala index 1ca192dd28..ed05d87dc5 100644 --- a/common/shared/src/main/scala/org/specs2/collection/BiMap.scala +++ b/common/shared/src/main/scala/org/specs2/collection/BiMap.scala @@ -27,7 +27,7 @@ object BiMap { def k = key } - implicit def fromSeq[K, V](s: Seq[BiMapEntry[K, V]]) = new BiMap[K, V] { + implicit def fromSeq[K, V](s: Seq[BiMapEntry[K, V]]): BiMap[K,V] = new BiMap[K, V] { lazy val keys: Seq[K] = s.map(_.key) lazy val values: Seq[V] = s.map(_.value) @@ -45,4 +45,3 @@ trait SemiEntry[K] { def k: K def <->[V](v: V): BiMapEntry[K, V] = new BiMapEntry[K, V]() { val key = k; val value = v} } - diff --git a/common/shared/src/main/scala/org/specs2/control/FutureInstances.scala b/common/shared/src/main/scala/org/specs2/control/FutureInstances.scala index 156a3dabd2..eff4fbf51e 100644 --- a/common/shared/src/main/scala/org/specs2/control/FutureInstances.scala +++ b/common/shared/src/main/scala/org/specs2/control/FutureInstances.scala @@ -7,7 +7,7 @@ import org.specs2.fp._ object FutureInstances { /** Applicative instance running futures in parallel for Scalaz */ - implicit def parallelApplicative(implicit ec: ExecutionContext) = new Applicative[Future] { + implicit def parallelApplicative(implicit ec: ExecutionContext): Applicative[Future] = new Applicative[Future] { def point[A](a: => A): Future[A] = Future(a) def ap[A,B](ffa: => Future[A])(ff: => Future[A => B]): Future[B] = @@ -18,4 +18,3 @@ object FutureInstances { } } - diff --git a/common/shared/src/main/scala/org/specs2/control/LanguageFeatures.scala b/common/shared/src/main/scala/org/specs2/control/LanguageFeatures.scala index a4f1f843a6..0b0cbd4994 100644 --- a/common/shared/src/main/scala/org/specs2/control/LanguageFeatures.scala +++ b/common/shared/src/main/scala/org/specs2/control/LanguageFeatures.scala @@ -1,13 +1,15 @@ package org.specs2 package control +import languageFeature._ + /** * implicits and postfix ops are automatically mixed in specs2 specifications * for convenience. If you *really* don't want that you can override this behaviour by using the NoLanguageFeatures trait */ trait LanguageFeatures { - implicit lazy val implicitsAreAllowed = language.implicitConversions - implicit lazy val postfixOpsAreAllowed = language.postfixOps + implicit lazy val implicitsAreAllowed: implicitConversions = language.implicitConversions + implicit lazy val postfixOpsAreAllowed: postfixOps = language.postfixOps } trait NoLanguageFeatures extends LanguageFeatures { diff --git a/common/shared/src/main/scala/org/specs2/control/Property.scala b/common/shared/src/main/scala/org/specs2/control/Property.scala index 4655cf7a79..0fb4a1879e 100644 --- a/common/shared/src/main/scala/org/specs2/control/Property.scala +++ b/common/shared/src/main/scala/org/specs2/control/Property.scala @@ -5,7 +5,7 @@ import Exceptions._ /** * This class represents values which are evaluated lazily and which may even be missing. - * + * * It has Option-like function and can be also converted to an Either object */ case class Property[T](value: () => Option[T], evaluated: Boolean = false, evaluatedValue: Option[T] = None) { @@ -45,7 +45,7 @@ case class Property[T](value: () => Option[T], evaluated: Boolean = false, evalu def toRight[L](left: L): Either[L, T] = optionalValue.toRight(left) /** to a list */ def toList = optionalValue.toList - + /** @return execute the property */ private def execute: Property[T] = if (!evaluated) copy(value, evaluated = true, evaluatedValue = value()) @@ -69,7 +69,7 @@ object Property { } trait Properties { - implicit def aProperty[T](t: T) = Property(t) + implicit def aProperty[T](t: T): Property[T] = Property(t) } object Properties extends Properties diff --git a/common/shared/src/main/scala/org/specs2/control/Throwablex.scala b/common/shared/src/main/scala/org/specs2/control/Throwablex.scala index c764c9fc2a..843022b26d 100644 --- a/common/shared/src/main/scala/org/specs2/control/Throwablex.scala +++ b/common/shared/src/main/scala/org/specs2/control/Throwablex.scala @@ -12,7 +12,7 @@ trait Throwablex { /** * Implicit method to add additional methods to Throwable objects */ - implicit def extend[T <: Throwable](t: T) = new ExtendedThrowable(t) + implicit def extend[T <: Throwable](t: T): ExtendedThrowable[T] = new ExtendedThrowable(t) /** * See the ExtendedExceptions object description diff --git a/common/shared/src/main/scala/org/specs2/data/NamedTag.scala b/common/shared/src/main/scala/org/specs2/data/NamedTag.scala index 21202b3921..831e56e7e6 100644 --- a/common/shared/src/main/scala/org/specs2/data/NamedTag.scala +++ b/common/shared/src/main/scala/org/specs2/data/NamedTag.scala @@ -80,7 +80,7 @@ object NamedTag { * define a very coarse Monoid for NamedTags where appending 2 NamedTags returns a Tag object * with both list of tags */ - implicit val NamedTagsAreMonoid = new Monoid[NamedTag] { + implicit val NamedTagsAreMonoid: org.specs2.fp.Monoid[NamedTag]{val zero: NamedTag} = new Monoid[NamedTag] { val zero: NamedTag = AlwaysWhenNoIncludeTag def append(t1: NamedTag, t2: =>NamedTag): NamedTag = if (t1 == zero) t2 @@ -88,4 +88,3 @@ object NamedTag { else t1 overrideWith t2 } } - diff --git a/common/shared/src/main/scala/org/specs2/execute/Snippets.scala b/common/shared/src/main/scala/org/specs2/execute/Snippets.scala index 48e55bfdf0..b1b86b2d61 100644 --- a/common/shared/src/main/scala/org/specs2/execute/Snippets.scala +++ b/common/shared/src/main/scala/org/specs2/execute/Snippets.scala @@ -23,7 +23,7 @@ import Snippet._ */ trait Snippets { /** implicit parameters selected for the creation of Snippets */ - implicit def defaultSnippetParameters[T] = Snippet.defaultParams[T] + implicit def defaultSnippetParameters[T]: SnippetParams[T] = Snippet.defaultParams[T] /** implicit function modify the Snippet parameters */ implicit class SettableSnippet[T](s: Snippet[T]) { @@ -118,7 +118,7 @@ case class Snippet[T](code: () => T, * - the `eval` boolean indicating if a snippet must be evaluated * - the `verify` function checking the result */ -case class SnippetParams[T]( +case class SnippetParams[T]( trimExpression: String => String = trimApproximatedSnippet, cutter: String => String = ScissorsCutter(), asCode: (String, String) => String = markdownCode(offset = 0), @@ -203,4 +203,3 @@ object Snippet { lazy val ls = "[ \t\\x0B\f]" lazy val parameters = "(\\([^\\)]+\\))*" } - diff --git a/common/shared/src/main/scala/org/specs2/text/Quote.scala b/common/shared/src/main/scala/org/specs2/text/Quote.scala index 5caaa83034..7ebde0fe9c 100644 --- a/common/shared/src/main/scala/org/specs2/text/Quote.scala +++ b/common/shared/src/main/scala/org/specs2/text/Quote.scala @@ -37,7 +37,7 @@ trait Quote { /** @return an object.toString() without quotes (used in messages creation) */ def unq(a: Any) = a.notNull - implicit def prefixed(s: String) = new Prefixed(s) + implicit def prefixed(s: String): Prefixed = new Prefixed(s) class Prefixed(s: String) { def prefix(separator: String, other: String) = Seq(s, other).filter(_.nonEmpty).mkString(separator) } diff --git a/common/shared/src/main/scala/org/specs2/time/Timer.scala b/common/shared/src/main/scala/org/specs2/time/Timer.scala index 0d6c5a15fe..d4c9e05d66 100644 --- a/common/shared/src/main/scala/org/specs2/time/Timer.scala +++ b/common/shared/src/main/scala/org/specs2/time/Timer.scala @@ -112,7 +112,7 @@ object SimpleTimer { } def timerFold[T] = new Fold[Id, T, SimpleTimer] { - implicit val monad = Monad.idMonad + implicit val monad: org.specs2.fp.Monad[org.specs2.fp.Id] = Monad.idMonad type S = SimpleTimer def start = (new SimpleTimer).start def fold = (s, t) => s diff --git a/core/jvm/src/test/scala/org/specs2/specification/ContextSpec.scala b/core/jvm/src/test/scala/org/specs2/specification/ContextSpec.scala index fe08df1f76..8ecc955755 100644 --- a/core/jvm/src/test/scala/org/specs2/specification/ContextSpec.scala +++ b/core/jvm/src/test/scala/org/specs2/specification/ContextSpec.scala @@ -90,7 +90,7 @@ class ContextSpec extends script.Spec with ResultMatchers with Groups { def is = the around method must rethrow failed results as exceptions ${g6().e4} """ - implicit val arguments = main.Arguments() + implicit val arguments: main.Arguments = main.Arguments() "before" - new g1 with FragmentsExecution { e1 := executing(ex1Before).prints("before", "e1") diff --git a/core/shared/src/main/scala/org/specs2/runner/SbtRunner.scala b/core/shared/src/main/scala/org/specs2/runner/SbtRunner.scala index 86cdc84aac..ba3e8c3e70 100644 --- a/core/shared/src/main/scala/org/specs2/runner/SbtRunner.scala +++ b/core/shared/src/main/scala/org/specs2/runner/SbtRunner.scala @@ -22,7 +22,7 @@ import org.specs2.data.NamedTag import java.util.regex.Pattern import scala.concurrent.duration.Duration -import scala.concurrent.{Future} +import scala.concurrent.{Future, ExecutionContext} /** * Runner for Sbt @@ -130,7 +130,7 @@ case class SbtTask(aTaskDef: TaskDef, env: Env, loader: ClassLoader) extends sbt private val arguments = env.arguments - private implicit lazy val ec = env.specs2ExecutionContext + private implicit lazy val ec: ExecutionContext = env.specs2ExecutionContext /** @return the specification tags */ def tags(): Array[String] = { diff --git a/core/shared/src/main/scala/org/specs2/specification/dsl/ExampleDsl.scala b/core/shared/src/main/scala/org/specs2/specification/dsl/ExampleDsl.scala index 805a7eb76d..edd8d6eff4 100644 --- a/core/shared/src/main/scala/org/specs2/specification/dsl/ExampleDsl.scala +++ b/core/shared/src/main/scala/org/specs2/specification/dsl/ExampleDsl.scala @@ -12,7 +12,7 @@ import control.ImplicitParameters.ImplicitParam */ trait ExampleDsl extends FragmentsFactory { outer => - implicit def bangExample(d: String) = new BangExample(d) + implicit def bangExample(d: String): BangExample = new BangExample(d) class BangExample(d: String) { def !(execution: Execution): Fragment = fragmentFactory.example(Text(d), execution) diff --git a/core/shared/src/main/scala/org/specs2/specification/dsl/TitleDsl.scala b/core/shared/src/main/scala/org/specs2/specification/dsl/TitleDsl.scala index 160fda19b2..799e479e9d 100644 --- a/core/shared/src/main/scala/org/specs2/specification/dsl/TitleDsl.scala +++ b/core/shared/src/main/scala/org/specs2/specification/dsl/TitleDsl.scala @@ -9,7 +9,7 @@ import core.SpecHeader */ trait TitleDsl { outer => - implicit def title(s: String) = new TitleOps(s) + implicit def title(s: String): TitleOps = new TitleOps(s) class TitleOps(s: String) { def title: SpecHeader = SpecHeader(outer.getClass, Some(s)) } @@ -21,4 +21,3 @@ trait NoTitleDsl extends TitleDsl { override def title(s: String) = super.title(s) } - diff --git a/core/shared/src/main/scala/org/specs2/specification/dsl/mutable/ExampleDsl.scala b/core/shared/src/main/scala/org/specs2/specification/dsl/mutable/ExampleDsl.scala index 0ea21a4307..f3dcd6639e 100644 --- a/core/shared/src/main/scala/org/specs2/specification/dsl/mutable/ExampleDsl.scala +++ b/core/shared/src/main/scala/org/specs2/specification/dsl/mutable/ExampleDsl.scala @@ -31,7 +31,7 @@ trait ExampleDsl1 extends BlockDsl with ExampleDsl0 { // deactivate block0 override def blockExample0(d: String) = super.blockExample0(d) - implicit def blockExample(d: String) = new BlockExample(d) + implicit def blockExample(d: String): ExampleDsl1.this.BlockExample = new BlockExample(d) class BlockExample(d: String) extends BlockExample0(d) { def >>[R](f: String => R)(implicit asExecution: AsExecution[R]): Fragment = diff --git a/core/shared/src/main/scala/org/specs2/specification/dsl/mutable/TitleDsl.scala b/core/shared/src/main/scala/org/specs2/specification/dsl/mutable/TitleDsl.scala index 845a300a8e..7badb036be 100644 --- a/core/shared/src/main/scala/org/specs2/specification/dsl/mutable/TitleDsl.scala +++ b/core/shared/src/main/scala/org/specs2/specification/dsl/mutable/TitleDsl.scala @@ -9,8 +9,8 @@ import specification.core.SpecHeader * Dsl for creating a title in a mutable specification */ trait TitleDsl extends MutableHeaderBuilder with specification.dsl.TitleDsl { - override implicit def title(s: String) = new MutableTitleOps(s) + override implicit def title(s: String): MutableTitleOps = new MutableTitleOps(s) class MutableTitleOps(s: String) extends TitleOps(s) { override def title: SpecHeader = setTitle(s) } -} \ No newline at end of file +} diff --git a/core/shared/src/main/scala/org/specs2/specification/mutable/ForEachWithCommandLine.scala b/core/shared/src/main/scala/org/specs2/specification/mutable/ForEachWithCommandLine.scala index 56b3085d43..55b615b0f9 100644 --- a/core/shared/src/main/scala/org/specs2/specification/mutable/ForEachWithCommandLine.scala +++ b/core/shared/src/main/scala/org/specs2/specification/mutable/ForEachWithCommandLine.scala @@ -10,7 +10,7 @@ import specification.create.S2StringContext * ForEachWithCommandLine trait, adapted for mutable specifications */ trait ForEachWithCommandLine[T] extends specification.ForEachWithCommandLineArguments[T] with ExampleDsl { outer: S2StringContext => - override implicit def blockExample(d: String) = new BlockExample1(d) + override implicit def blockExample(d: String): BlockExample1 = new BlockExample1(d) class BlockExample1(d: String) extends BlockExample(d) { def >>[R : AsResult](f: T => R): Fragment = diff --git a/core/shared/src/main/scala/org/specs2/specification/script/StepParsers.scala b/core/shared/src/main/scala/org/specs2/specification/script/StepParsers.scala index 68b617abcd..998f9b4041 100644 --- a/core/shared/src/main/scala/org/specs2/specification/script/StepParsers.scala +++ b/core/shared/src/main/scala/org/specs2/specification/script/StepParsers.scala @@ -2,6 +2,8 @@ package org.specs2 package specification package script +import scala.util.matching.Regex + import util.matching.Regex import control.{ImplicitParameters, Use} import control.Exceptions._ @@ -12,7 +14,7 @@ import text.RegexExtractor * and possibly strip it from delimiters if necessary */ trait StepParsers extends ImplicitParameters { - implicit lazy val stepParserRegex = """\{([^}]+)\}""".r + implicit lazy val stepParserRegex: Regex = """\{([^}]+)\}""".r def apply[T](f: String => T)(implicit fpr: Regex = stepParserRegex): DelimitedStepParser[T] = new DelimitedStepParser1[T](f).withRegex(fpr) def apply[T](f: (String, String) => T)(implicit fpr: Regex): DelimitedStepParser[T] = new DelimitedStepParser2[T](f).withRegex(fpr) @@ -139,5 +141,3 @@ trait StandardRegexStepParsers { def threeStrings = groupAs(string).and((s1:String, s2: String, s3: String) => (s1, s2, s3)) } object StandardRegexStepParsers extends StandardRegexStepParsers - - diff --git a/core/shared/src/main/scala/specs2/run.scala b/core/shared/src/main/scala/specs2/run.scala index 74002938d8..0faf704d25 100644 --- a/core/shared/src/main/scala/specs2/run.scala +++ b/core/shared/src/main/scala/specs2/run.scala @@ -23,5 +23,5 @@ object run extends ClassRunner { /** main method for the command line */ def main(args: Array[String]) = - run(args, exit = true) + this.run(args, exit = true) } diff --git a/form/src/main/scala/org/specs2/form/DecoratedProperties.scala b/form/src/main/scala/org/specs2/form/DecoratedProperties.scala index 3048a3b6be..3b828da688 100644 --- a/form/src/main/scala/org/specs2/form/DecoratedProperties.scala +++ b/form/src/main/scala/org/specs2/form/DecoratedProperties.scala @@ -6,7 +6,7 @@ package form */ private[specs2] trait DecoratedProperties { - implicit def toDecorated[T <: DecoratedProperty[T]](d: T) = new Decorated(d) + implicit def toDecorated[T <: DecoratedProperty[T]](d: T): Decorated[T] = new Decorated(d) class Decorated[T <: DecoratedProperty[T]](d: T) { def code = d.decoratorIs(d.decorator.code) @@ -87,4 +87,4 @@ trait DecoratedProperties { } } private[specs2] -object DecoratedProperties extends DecoratedProperties \ No newline at end of file +object DecoratedProperties extends DecoratedProperties diff --git a/matcher-extra/shared/src/main/scala/org/specs2/json/JSONType.scala b/matcher-extra/shared/src/main/scala/org/specs2/json/JSONType.scala index c13161f658..dc01863990 100644 --- a/matcher-extra/shared/src/main/scala/org/specs2/json/JSONType.scala +++ b/matcher-extra/shared/src/main/scala/org/specs2/json/JSONType.scala @@ -136,7 +136,7 @@ class Parser extends StdTokenParsers with ImplicitConversions { def jsonObj = "{" ~> repsep(objEntry, ",") <~ "}" ^^ { case vals : List[_] => JSONObject(Map(vals : _*)) } def jsonArray = "[" ~> repsep(value, ",") <~ "]" ^^ { case vals : List[_] => JSONArray(vals) } def objEntry = stringVal ~ (":" ~> value) ^^ { case x ~ y => (x, y) } - def value: Parser[Any] = (jsonObj | jsonArray | number | "true" ^^^ true | "false" ^^^ false | "null" ^^^ null | stringVal) + def value: this.Parser[Any] = (jsonObj | jsonArray | number | "true" ^^^ true | "false" ^^^ false | "null" ^^^ null | stringVal) def stringVal = accept("string", { case lexical.StringLit(n) => n} ) def number = accept("number", { case lexical.NumericLit(n) => numberParser.get.apply(n)} ) } @@ -144,7 +144,7 @@ class Parser extends StdTokenParsers with ImplicitConversions { private[specs2] class Lexer extends StdLexical with ImplicitConversions { - override def token: Parser[Token] = + override def token: this.Parser[Token] = //( '\"' ~ rep(charSeq | letter) ~ '\"' ^^ lift(StringLit) ( string ^^ StringLit | number ~ letter ^^ { case n ~ l => ErrorToken("Invalid number format : " + n + l) } @@ -185,12 +185,12 @@ class Lexer extends StdLexical with ImplicitConversions { case None => "" } - def zero: Parser[String] = '0' ^^^ "0" + def zero: this.Parser[String] = '0' ^^^ "0" def nonzero = elem("nonzero digit", d => d.isDigit && d != '0') def exponent = elem("exponent character", d => d == 'e' || d == 'E') def sign = elem("sign character", d => d == '-' || d == '+') - def charSeq: Parser[String] = + def charSeq: this.Parser[String] = ('\\' ~ '\"' ^^^ "\"" |'\\' ~ '\\' ^^^ "\\" |'\\' ~ '/' ^^^ "/" diff --git a/matcher-extra/shared/src/main/scala/org/specs2/matcher/FileMatchers.scala b/matcher-extra/shared/src/main/scala/org/specs2/matcher/FileMatchers.scala index c3cb489f5b..c63504fd08 100644 --- a/matcher-extra/shared/src/main/scala/org/specs2/matcher/FileMatchers.scala +++ b/matcher-extra/shared/src/main/scala/org/specs2/matcher/FileMatchers.scala @@ -14,50 +14,50 @@ trait PathBaseMatchers { outer => private[specs2] val fileReader: FileReader = new org.specs2.io.FileReader {} import fileReader._ - /** matches if new File(path).exists */ + /** matches if new File(path).exists */ def beAnExistingPath = new PathMatcher((s: String) => exists(s), "exists", "doesn't exist") - /** matches if new File(path).canRead */ + /** matches if new File(path).canRead */ def beAReadablePath = new PathMatcher((s: String) => canRead(s), "is readable", "can't be read") - /** matches if new File(path).canWrite */ + /** matches if new File(path).canWrite */ def beAWritablePath = new PathMatcher((s: String) => canWrite(s), "is writable", "can't be written") - /** matches if new File(path).isAbsolute */ + /** matches if new File(path).isAbsolute */ def beAnAbsolutePath = new PathMatcher((s: String) => isAbsolute(s), "is absolute", "is not absolute") - /** matches if new File(path).isHidden */ + /** matches if new File(path).isHidden */ def beAHiddenPath = new PathMatcher((s: String) => isHidden(s), "is hidden", "is not hidden") - /** matches if new File(path).isFile */ + /** matches if new File(path).isFile */ def beAFilePath = new PathMatcher((s: String) => isFile(s), "is a file", "is not a file") - /** matches if new File(path).isDirectory */ + /** matches if new File(path).isDirectory */ def beADirectoryPath = new PathMatcher((s: String) => isDirectory(s), "is a directory", "is not a directory") - /** matches if new File(path).getName == name */ - def havePathName(name: String) = + /** matches if new File(path).getName == name */ + def havePathName(name: String) = new PathMatcher((s: String) => isEqualIgnoringSep(getName(s), name), "is named " + q(name), "is not named " + q(name)) - /** matches if new File(path).getAbsolutePath == absolutePath */ - def haveAsAbsolutePath(path: String) = + /** matches if new File(path).getAbsolutePath == absolutePath */ + def haveAsAbsolutePath(path: String) = new PathMatcher((s: String) => isEqualIgnoringSep(s, path), "has absolute path " + q(path), "doesn't have absolute path " + q(path)) - /** matches if new File(path).getCanonicalPath == canonicalPath */ - def haveAsCanonicalPath(path: String) = + /** matches if new File(path).getCanonicalPath == canonicalPath */ + def haveAsCanonicalPath(path: String) = new PathMatcher((s: String) => isEqualIgnoringSep(getCanonicalPath(s), path), "has canonical path " + q(path), "doesn't have canonical path " + q(path)) - /** matches if new File(path).getParent == parent */ - def haveParentPath(parent: String) = + /** matches if new File(path).getParent == parent */ + def haveParentPath(parent: String) = new PathMatcher((s: String) => isEqualIgnoringSep(getParent(s), parent), "has parent path " + q(parent), "doesn't have parent path " + q(parent)) - /** matches if new File(path).list == list(files) */ - def listPaths(list: String*) = - new PathMatcher((s: String) => list != null && listFiles(s).toList == list.toList, "has files " + q(list.mkString(", ")), + /** matches if new File(path).list == list(files) */ + def listPaths(list: String*) = + new PathMatcher((s: String) => list != null && listFiles(s).toList == list.toList, "has files " + q(list.mkString(", ")), "doesn't have files " + q(list.toList.mkString(", "))) - /** matches if 2 paths are the same regardless of their separators */ - def beEqualToIgnoringSep(other: String) = - new PathMatcher((s: String) => isEqualIgnoringSep(getCanonicalPath(s), other), "is equal ignoring separators to " + q(other), + /** matches if 2 paths are the same regardless of their separators */ + def beEqualToIgnoringSep(other: String) = + new PathMatcher((s: String) => isEqualIgnoringSep(getCanonicalPath(s), other), "is equal ignoring separators to " + q(other), "is not equal ignoring separators to " + q(other)) /** @return true if the 2 paths are equal, ignoring separators */ - private def isEqualIgnoringSep(path: String, other: String) = path != null && other != null&& getCanonicalPath(path).replaceAll("\\\\", "/") == getCanonicalPath(other).replaceAll("\\\\", "/") + private def isEqualIgnoringSep(path: String, other: String) = path != null && other != null&& getCanonicalPath(path).replaceAll("\\\\", "/") == getCanonicalPath(other).replaceAll("\\\\", "/") } private[specs2] trait PathBeHaveMatchers extends BeHaveMatchers { outer: PathBaseMatchers => - /** + /** * matcher aliases and implicits to use with be / have + matcher */ - implicit def toPathResultMatcher(result: MatchResult[String]) = new PathResultMatcher(result) + implicit def toPathResultMatcher(result: MatchResult[String]): PathResultMatcher = new PathResultMatcher(result) class PathResultMatcher(result: MatchResult[String]) { def anExistingPath = result(outer.beAnExistingPath) def aHiddenPath = result(outer.beAHiddenPath) @@ -73,7 +73,7 @@ trait PathBeHaveMatchers extends BeHaveMatchers { outer: PathBaseMatchers => def parentPath(path: String) = result(haveParentPath(path)) def equalToIgnoringSep(other: String) = result(beEqualToIgnoringSep(other)) } - def anExistingPath = beAnExistingPath + def anExistingPath = beAnExistingPath def aHiddenPath = beAHiddenPath def aReadablePath = beAReadablePath def aWritablePath = beAWritablePath @@ -81,9 +81,9 @@ trait PathBeHaveMatchers extends BeHaveMatchers { outer: PathBaseMatchers => def aFilePath = beAFilePath def aDirectoryPath = beADirectoryPath def pathName(name: String) = havePathName(name) - def asAbsolutePath(name: String) = haveAsAbsolutePath(name) - def asCanonicalPath(name: String) = haveAsCanonicalPath(name) - def parentPath(parent: String) = haveParentPath(parent) + def asAbsolutePath(name: String) = haveAsAbsolutePath(name) + def asCanonicalPath(name: String) = haveAsCanonicalPath(name) + def parentPath(parent: String) = haveParentPath(parent) def equalToIgnoringSep(other: String) = beEqualToIgnoringSep(other) } /** @@ -94,29 +94,29 @@ object FileMatchers extends FileMatchers private[specs2] trait FileBaseMatchers extends PathMatchers { - /** matches if file.exists */ + /** matches if file.exists */ def exist[T <: { def getPath(): String }] = (beAnExistingPath) ^^ ((_:T).getPath) - /** matches if file.canRead */ + /** matches if file.canRead */ def beReadable[T <: { def getPath(): String }] = (beAReadablePath) ^^ ((_:T).getPath) - /** matches if file.canWrite */ + /** matches if file.canWrite */ def beWritable[T <: { def getPath(): String }] = (beAWritablePath) ^^ ((_:T).getPath) - /** matches if file.isAbsolute */ + /** matches if file.isAbsolute */ def beAbsolute[T <: { def getPath(): String }] = (beAnAbsolutePath) ^^ ((_:T).getPath) - /** matches if file.isHidden */ + /** matches if file.isHidden */ def beHidden[T <: { def getPath(): String }] = (beAHiddenPath) ^^ ((_:T).getPath) - /** matches if file.isFile */ + /** matches if file.isFile */ def beAFile[T <: { def getPath(): String }] = (beAFilePath) ^^ ((_:T).getPath) - /** matches if file.isDirectory */ + /** matches if file.isDirectory */ def beADirectory[T <: { def getPath(): String }] = (beADirectoryPath) ^^ ((_:T).getPath) - /** matches if file.getName == name */ + /** matches if file.getName == name */ def haveName[T <: { def getPath(): String }](name: String) = (havePathName(name)) ^^ ((_:T).getPath) - /** matches if file.getAbsolutePath == path */ + /** matches if file.getAbsolutePath == path */ def haveAbsolutePath[T <: { def getPath(): String }](path: String) = (haveAsAbsolutePath(path)) ^^ ((_:T).getPath) - /** matches if file.getCanonicalPath == path */ + /** matches if file.getCanonicalPath == path */ def haveCanonicalPath[T <: { def getPath(): String }](path: String) = (haveAsCanonicalPath(path)) ^^ ((_:T).getPath) - /** matches if file.getParent == path */ + /** matches if file.getParent == path */ def haveParent[T <: { def getPath(): String }](path: String) = (haveParentPath(path)) ^^ ((_:T).getPath) - /** matches if file.list == list */ + /** matches if file.list == list */ def haveList[T <: { def getPath(): String }](list: String) = (listPaths(list)) ^^ ((_:T).getPath) } /** @@ -132,9 +132,9 @@ case class Path(p: String) { private[specs2] trait FileBeHaveMatchers extends BeHaveMatchers { outer: FileBaseMatchers => /** - * matcher aliases and implicits to use with BeVerb and HaveVerb + * matcher aliases and implicits to use with BeVerb and HaveVerb */ - implicit def toFileResultMatcher[T <: { def getPath(): String }](result: MatchResult[T]) = new FileResultMatcher(result) + implicit def toFileResultMatcher[T <: { def getPath(): String }](result: MatchResult[T]): FileResultMatcher[T] = new FileResultMatcher(result) class FileResultMatcher[T <: { def getPath(): String }](result: MatchResult[T]) { def hidden = result(beHidden) def readable = result(beReadable) @@ -162,11 +162,11 @@ trait FileBeHaveMatchers extends BeHaveMatchers { outer: FileBaseMatchers => def parent[T <: { def getPath(): String }](path: String) = haveParent(path) } private[specs2] -class PathMatcher(test: String => Boolean, ok: String, ko: String) extends Matcher[String] { +class PathMatcher(test: String => Boolean, ok: String, ko: String) extends Matcher[String] { def apply[S <: String](path: Expectable[S]) = { result(path.value != null && test(path.value), - path.description + " " + ok, + path.description + " " + ok, path.description + " " + ko, path) - } -} + } +} diff --git a/matcher-extra/shared/src/main/scala/org/specs2/matcher/ParserMatchers.scala b/matcher-extra/shared/src/main/scala/org/specs2/matcher/ParserMatchers.scala index 3fa9dee7f9..c10970c4b6 100644 --- a/matcher-extra/shared/src/main/scala/org/specs2/matcher/ParserMatchers.scala +++ b/matcher-extra/shared/src/main/scala/org/specs2/matcher/ParserMatchers.scala @@ -178,7 +178,7 @@ trait ParserBeHaveMatchers extends BeHaveMatchers { outer: ParserBaseMatchers => val parsers: Parsers import parsers._ - implicit def toParsedResultMatcher[T](result: MatchResult[ParseResult[T]]) = new ParsedResultMatcher(result) + implicit def toParsedResultMatcher[T](result: MatchResult[ParseResult[T]]): ParsedResultMatcher[T] = new ParsedResultMatcher(result) class ParsedResultMatcher[T](result: MatchResult[ParseResult[T]]) { def aSuccess = result(beASuccess) def aPartialSuccess = result(beAPartialSuccess) @@ -195,7 +195,7 @@ trait ParserBeHaveMatchers extends BeHaveMatchers { outer: ParserBaseMatchers => def aFailure = beAFailure def aParseError = beAnError - implicit def toParserResultMatcherResult[T](result: MatchResult[Parser[T]]) = new ParserResultMatcherResult(result) + implicit def toParserResultMatcherResult[T](result: MatchResult[Parser[T]]): ParserResultMatcherResult[T] = new ParserResultMatcherResult(result) class ParserResultMatcherResult[T](result: MatchResult[Parser[T]]) { def succeedOn(input: Input) = result(outer.succeedOn(input)) def failOn(input: Input) = result(outer.failOn(input)) diff --git a/matcher/shared/src/main/scala/org/specs2/matcher/DataTable.scala b/matcher/shared/src/main/scala/org/specs2/matcher/DataTable.scala index fc9cbed3e9..fab15fbe29 100644 --- a/matcher/shared/src/main/scala/org/specs2/matcher/DataTable.scala +++ b/matcher/shared/src/main/scala/org/specs2/matcher/DataTable.scala @@ -13,35 +13,35 @@ import scala.concurrent._, duration._ /** * This trait provides implicit definitions and types to create DataTables. - * + * * A DataTable has a header defining column names and rows holding values. * It is possible to apply a function taking the row values and returning a MatchResult. - * + * * A TableHeader is defined by separating the column names with '|': - * ` "a" | "b" | "c"` - * + * ` "a" | "b" | "c"` + * * A DataRow is defined by separating the row values with '!': - * ` 1 ! 2 ! 3` - * - * Note that the '!' method can conflict with the creation of Examples when the value is a + * ` 1 ! 2 ! 3` + * + * Note that the '!' method can conflict with the creation of Examples when the value is a * string. In that case it is possible to use the '!!! method to disambiguate: - * + * * `"1" !! "2" ! "3"` - * + * * In that case the first column of the header can also be defined with '||' for pure * symmetry reasons: - * - * `"a" || "b" | "c"` + * + * `"a" || "b" | "c"` * `"1" !! "2" ! "3"` - * + * * @see org.specs2.matcher.DataTablesSpec for examples */ trait DataTables extends ExpectationsCreation { - + /** @return a TableHeader with one heading only */ - implicit def toTableHeader(a: String) = new TableHeader(List(a)) + implicit def toTableHeader(a: String): TableHeader = new TableHeader(List(a)) /** @return a DataRow with one value only */ - implicit def toDataRow[T](a: T) = DataRow1(a) + implicit def toDataRow[T](a: T): DataRow1[T] = DataRow1(a) /** * A DataTable with its header @@ -504,4 +504,3 @@ object DataTablesGenerator { def dataRow(i: Int, letter: String = "T") = "DataRow"+i+typesAsList(i, letter).mkString("[",", ", "]") def table(i: Int) = "Table"+i } - diff --git a/matcher/shared/src/main/scala/org/specs2/matcher/MapMatchers.scala b/matcher/shared/src/main/scala/org/specs2/matcher/MapMatchers.scala index ee2798703a..4d63cb6445 100644 --- a/matcher/shared/src/main/scala/org/specs2/matcher/MapMatchers.scala +++ b/matcher/shared/src/main/scala/org/specs2/matcher/MapMatchers.scala @@ -119,28 +119,28 @@ trait MapBaseMatchers { } private[specs2] trait MapBeHaveMatchers extends BeHaveMatchers { outer: MapBaseMatchers => - implicit def toMapKeyResultMatcher[K](result: MatchResult[Iterable[(K, Any)]]) = new MapKeyResultMatcher(result) + implicit def toMapKeyResultMatcher[K](result: MatchResult[Iterable[(K, Any)]]): MapKeyResultMatcher[K] = new MapKeyResultMatcher(result) class MapKeyResultMatcher[K](result: MatchResult[Iterable[(K, Any)]]) { def key(k: K) = result(outer.haveKey(k)) def keys(ks: K*) = result(outer.haveKeys(ks:_*)) def haveKey(k: K) = result(outer.haveKey(k)) def haveKeys(ks: K*) = result(outer.haveKeys(ks:_*)) } - implicit def toMapValueResultMatcher[V](result: MatchResult[Iterable[(Any, V)]]) = new MapValueResultMatcher(result) + implicit def toMapValueResultMatcher[V](result: MatchResult[Iterable[(Any, V)]]): MapValueResultMatcher[V] = new MapValueResultMatcher(result) class MapValueResultMatcher[V](result: MatchResult[Iterable[(Any, V)]]) { def value(v: V) = result(outer.haveValue(v)) def values(vs: V*) = result(outer.haveValues(vs:_*)) def haveValue(v: V) = result(outer.haveValue(v)) def haveValues(vs: V*) = result(outer.haveValues(vs:_*)) } - implicit def toMapResultMatcher[K, V](result: MatchResult[Iterable[(K, V)]]) = new MapResultMatcher(result) + implicit def toMapResultMatcher[K, V](result: MatchResult[Iterable[(K, V)]]): MapResultMatcher[K,V] = new MapResultMatcher(result) class MapResultMatcher[K, V](result: MatchResult[Iterable[(K, V)]]) { def pair(p: (K, V)) = result(outer.havePair(p)) def pairs(pairs: (K, V)*) = result(outer.havePairs(pairs:_*)) def havePair(p: (K, V)) = result(outer.havePair(p)) def havePairs(pairs: (K, V)*) = result(outer.havePairs(pairs:_*)) } - implicit def toPartialFunctionResultMatcher[K, V](result: MatchResult[PartialFunction[K, V]]) = new PartialFunctionResultMatcher(result) + implicit def toPartialFunctionResultMatcher[K, V](result: MatchResult[PartialFunction[K, V]]): PartialFunctionResultMatcher[K,V] = new PartialFunctionResultMatcher(result) class PartialFunctionResultMatcher[K, V](result: MatchResult[PartialFunction[K, V]]) { def definedAt(values: K*) = result(outer.beDefinedAt(values:_*)) def beDefinedAt(values: K*) = result(outer.beDefinedAt(values:_*)) diff --git a/matcher/shared/src/main/scala/org/specs2/matcher/OptionMatchers.scala b/matcher/shared/src/main/scala/org/specs2/matcher/OptionMatchers.scala index e497f194e9..10ff977a67 100644 --- a/matcher/shared/src/main/scala/org/specs2/matcher/OptionMatchers.scala +++ b/matcher/shared/src/main/scala/org/specs2/matcher/OptionMatchers.scala @@ -37,7 +37,7 @@ trait OptionBaseMatchers { def beAsNoneAs[T](other: =>Option[T]): Matcher[Option[T]] = new Matcher[Option[T]] { def apply[S <: Option[T]](a: Expectable[S]) = { val b = other - result(a.value == None && b == None || a.value != None && b != None, + result(a.value == None && b == None || a.value != None && b != None, a.description + " is None as well", if (a.value == None) b + " is not None" else a.description + " is not None", a) @@ -50,7 +50,7 @@ trait OptionBaseMatchers { private[specs2] trait OptionBeHaveMatchers extends BeHaveMatchers { outer: OptionBaseMatchers => - implicit def toOptionResultMatcher[T](result: MatchResult[Option[T]]) = new OptionResultMatcher(result) + implicit def toOptionResultMatcher[T](result: MatchResult[Option[T]]): OptionResultMatcher[T] = new OptionResultMatcher(result) class OptionResultMatcher[T](result: MatchResult[Option[T]]) { def beSome = result(outer.beSome) def beSome(check: ValueCheck[T]) = result(outer.beSome(check)) diff --git a/matcher/shared/src/main/scala/org/specs2/matcher/ResultMatchers.scala b/matcher/shared/src/main/scala/org/specs2/matcher/ResultMatchers.scala index 50434c9d56..99596a795a 100644 --- a/matcher/shared/src/main/scala/org/specs2/matcher/ResultMatchers.scala +++ b/matcher/shared/src/main/scala/org/specs2/matcher/ResultMatchers.scala @@ -15,7 +15,7 @@ object ResultMatchers extends ResultMatchers private[specs2] trait ResultBaseMatchers { - + def beSuccessful[T : AsResult] = new Matcher[T] { def apply[S <: T](value: Expectable[S]) = { result(ResultExecution.execute(AsResult[T](value.value)).isSuccess, @@ -83,7 +83,7 @@ trait ResultBaseMatchers { } private[specs2] trait ResultBeHaveMatchers extends BeHaveMatchers { outer: ResultBaseMatchers => - implicit def toResultMatcher[T : AsResult](result: MatchResult[T]) = new ResultMatcher(result) + implicit def toResultMatcher[T : AsResult](result: MatchResult[T]): ResultMatcher[T] = new ResultMatcher(result) class ResultMatcher[T : AsResult](result: MatchResult[T]) { def successful = result(outer.beSuccessful[T]) def beSuccessful = result(outer.beSuccessful[T]) diff --git a/matcher/shared/src/main/scala/org/specs2/matcher/StringMatchers.scala b/matcher/shared/src/main/scala/org/specs2/matcher/StringMatchers.scala index 7ab1629980..fc8737b8f6 100644 --- a/matcher/shared/src/main/scala/org/specs2/matcher/StringMatchers.scala +++ b/matcher/shared/src/main/scala/org/specs2/matcher/StringMatchers.scala @@ -25,21 +25,21 @@ case class StringMatcher(m: AdaptableMatcher[Any]) { object StringMatchers extends StringMatchers -/** +/** * This trait provides base matchers for strings. - * - * IgnoreCase and ignoreSpace matchers are created by adapting the BeEqualTo matcher. + * + * IgnoreCase and ignoreSpace matchers are created by adapting the BeEqualTo matcher. */ private[specs2] trait StringBaseMatchers { outer => - /** matches if a.toLowerCase.trim = b.toLowerCase.trim */ + /** matches if a.toLowerCase.trim = b.toLowerCase.trim */ def ==/(s: String) = be_==/(s) - /** matches if a.toLowerCase.trim = b.toLowerCase.trim */ + /** matches if a.toLowerCase.trim = b.toLowerCase.trim */ def be_==/(a: String) = StringMatcher(StringMatcher(new BeEqualTo(a)).ignoreCase).ignoreSpace - /** matches if a.toLowerCase.trim != b.toLowerCase.trim */ + /** matches if a.toLowerCase.trim != b.toLowerCase.trim */ def be_!=/(a: String) = be_==/(a).not - /** matches if a.toLowerCase.trim != b.toLowerCase.trim */ + /** matches if a.toLowerCase.trim != b.toLowerCase.trim */ def !=/(s: String) = be_!=/(s) /** matches if (b contains a) */ def contain(t: String) = new Matcher[String] { @@ -78,26 +78,26 @@ trait StringBaseMatchers { outer => s"${b.description} starts with ${q(a)}", s"${b.description} doesn't start with ${q(a)}", b) } - /** matches if b.endsWith(a) */ - def endWith(t: =>String) = new Matcher[String] { + /** matches if b.endsWith(a) */ + def endWith(t: =>String) = new Matcher[String] { def apply[S <: String](b: Expectable[S]) = { val a = t result(b.value!= null && a!= null && b.value.endsWith(a), - b.description + " ends with " + q(a), + b.description + " ends with " + q(a), b.description + " doesn't end with " + q(a), b) } } - /** matches if the regexp a is found inside b */ + /** matches if the regexp a is found inside b */ def find(a: =>String) = new FindMatcher(a) /** matches if the pattern p is found inside b */ def find(p: Pattern) = new FindMatcherPattern(p) /** matches if the regexp r is found inside b */ def find(r: Regex) = new FindMatcherRegex(r) - /** + /** * Matcher to find if the regexp a is found inside b. * This matcher can be specialized to a FindMatcherWithGroups which will also check the found groups - */ + */ class FindMatcher(t: =>String) extends Matcher[String] { lazy val pattern = Pattern.compile(t) @@ -106,9 +106,9 @@ trait StringBaseMatchers { outer => def apply[S <: String](b: Expectable[S]) = { val a = t result(a != null && b.value != null && pattern.matcher(b.value).find, - q(a) + " is found in " + b.description, + q(a) + " is found in " + b.description, q(a) + " isn't found in " + b.description, b) - } + } } /** @@ -125,9 +125,9 @@ trait StringBaseMatchers { outer => class FindMatcherRegex(r: Regex) extends FindMatcherPattern(r.pattern) /** - * Matcher to find if the regexp a is found inside b. + * Matcher to find if the regexp a is found inside b. * This matcher checks if the found groups are really the ones expected - */ + */ class FindMatcherWithGroups(t: =>String, groups: String*) extends Matcher[String] { lazy val pattern = Pattern.compile(t) @@ -145,16 +145,16 @@ trait StringBaseMatchers { outer => val groupsFound = found(b.value) val withGroups = if (groups.size > 1) " with groups " else " with group " def foundText = { - if (groupsFound.isEmpty) - ". Found nothing" - else + if (groupsFound.isEmpty) + ". Found nothing" + else ". Found: " + q(groupsFound.mkString(", ")) } val groupsToFind = if (groups == null) Nil else groups.toList - result(a != null && b.value != null && groupsFound == groupsToFind, - q(a) + " is found in " + b.description + withGroups + q(groupsToFind.mkString(", ")), + result(a != null && b.value != null && groupsFound == groupsToFind, + q(a) + " is found in " + b.description + withGroups + q(groupsToFind.mkString(", ")), q(a) + " isn't found in " + b.description + withGroups + q(groupsToFind.mkString(", ")) + foundText, b) - } + } } /** * Matcher to find if the pattern p is found inside b. @@ -167,7 +167,7 @@ trait StringBaseMatchers { outer => private[specs2] trait StringBeHaveMatchers extends BeHaveMatchers { outer: StringBaseMatchers => - implicit def toStringResultMatcher(result: MatchResult[String]) = new StringResultMatcher(result) + implicit def toStringResultMatcher(result: MatchResult[String]): StringResultMatcher = new StringResultMatcher(result) class StringResultMatcher(result: MatchResult[String]) { def matching(s: =>String) = result(beMatching(s)) def matching(s: Pattern) = result(beMatching(s)) @@ -226,4 +226,3 @@ class BeMatchingPattern(p: Pattern) extends BeMatching(p.toString) { class BeMatchingRegex(r: Regex) extends BeMatching(r.toString) { override lazy val pattern = r.pattern } - diff --git a/matcher/shared/src/main/scala/org/specs2/matcher/TryMatchers.scala b/matcher/shared/src/main/scala/org/specs2/matcher/TryMatchers.scala index 7c24099b80..354d1946bb 100644 --- a/matcher/shared/src/main/scala/org/specs2/matcher/TryMatchers.scala +++ b/matcher/shared/src/main/scala/org/specs2/matcher/TryMatchers.scala @@ -46,7 +46,7 @@ trait TryBaseMatchers { private[specs2] trait TryBeHaveMatchers extends BeHaveMatchers { outer: TryBaseMatchers => - implicit def toTryResultMatcher[T](result: MatchResult[Try[T]]) = new TryResultMatcher(result) + implicit def toTryResultMatcher[T](result: MatchResult[Try[T]]): TryResultMatcher[T] = new TryResultMatcher(result) class TryResultMatcher[T](result: MatchResult[Try[T]]) { def beSuccessfulTry = result(outer.beSuccessfulTry) def beASuccessfulTry = result(outer.beSuccessfulTry) diff --git a/mock/shared/src/main/scala/org/specs2/mock/mockito/MockitoStubs.scala b/mock/shared/src/main/scala/org/specs2/mock/mockito/MockitoStubs.scala index b4083c71ad..a5cf85b81a 100644 --- a/mock/shared/src/main/scala/org/specs2/mock/mockito/MockitoStubs.scala +++ b/mock/shared/src/main/scala/org/specs2/mock/mockito/MockitoStubs.scala @@ -10,7 +10,7 @@ import org.specs2.control.Use /** * This trait provides functionalities to declare stub values on method calls. - * + * * Usage: * {{{ * mockedList.get(0) returns "one" @@ -19,7 +19,7 @@ import org.specs2.control.Use * mockedList.get(0) answers ( i => "value " + i.toString ) * mockedList.get(any) responds { case i: Int => (i + 1).toString } * }}} - * + * * It is also possible to chain stubs like this: * {{{ * mockedList.get(0) returns "one" thenReturns "two" @@ -29,17 +29,17 @@ import org.specs2.control.Use trait MockitoStubs extends MocksCreation with MockitoStubsLowerImplicits { /** delegate to MockitoMocker doAnswer with a MockAnswer object using the function f. */ def doAnswer[T](f: Any => T) = mocker.doAnswer(new MockAnswer(f)) - + /** @return an object supporting the stub methods. */ - implicit def theStubbed[T](c: T) = new Stubbed(c) + implicit def theStubbed[T](c: T): Stubbed[T] = new Stubbed(c) - /** + /** * This class provide stub methods like returns, throws and answers. * Internally it calls Mockito.when(mock call).thenReturn(returnValue) */ class Stubbed[T](c: T) { def returns(t: T, t2: T*): OngoingStubbing[T] = { - if (t2.isEmpty) + if (t2.isEmpty) mocker.when(c).thenReturn(t) else t2.foldLeft (mocker.when(c).thenReturn(t)) { (res, cur) => res.thenReturn(cur) } @@ -56,7 +56,7 @@ trait MockitoStubs extends MocksCreation with MockitoStubsLowerImplicits { } } /** @return an object allowing the chaining of returned values on doNothing calls. */ - implicit def aStubber(stub: =>Stubber) = new AStubber(stub) + implicit def aStubber(stub: =>Stubber): AStubber[Nothing] = new AStubber(stub) /** provide stub chain methods. */ class AStubber[T](stub: =>Stubber) { def thenReturn(t: T) = stub.doReturn(t, List():_*) @@ -70,7 +70,7 @@ trait MockitoStubs extends MocksCreation with MockitoStubsLowerImplicits { def thenThrows[E <: Throwable](e: E) = stub.thenThrow(e) } - /** + /** * This class is an implementation of the Answer interface allowing to pass functions as an answer. * * It does a bit of work for the client: diff --git a/mock/shared/src/main/scala/org/specs2/mock/mockito/MocksCreation.scala b/mock/shared/src/main/scala/org/specs2/mock/mockito/MocksCreation.scala index 90a0cf7ca5..1f97ea3e4e 100644 --- a/mock/shared/src/main/scala/org/specs2/mock/mockito/MocksCreation.scala +++ b/mock/shared/src/main/scala/org/specs2/mock/mockito/MocksCreation.scala @@ -35,7 +35,7 @@ trait MocksCreation extends TheMockitoMocker with ClassesOf { * defaultReturn = 10, * extraInterfaces = classesOf[Cloneable, Serializable]) */ - implicit def mocked[T : ClassTag](t: =>T) = Mocked[T]() + implicit def mocked[T : ClassTag](t: =>T): Mocked[T] = Mocked[T]() /** support class to create a mock object with specific settings */ private[specs2] @@ -85,19 +85,19 @@ trait MocksCreation extends TheMockitoMocker with ClassesOf { /** * create a mock object with smart return values: val m = smartMock[java.util.List[String]] - * + * * This is the equivalent of Mockito.mock(List.class, SMART_NULLVALUES) but testing shows that it is not working well with Scala. */ def smartMock[T : ClassTag]: T = Mocked[T]().smart /** - * create a spy on an object. - * - * A spy is a real object but can still have some of its methods stubbed. However the syntax for stubbing a spy is a bit different than + * create a spy on an object. + * + * A spy is a real object but can still have some of its methods stubbed. However the syntax for stubbing a spy is a bit different than * with a mock: * {{{ * val s = spy(new LinkedList[String]) * doReturn("one").when(s).get(0) // instead of s.get(0) returns "one" which would throw an exception - * + * * }}} */ def spy[T](m: T): T = mocker.spy(m) diff --git a/scalacheck/shared/src/main/scala/org/specs2/scalacheck/ScalaCheckProperty.scala b/scalacheck/shared/src/main/scala/org/specs2/scalacheck/ScalaCheckProperty.scala index 755eca6e4f..87900097db 100644 --- a/scalacheck/shared/src/main/scala/org/specs2/scalacheck/ScalaCheckProperty.scala +++ b/scalacheck/shared/src/main/scala/org/specs2/scalacheck/ScalaCheckProperty.scala @@ -131,9 +131,9 @@ case class ScalaCheckFunction1[T, R]( type SelfType = ScalaCheckFunction1[T, R] - private implicit val asResult1 = asResult - private implicit val arbitrary1 = arbitrary - private implicit val pretty1 = pretty + private implicit val asResult1: AsResult[R] = asResult + private implicit val arbitrary1: Arbitrary[T] = arbitrary + private implicit val pretty1: T => Pretty = pretty lazy val propFunction = (t: T) => { lazy val executed = execute(t) @@ -197,9 +197,9 @@ case class ScalaCheckFunction2[T1, T2, R]( execute: (T1, T2) => R, type SelfType = ScalaCheckFunction2[T1, T2, R] - private implicit val asResult1 = asResult - private implicit val (arb1,arb2) = (argInstances1.arbitrary,argInstances2.arbitrary) - private implicit val (pr1,pr2) = (argInstances1.pretty,argInstances2.pretty) + private implicit val asResult1: AsResult[R] = asResult + private implicit val (arb1: Arbitrary[T1],arb2: Arbitrary[T2]) = (argInstances1.arbitrary,argInstances2.arbitrary) + private implicit val (pr1: (T1 => Pretty),pr2: (T2 => Pretty)) = (argInstances1.pretty,argInstances2.pretty) lazy val propFunction = (t1: T1, t2: T2) => { lazy val executed = execute(t1, t2) @@ -276,9 +276,9 @@ case class ScalaCheckFunction3[T1, T2, T3, R]( type SelfType = ScalaCheckFunction3[T1, T2, T3, R] - private implicit val asResult1 = asResult - private implicit val (arb1,arb2,arb3) = (argInstances1.arbitrary,argInstances2.arbitrary,argInstances3.arbitrary) - private implicit val (pr1,pr2,pr3) = (argInstances1.pretty,argInstances2.pretty,argInstances3.pretty) + private implicit val asResult1: AsResult[R] = asResult + private implicit val (arb1: Arbitrary[T1],arb2: Arbitrary[T2],arb3: Arbitrary[T3]) = (argInstances1.arbitrary,argInstances2.arbitrary,argInstances3.arbitrary) + private implicit val (pr1: (T1 => Pretty),pr2: (T2 => Pretty),pr3: (T3 => Pretty)) = (argInstances1.pretty,argInstances2.pretty,argInstances3.pretty) lazy val propFunction = (t1: T1, t2: T2, t3: T3) => { lazy val executed = execute(t1, t2, t3) @@ -362,9 +362,9 @@ case class ScalaCheckFunction4[T1, T2, T3, T4, R]( type SelfType = ScalaCheckFunction4[T1, T2, T3, T4, R] - private implicit val asResult1 = asResult - private implicit val (arb1,arb2,arb3,arb4) = (argInstances1.arbitrary,argInstances2.arbitrary,argInstances3.arbitrary,argInstances4.arbitrary) - private implicit val (pr1,pr2,pr3,pr4) = (argInstances1.pretty,argInstances2.pretty,argInstances3.pretty,argInstances4.pretty) + private implicit val asResult1: AsResult[R] = asResult + private implicit val (arb1: Arbitrary[T1],arb2: Arbitrary[T2],arb3: Arbitrary[T3],arb4: Arbitrary[T4]) = (argInstances1.arbitrary,argInstances2.arbitrary,argInstances3.arbitrary,argInstances4.arbitrary) + private implicit val (pr1: (T1 => Pretty),pr2: (T2 => Pretty),pr3: (T3 => Pretty),pr4: (T4 => Pretty)) = (argInstances1.pretty,argInstances2.pretty,argInstances3.pretty,argInstances4.pretty) lazy val propFunction = (t1: T1, t2: T2, t3: T3, t4: T4) => { lazy val executed = execute(t1, t2, t3, t4) @@ -454,9 +454,9 @@ case class ScalaCheckFunction5[T1, T2, T3, T4, T5, R]( type SelfType = ScalaCheckFunction5[T1, T2, T3, T4, T5, R] - private implicit val asResult1 = asResult - private implicit val (arb1,arb2,arb3,arb4,arb5) = (argInstances1.arbitrary,argInstances2.arbitrary,argInstances3.arbitrary,argInstances4.arbitrary,argInstances5.arbitrary) - private implicit val (pr1,pr2,pr3,pr4,pr5) = (argInstances1.pretty,argInstances2.pretty,argInstances3.pretty,argInstances4.pretty,argInstances5.pretty) + private implicit val asResult1: AsResult[R] = asResult + private implicit val (arb1: Arbitrary[T1],arb2: Arbitrary[T2],arb3: Arbitrary[T3],arb4: Arbitrary[T4],arb5: Arbitrary[T5]) = (argInstances1.arbitrary,argInstances2.arbitrary,argInstances3.arbitrary,argInstances4.arbitrary,argInstances5.arbitrary) + private implicit val (pr1: (T1 => Pretty),pr2: (T2 => Pretty),pr3: (T3 => Pretty),pr4: (T4 => Pretty),pr5: (T5 => Pretty)) = (argInstances1.pretty,argInstances2.pretty,argInstances3.pretty,argInstances4.pretty,argInstances5.pretty) lazy val propFunction = (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => { lazy val executed = execute(t1, t2, t3, t4, t5) @@ -553,9 +553,9 @@ case class ScalaCheckFunction6[T1, T2, T3, T4, T5, T6, R]( type SelfType = ScalaCheckFunction6[T1, T2, T3, T4, T5, T6, R] - private implicit val asResult1 = asResult - private implicit val (arb1,arb2,arb3,arb4,arb5,arb6) = (argInstances1.arbitrary,argInstances2.arbitrary,argInstances3.arbitrary,argInstances4.arbitrary,argInstances5.arbitrary,argInstances6.arbitrary) - private implicit val (pr1,pr2,pr3,pr4,pr5,pr6) = (argInstances1.pretty,argInstances2.pretty,argInstances3.pretty,argInstances4.pretty,argInstances5.pretty,argInstances6.pretty) + private implicit val asResult1: AsResult[R] = asResult + private implicit val (arb1: Arbitrary[T1],arb2: Arbitrary[T2],arb3: Arbitrary[T3],arb4: Arbitrary[T4],arb5: Arbitrary[T5],arb6: Arbitrary[T6]) = (argInstances1.arbitrary,argInstances2.arbitrary,argInstances3.arbitrary,argInstances4.arbitrary,argInstances5.arbitrary,argInstances6.arbitrary) + private implicit val (pr1: (T1 => Pretty),pr2: (T2 => Pretty),pr3: (T3 => Pretty),pr4: (T4 => Pretty),pr5: (T5 => Pretty),pr6: (T6 => Pretty)) = (argInstances1.pretty,argInstances2.pretty,argInstances3.pretty,argInstances4.pretty,argInstances5.pretty,argInstances6.pretty) lazy val propFunction = (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6) => { lazy val executed = execute(t1, t2, t3, t4, t5, t6) @@ -660,9 +660,9 @@ case class ScalaCheckFunction7[T1, T2, T3, T4, T5, T6, T7, R]( type SelfType = ScalaCheckFunction7[T1, T2, T3, T4, T5, T6, T7, R] - private implicit val asResult1 = asResult - private implicit val (arb1,arb2,arb3,arb4,arb5,arb6,arb7) = (argInstances1.arbitrary,argInstances2.arbitrary,argInstances3.arbitrary,argInstances4.arbitrary,argInstances5.arbitrary,argInstances6.arbitrary,argInstances7.arbitrary) - private implicit val (pr1,pr2,pr3,pr4,pr5,pr6,pr7) = (argInstances1.pretty,argInstances2.pretty,argInstances3.pretty,argInstances4.pretty,argInstances5.pretty,argInstances6.pretty,argInstances7.pretty) + private implicit val asResult1: AsResult[R] = asResult + private implicit val (arb1: Arbitrary[T1],arb2: Arbitrary[T2],arb3: Arbitrary[T3],arb4: Arbitrary[T4],arb5: Arbitrary[T5],arb6: Arbitrary[T6],arb7: Arbitrary[T7]) = (argInstances1.arbitrary,argInstances2.arbitrary,argInstances3.arbitrary,argInstances4.arbitrary,argInstances5.arbitrary,argInstances6.arbitrary,argInstances7.arbitrary) + private implicit val (pr1: (T1 => Pretty),pr2: (T2 => Pretty),pr3: (T3 => Pretty),pr4: (T4 => Pretty),pr5: (T5 => Pretty),pr6: (T6 => Pretty),pr7: (T7 => Pretty)) = (argInstances1.pretty,argInstances2.pretty,argInstances3.pretty,argInstances4.pretty,argInstances5.pretty,argInstances6.pretty,argInstances7.pretty) lazy val propFunction = (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7) => { lazy val executed = execute(t1, t2, t3, t4, t5, t6, t7) @@ -773,9 +773,9 @@ case class ScalaCheckFunction8[T1, T2, T3, T4, T5, T6, T7, T8, R]( type SelfType = ScalaCheckFunction8[T1, T2, T3, T4, T5, T6, T7, T8, R] - private implicit val asResult1 = asResult - private implicit val (arb1,arb2,arb3,arb4,arb5,arb6,arb7,arb8) = (argInstances1.arbitrary,argInstances2.arbitrary,argInstances3.arbitrary,argInstances4.arbitrary,argInstances5.arbitrary,argInstances6.arbitrary,argInstances7.arbitrary,argInstances8.arbitrary) - private implicit val (pr1,pr2,pr3,pr4,pr5,pr6,pr7,pr8) = (argInstances1.pretty,argInstances2.pretty,argInstances3.pretty,argInstances4.pretty,argInstances5.pretty,argInstances6.pretty,argInstances7.pretty,argInstances8.pretty) + private implicit val asResult1: AsResult[R] = asResult + private implicit val (arb1: Arbitrary[T1],arb2: Arbitrary[T2],arb3: Arbitrary[T3],arb4: Arbitrary[T4],arb5: Arbitrary[T5],arb6: Arbitrary[T6],arb7: Arbitrary[T7],arb8: Arbitrary[T8]) = (argInstances1.arbitrary,argInstances2.arbitrary,argInstances3.arbitrary,argInstances4.arbitrary,argInstances5.arbitrary,argInstances6.arbitrary,argInstances7.arbitrary,argInstances8.arbitrary) + private implicit val (pr1: (T1 => Pretty),pr2: (T2 => Pretty),pr3: (T3 => Pretty),pr4: (T4 => Pretty),pr5: (T5 => Pretty),pr6: (T6 => Pretty),pr7: (T7 => Pretty),pr8: (T8 => Pretty)) = (argInstances1.pretty,argInstances2.pretty,argInstances3.pretty,argInstances4.pretty,argInstances5.pretty,argInstances6.pretty,argInstances7.pretty,argInstances8.pretty) lazy val propFunction = (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8) => { lazy val executed = execute(t1, t2, t3, t4, t5, t6, t7, t8) diff --git a/scalaz/shared/src/main/scala/org/specs2/control/FutureInstances.scala b/scalaz/shared/src/main/scala/org/specs2/control/FutureInstances.scala index c869e57afc..f9dace61b8 100644 --- a/scalaz/shared/src/main/scala/org/specs2/control/FutureInstances.scala +++ b/scalaz/shared/src/main/scala/org/specs2/control/FutureInstances.scala @@ -7,7 +7,7 @@ import scalaz.concurrent._ object FuturezInstances { /** Applicative instance running futures in parallel for Scalaz */ - implicit val parallelApplicative = new Applicative[Future] { + implicit val parallelApplicative: org.specs2.fp.Applicative[scalaz.concurrent.Future] = new Applicative[Future] { def point[A](a: => A): Future[A] = Future.futureInstance.point(a) def ap[A,B](fa: => Future[A])(f: => Future[A => B]): Future[B] = Future.futureInstance.mapBoth(fa, f)((a, function) => function(a)) diff --git a/shapeless/src/main/scala/org/specs2/matcher/describe/CaseClassIntrospection.scala b/shapeless/src/main/scala/org/specs2/matcher/describe/CaseClassIntrospection.scala index 72bfc9c8e5..118454421b 100644 --- a/shapeless/src/main/scala/org/specs2/matcher/describe/CaseClassIntrospection.scala +++ b/shapeless/src/main/scala/org/specs2/matcher/describe/CaseClassIntrospection.scala @@ -29,7 +29,7 @@ object CaseClassIntrospection { implicit def caseClassFieldsInspector[Key <: Symbol, Value, Tail <: HList]( implicit key: Witness.Aux[Key], di: Diffable[Value], - diffTail: Lazy[CaseClassIntrospection[Tail]]) = + diffTail: Lazy[CaseClassIntrospection[Tail]]): ClassFieldsDifferenceInspectable[Key,Value,Tail] = new ClassFieldsDifferenceInspectable[Key, Value, Tail] @@ -73,4 +73,3 @@ class ClassFieldsDifferenceInspectable[Key <: Symbol, Value, Tail <: HList]( identical = compResult.identical) } } - diff --git a/shapeless/src/main/scala/org/specs2/shapeless/Projection.scala b/shapeless/src/main/scala/org/specs2/shapeless/Projection.scala index cf12256ca5..c1b59032b8 100644 --- a/shapeless/src/main/scala/org/specs2/shapeless/Projection.scala +++ b/shapeless/src/main/scala/org/specs2/shapeless/Projection.scala @@ -14,7 +14,7 @@ trait Projection { } // This allows us to obtain an implicit evidence parameter when A cannot be projected onto B. - implicit def notProjectsOn[A, B] = new DoesNotProjectOn[A, B] {} + implicit def notProjectsOn[A, B]: DoesNotProjectOn[A,B] = new DoesNotProjectOn[A, B] {} implicit def notProjectsOn1[A, B](implicit ev: A ProjectsOn B): DoesNotProjectOn[A, B] = { Use(ev); unexpected } implicit def notProjectsOn2[A, B](implicit ev: A ProjectsOn B): DoesNotProjectOn[A, B] = { Use(ev); unexpected } diff --git a/tests/src/test/scala/org/specs2/matcher/AnyMatchersSpec.scala b/tests/src/test/scala/org/specs2/matcher/AnyMatchersSpec.scala index 955885c0be..2b68765d44 100644 --- a/tests/src/test/scala/org/specs2/matcher/AnyMatchersSpec.scala +++ b/tests/src/test/scala/org/specs2/matcher/AnyMatchersSpec.scala @@ -109,7 +109,7 @@ Implicits // if this specification compiles and if result is ok, this means that the === implicit could be redefined // thanks to the NoCanBeEqual trait val spec = new Specification with NoTypedEqual { - implicit def otherTripleEqualUse[T](t: =>T) = new { + implicit def otherTripleEqualUse[T](t: =>T): AnyRef{def ===[S](other: S): S} = new { def ===[S](other: S) = other } val result = (1 === 2) must_== 2 @@ -122,7 +122,7 @@ Implicits // if this specification compiles and if result is ok, this means that the must implicit could be redefined // thanks to the NoMustExpectations trait val spec = new org.specs2.mutable.Specification with NoMustExpectations { - implicit def aValue[T](t: =>T) = new { + implicit def aValue[T](t: =>T): AnyRef{def must(other: Int): Int} = new { def must(other: Int) = other } val result = (1 must 2) === 2 diff --git a/tests/src/test/scala/org/specs2/matcher/ContentMatchersSpec.scala b/tests/src/test/scala/org/specs2/matcher/ContentMatchersSpec.scala index 13ae6efba7..e868bc8716 100644 --- a/tests/src/test/scala/org/specs2/matcher/ContentMatchersSpec.scala +++ b/tests/src/test/scala/org/specs2/matcher/ContentMatchersSpec.scala @@ -45,7 +45,7 @@ class ContentMatchersSpec extends Spec with LinesContentMatchers with BeforeAfte case class comp() extends MustMatchers with TestFileNames with ContentMatchers with FileSystem { lazy val dir = "target" / "test" / "contents" - override implicit protected val fileContentForMatchers = new LinesContent[File] { + override implicit protected val fileContentForMatchers: LinesContent[java.io.File]{def lines(f: java.io.File): IndexedSeq[String]} = new LinesContent[File] { def name(f: File) = f.getPath def lines(f: File) = readLines(FilePath.unsafe(f)).runOption.get } diff --git a/tests/src/test/scala/org/specs2/matcher/FutureMatchersSpec.scala b/tests/src/test/scala/org/specs2/matcher/FutureMatchersSpec.scala index 36e01cc3ec..2544d19bd3 100644 --- a/tests/src/test/scala/org/specs2/matcher/FutureMatchersSpec.scala +++ b/tests/src/test/scala/org/specs2/matcher/FutureMatchersSpec.scala @@ -8,6 +8,7 @@ import scala.concurrent._ import duration._ import runner._ import control.ExecuteActions._ +import org.specs2.concurrent._ import org.specs2.main.Arguments class FutureMatchersSpec extends Specification with ResultMatchers with specification.Retries { @@ -15,8 +16,8 @@ class FutureMatchersSpec extends Specification with ResultMatchers with specific lazy val env = Env(Arguments("threadsnb 4")) lazy val timeFactor = env.arguments.execute.timeFactor lazy val sleepTime = 50 * timeFactor.toLong - implicit lazy val ee = env.executionEnv - implicit lazy val ec = env.executionContext + implicit lazy val ee: ExecutionEnv = env.executionEnv + implicit lazy val ec: ExecutionContext = env.executionContext class MyTimeout extends TimeoutException def is = section("ci") ^ sequential ^ s2""" diff --git a/tests/src/test/scala/org/specs2/matcher/LogicalMatcherSpec.scala b/tests/src/test/scala/org/specs2/matcher/LogicalMatcherSpec.scala index 66e577cafb..ccf0b542d3 100644 --- a/tests/src/test/scala/org/specs2/matcher/LogicalMatcherSpec.scala +++ b/tests/src/test/scala/org/specs2/matcher/LogicalMatcherSpec.scala @@ -181,7 +181,7 @@ Custom } /** this allows to write "a must not bePositive" or "a must be positive" */ lazy val outer = this - implicit def anyBePositive[T : Numeric](result: MatchResult[T]) = new AnyBePositive(result) + implicit def anyBePositive[T : Numeric](result: MatchResult[T]): AnyBePositive[T] = new AnyBePositive(result) class AnyBePositive[T : Numeric](result: MatchResult[T]) { def bePositive = result(outer.bePositive) def positive = result(outer.bePositive) @@ -192,4 +192,4 @@ Custom /** this allows to write "a must not be positive" */ def positive[T : Numeric] = bePositive -} \ No newline at end of file +}