Last active
June 13, 2019 18:51
-
-
Save nivekastoreth/5c0e005c986a3827aa29a17a9274fb40 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.specs2.matcher.MatchResult | |
import org.specs2.mutable.Specification | |
import scala.collection.mutable | |
class SubtractableTestSpec extends Specification { | |
"pass short circuit if not timed out" in { | |
val a: MatchResult[String] = "test" ==== "test" | |
val b: MatchResult[mutable.Buffer[Int]] = mutable.ArrayBuffer.empty[Int] must beEmpty | |
val c: MatchResult[Set[String]] = Set.empty[String] must beEmpty | |
val ab = a and b // compiles | |
val ac = a and c // compiles | |
val ba = b and a // compiles | |
val bc = b and c // fails | |
val ca = c and a // compiles | |
val cb = c and b // fails | |
val abc = a and b and c // compiles | |
val acb = a and c and b // compiles | |
val bac = b and a and c // compiles | |
val bca = b and c and a // fails | |
val cab = c and a and b // compiles | |
val cba = c and b and a // fails | |
// instead of re-arranging the tests, prefixing with `ok` also seems to be a valid workaround | |
val ok_bc = ok and b and c // compiles | |
val ok_cb = ok and c and b // compiles | |
val ok_bca = ok and b and c and a // compiles | |
val ok_cba = ok and c and b and a // compiles | |
abc | |
} | |
} | |
/* | |
[error] SubtractableTestSpec.scala:16:9: type arguments [?,Iterable[Any] with Int with String => AnyVal with scala.collection.generic.Subtractable[_ >: Int with String, Iterable[Any] with Int with String => AnyVal with scala.collection.generic.Subtractable[_ >: Int with String, Equals]]{def seq: Iterable[Any] with Int with String => AnyVal}] do not conform to trait Subtractable's type parameter bounds [A,+Repr <: scala.collection.generic.Subtractable[A,Repr]] | |
[error] val bc = b and c // fails | |
[error] ^ | |
[error] SubtractableTestSpec.scala:16:16: type arguments [?,Iterable[Any] with Int with String => AnyVal with scala.collection.generic.Subtractable[_ >: Int with String, Iterable[Any] with Int with String => AnyVal with scala.collection.generic.Subtractable[_ >: Int with String, Equals]]{def seq: Iterable[Any] with Int with String => AnyVal}] do not conform to trait Subtractable's type parameter bounds [A,+Repr <: scala.collection.generic.Subtractable[A,Repr]] | |
[error] val bc = b and c // fails | |
[error] ^ | |
[error] SubtractableTestSpec.scala:18:9: type arguments [?,Iterable[Any] with String with Int => AnyVal with scala.collection.generic.Subtractable[_ >: String with Int, Iterable[Any] with String with Int => AnyVal with scala.collection.generic.Subtractable[_ >: String with Int, Equals]]{def seq: Iterable[Any] with String with Int => AnyVal}] do not conform to trait Subtractable's type parameter bounds [A,+Repr <: scala.collection.generic.Subtractable[A,Repr]] | |
[error] val cb = c and b // fails | |
[error] ^ | |
[error] SubtractableTestSpec.scala:18:16: type arguments [?,Iterable[Any] with String with Int => AnyVal with scala.collection.generic.Subtractable[_ >: String with Int, Iterable[Any] with String with Int => AnyVal with scala.collection.generic.Subtractable[_ >: String with Int, Equals]]{def seq: Iterable[Any] with String with Int => AnyVal}] do not conform to trait Subtractable's type parameter bounds [A,+Repr <: scala.collection.generic.Subtractable[A,Repr]] | |
[error] val cb = c and b // fails | |
[error] ^ | |
[error] SubtractableTestSpec.scala:23:17: type arguments [?,Iterable[Any] with Int with String => AnyVal with scala.collection.generic.Subtractable[_ >: Int with String, Iterable[Any] with Int with String => AnyVal with scala.collection.generic.Subtractable[_ >: Int with String, Equals]]{def seq: Iterable[Any] with Int with String => AnyVal}] do not conform to trait Subtractable's type parameter bounds [A,+Repr <: scala.collection.generic.Subtractable[A,Repr]] | |
[error] val bca = b and c and a // fails | |
[error] ^ | |
[error] SubtractableTestSpec.scala:25:17: type arguments [?,Iterable[Any] with String with Int => AnyVal with scala.collection.generic.Subtractable[_ >: String with Int, Iterable[Any] with String with Int => AnyVal with scala.collection.generic.Subtractable[_ >: String with Int, Equals]]{def seq: Iterable[Any] with String with Int => AnyVal}] do not conform to trait Subtractable's type parameter bounds [A,+Repr <: scala.collection.generic.Subtractable[A,Repr]] | |
[error] val cba = c and b and a // fails | |
[error] ^ | |
[error] 6 errors found | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment