The ensuring methods should be by-name on the message argument

like assert, assume, and require.  Closes #4129, no review.

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23931 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
extempore 2011-01-09 04:00:00 +00:00
parent e765775a01
commit 5ba210e531
1 changed files with 2 additions and 2 deletions

View File

@ -155,9 +155,9 @@ object Predef extends LowPriorityImplicits {
final class Ensuring[A](val x: A) {
def ensuring(cond: Boolean): A = { assert(cond); x }
def ensuring(cond: Boolean, msg: Any): A = { assert(cond, msg); x }
def ensuring(cond: Boolean, msg: => Any): A = { assert(cond, msg); x }
def ensuring(cond: A => Boolean): A = { assert(cond(x)); x }
def ensuring(cond: A => Boolean, msg: Any): A = { assert(cond(x), msg); x }
def ensuring(cond: A => Boolean, msg: => Any): A = { assert(cond(x), msg); x }
}
implicit def any2Ensuring[A](x: A): Ensuring[A] = new Ensuring(x)