{"action":"created","issue":{"url":"https://api.github.com/repos/wix/accord/issues/89","repository_url":"https://api.github.com/repos/wix/accord","labels_url":"https://api.github.com/repos/wix/accord/issues/89/labels{/name}","comments_url":"https://api.github.com/repos/wix/accord/issues/89/comments","events_url":"https://api.github.com/repos/wix/accord/issues/89/events","html_url":"https://github.com/wix/accord/issues/89","id":190123187,"number":89,"title":"java.lang.UnsupportedOperationException: Position.start on NoPosition when trying to use map","user":{"login":"zbeckman","id":5351337,"avatar_url":"https://avatars.githubusercontent.com/u/5351337?v=3","gravatar_id":"","url":"https://api.github.com/users/zbeckman","html_url":"https://github.com/zbeckman","followers_url":"https://api.github.com/users/zbeckman/followers","following_url":"https://api.github.com/users/zbeckman/following{/other_user}","gists_url":"https://api.github.com/users/zbeckman/gists{/gist_id}","starred_url":"https://api.github.com/users/zbeckman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zbeckman/subscriptions","organizations_url":"https://api.github.com/users/zbeckman/orgs","repos_url":"https://api.github.com/users/zbeckman/repos","events_url":"https://api.github.com/users/zbeckman/events{/privacy}","received_events_url":"https://api.github.com/users/zbeckman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-17T18:16:30Z","updated_at":"2016-11-29T09:44:56Z","closed_at":null,"body":"When working with validation around options, I tend to run into `java.lang.UnsupportedOperationException: Position.start on NoPosition` quite a bit. Here are two examples that trigger the exception:\r\n```\r\n// p.group.map(_) is a String\r\nimplicit val groupValidator = validator[Group] { (p: Group) =>\r\n  p.group.map(_.length).each as \"group length is not between 1 and 3 characters\" is between(1, 3)\r\n}\r\n```\r\nAnd another one (first discovered while discussing #81):\r\n```\r\n// p.dateOfBirth.map(_) is a LocalDate\r\np.dateOfBirth.map(_ isBefore LocalDate.now()).each as \"date of birth is in the future\" is true\r\n```\r\nThe exception I'm seeing is:\r\n```\r\nError:(11, 49) exception during macro expansion: \r\njava.lang.UnsupportedOperationException: Position.start on NoPosition\r\n\tat scala.reflect.internal.util.Position.fail(Position.scala:17)\r\n\tat scala.reflect.internal.util.UndefinedPosition.start(Position.scala:94)\r\n\tat scala.reflect.internal.util.UndefinedPosition.start(Position.scala:90)\r\n\tat com.wix.accord.transform.MacroHelper$class.startPos(MacroHelper.scala:70)\r\n\tat com.wix.accord.transform.ValidationTransform.startPos(ValidationTransform.scala:24)\r\n\tat com.wix.accord.transform.ExpressionDescriber$$anonfun$1.applyOrElse(ExpressionDescriber.scala:53)\r\n\tat com.wix.accord.transform.ExpressionDescriber$$anonfun$1.applyOrElse(ExpressionDescriber.scala:53)\r\n\tat scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36)\r\n\tat scala.reflect.internal.Trees$CollectTreeTraverser.traverse(Trees.scala:1657)\r\n\tat scala.reflect.internal.Trees$CollectTreeTraverser.traverse(Trees.scala:1654)\r\n\tat scala.reflect.internal.Trees$$anonfun$traverseMemberDef$1$1.apply$mcV$sp(Trees.scala:1209)\r\n\tat scala.reflect.api.Trees$Traverser.atOwner(Trees.scala:2507)\r\n\tat scala.reflect.internal.Trees$class.traverseMemberDef$1(Trees.scala:1203)\r\n\tat scala.reflect.internal.Trees$class.itraverse(Trees.scala:1328)\r\n\tat scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)\r\n\tat scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)\r\n\tat scala.reflect.api.Trees$Traverser.traverse(Trees.scala:2475)\r\n\tat scala.reflect.internal.Trees$CollectTreeTraverser.traverse(Trees.scala:1658)\r\n\tat scala.reflect.internal.Trees$CollectTreeTraverser.traverse(Trees.scala:1654)\r\n\tat scala.reflect.api.Trees$Traverser.traverseTrees(Trees.scala:2484)\r\n\tat scala.reflect.api.Trees$Traverser.traverseParams(Trees.scala:2492)\r\n\tat scala.reflect.internal.Trees$$anonfun$itraverse$1.apply$mcV$sp(Trees.scala:1329)\r\n\tat scala.reflect.api.Trees$Traverser.atOwner(Trees.scala:2507)\r\n\tat scala.reflect.internal.Trees$class.itraverse(Trees.scala:1329)\r\n\tat scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)\r\n\tat scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)\r\n\tat scala.reflect.api.Trees$Traverser.traverse(Trees.scala:2475)\r\n\tat scala.reflect.internal.Trees$CollectTreeTraverser.traverse(Trees.scala:1658)\r\n\tat scala.reflect.internal.Trees$CollectTreeTraverser.traverse(Trees.scala:1654)\r\n\tat scala.reflect.api.Trees$Traverser.traverseTrees(Trees.scala:2484)\r\n\tat scala.reflect.internal.Trees$class.traverseComponents$1(Trees.scala:1284)\r\n\tat scala.reflect.internal.Trees$class.itraverse(Trees.scala:1330)\r\n\tat scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)\r\n\tat scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)\r\n\tat scala.reflect.api.Trees$Traverser.traverse(Trees.scala:2475)\r\n\tat scala.reflect.internal.Trees$CollectTreeTraverser.traverse(Trees.scala:1658)\r\n\tat scala.reflect.internal.Trees$TreeContextApiImpl.collect(Trees.scala:118)\r\n\tat com.wix.accord.transform.ExpressionDescriber$class.prettyPrint(ExpressionDescriber.scala:53)\r\n\tat com.wix.accord.transform.ExpressionDescriber$class.describeTree(ExpressionDescriber.scala:127)\r\n\tat com.wix.accord.transform.ValidationTransform.describeTree(ValidationTransform.scala:24)\r\n\tat com.wix.accord.transform.ValidationTransform.rewriteOne(ValidationTransform.scala:41)\r\n\tat com.wix.accord.transform.ValidationTransform$$anonfun$rewriteValidationRules$1.applyOrElse(ValidationTransform.scala:192)\r\n\tat com.wix.accord.transform.ValidationTransform$$anonfun$rewriteValidationRules$1.applyOrElse(ValidationTransform.scala:190)\r\n\tat scala.PartialFunction$OrElse.apply(PartialFunction.scala:167)\r\n\tat com.wix.accord.transform.ValidationTransform$$anonfun$1.applyOrElse(ValidationTransform.scala:118)\r\n\tat com.wix.accord.transform.ValidationTransform$$anonfun$1.applyOrElse(ValidationTransform.scala:118)\r\n\tat scala.PartialFunction$OrElse.apply(PartialFunction.scala:167)\r\n\tat com.wix.accord.transform.ValidationTransform$$anonfun$3.applyOrElse(ValidationTransform.scala:144)\r\n\tat com.wix.accord.transform.ValidationTransform$$anonfun$3.applyOrElse(ValidationTransform.scala:144)\r\n\tat scala.PartialFunction$OrElse.apply(PartialFunction.scala:167)\r\n\tat com.wix.accord.transform.PatternHelper$$anon$2.traverse(PatternHelper.scala:85)\r\n\tat scala.reflect.api.Trees$Traverser.traverseTrees(Trees.scala:2484)\r\n\tat scala.reflect.internal.Trees$class.traverseComponents$1(Trees.scala:1234)\r\n\tat scala.reflect.internal.Trees$class.itraverse(Trees.scala:1330)\r\n\tat scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)\r\n\tat scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)\r\n\tat scala.reflect.api.Trees$Traverser.traverse(Trees.scala:2475)\r\n\tat com.wix.accord.transform.PatternHelper$$anon$2.traverse(PatternHelper.scala:87)\r\n\tat com.wix.accord.transform.PatternHelper$class.collectFromPattern(PatternHelper.scala:89)\r\n\tat com.wix.accord.transform.ValidationTransform.collectFromPattern(ValidationTransform.scala:24)\r\n\tat com.wix.accord.transform.ValidationTransform.transformed(ValidationTransform.scala:210)\r\n\tat com.wix.accord.transform.ValidationTransform$.apply(ValidationTransform.scala:230)\r\n\timplicit val groupValidator = validator[Group] { (p: Group) =>\r\n```"},"comment":{"url":"https://api.github.com/repos/wix/accord/issues/comments/263523501","html_url":"https://github.com/wix/accord/issues/89#issuecomment-263523501","issue_url":"https://api.github.com/repos/wix/accord/issues/89","id":263523501,"user":{"login":"holograph","id":1114848,"avatar_url":"https://avatars.githubusercontent.com/u/1114848?v=3","gravatar_id":"","url":"https://api.github.com/users/holograph","html_url":"https://github.com/holograph","followers_url":"https://api.github.com/users/holograph/followers","following_url":"https://api.github.com/users/holograph/following{/other_user}","gists_url":"https://api.github.com/users/holograph/gists{/gist_id}","starred_url":"https://api.github.com/users/holograph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/holograph/subscriptions","organizations_url":"https://api.github.com/users/holograph/orgs","repos_url":"https://api.github.com/users/holograph/repos","events_url":"https://api.github.com/users/holograph/events{/privacy}","received_events_url":"https://api.github.com/users/holograph/received_events","type":"User","site_admin":false},"created_at":"2016-11-29T09:44:56Z","updated_at":"2016-11-29T09:44:56Z","body":"Managed to reproduce the issue locally, thanks for the report. This looks like a simple one.\r\n"}}
{"actor":{"display_login":"holograph"}}