wix-incubator / accord

Accord: A sane validation library for Scala
http://wix.github.io/accord/
Other
530 stars 55 forks source link

PartialFunction in validator leads to odd truncation error #121

Closed timcharper closed 6 years ago

timcharper commented 6 years ago

Reproduced easily via Ammonite REPL:

import $ivy.`com.wix::accord-core:0.7.1`
import com.wix.accord._
import com.wix.accord.dsl._
case class Thing(people: List[String])

val thing2Validator = validator[Thing] { t =>
  t.people.filter { case p if p != "" => true } is notEmpty
}

The macro fails during compile time:

<Accord>:1: '}' expected but eof found.
t.people.filter { case p if p != "" => true
                                           ^
Compilation Failed
timcharper commented 6 years ago

Related to #120

holograph commented 6 years ago

Thanks again! As with #120, which Scala version are you using here?

holograph commented 6 years ago

(Reproduced with 2.12.3, leaving the comment in case other versions are also affected)