From the play2’s doc: http://www.playframework.org/documentation/2.0/ScalaForms, there is a sample code:
val loginForm = Form(
tuple(
"email" -> nonEmptyText,
"password" -> text
) verifying("Invalid user name or password", {
case (e, p) => User.authenticate(e,p).isDefined
})
)
But it can’t be compiled, the error message is:
Multiple markers at this line
- missing parameter type for expanded function The argument types of an anonymous
function must be fully known. (SLS 8.5) Expected type was: ?
It should be wrote as:
verifying("Invalid user name or password", params => params match {
case (e, p) => User.authenticate(e,p).isDefined
}
My play version is latest play2.1-SNAPSHOT(2012-03-18).
Is there something wrong with the doc, or do I miss something?
The docs are outdated/wrong, your second version is correct. You can fix the docs yourself, it’s a wiki.