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:
parent
e765775a01
commit
5ba210e531
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue