These are chat archives for etorreborre/specs2

22nd
Oct 2015
PetomatAtDASGIP
@PetomatAtDASGIP
Oct 22 2015 12:12
Hello. Is there a matcher to test if a method invocation compiles?
Example:
  sealed trait =!=[A, B]

  object =!= {
    implicit def equals[A, B] = new (A =!= B) {}
    // These two functions exclude the equals case by an ambiguous implicit in scope
    implicit def unequal1[A] = new (A =!= A) {}
    implicit def unequal2[A] = new (A =!= A) {}
  }
def identityButNotBoolean[T](t: T)(implicit ev: T =!= Boolean): T = t
identityButNotBoolean(42)            // compiles
identityButNotBoolean(true)          // doesn't compile
identityButNotBoolean("Hello World") // compiles
Eric Torreborre
@etorreborre
Oct 22 2015 12:14
Yes there are TypecheckMatchers in 3.4.6
PetomatAtDASGIP
@PetomatAtDASGIP
Oct 22 2015 12:15
I will have a look, thanks!
Eric Torreborre
@etorreborre
Oct 22 2015 12:15
Have a look at the User Guide for some examples