diff options
author | Martin Odersky <odersky@gmail.com> | 2016-04-22 11:55:36 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-04-22 12:06:31 +0200 |
commit | 89f9091c2d10aa23c5d6259694df104fc14c60f7 (patch) | |
tree | b78bab097099c5b4fa8a62fe422419227a4adf07 /tests | |
parent | 320ca51f0226cf61dfa6d882d30de15ab221f07b (diff) | |
download | dotty-89f9091c2d10aa23c5d6259694df104fc14c60f7.tar.gz dotty-89f9091c2d10aa23c5d6259694df104fc14c60f7.tar.bz2 dotty-89f9091c2d10aa23c5d6259694df104fc14c60f7.zip |
Support implicitNotFound annotation
Diffstat (limited to 'tests')
-rw-r--r-- | tests/neg/EqualityStrawman1.scala | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/neg/EqualityStrawman1.scala b/tests/neg/EqualityStrawman1.scala index 8c9b435e4..b1b6c0380 100644 --- a/tests/neg/EqualityStrawman1.scala +++ b/tests/neg/EqualityStrawman1.scala @@ -1,20 +1,23 @@ package strawman.equality +import annotation.implicitNotFound object EqualityStrawman1 { trait Eq[-T] - trait Impossible + + @implicitNotFound("cannot compare value of type ${T} with a value outside its equality class") + trait Impossible[T] object Eq extends Eq[Any] trait Base { def === (other: Any): Boolean = this.equals(other) - def === (other: CondEquals)(implicit ce: Impossible): Boolean = ??? + def === [T <: CondEquals](other: T)(implicit ce: Impossible[T]): Boolean = ??? } trait CondEquals extends Base { def === [T >: this.type <: CondEquals](other: T)(implicit ce: Eq[T]): Boolean = this.equals(other) - def === (other: Any)(implicit ce: Impossible): Boolean = ??? + def === [T](other: T)(implicit ce: Impossible[T]): Boolean = ??? } trait Equals[-T] extends CondEquals |