fastparse icon indicating copy to clipboard operation
fastparse copied to clipboard

False negative parse error for type ascription on partial function inside for comprehension assignment

Open olafurpg opened this issue 8 years ago • 1 comments

twitter/scalding started failing in ProjectTests in PR #159 due to a recent commit https://github.com/twitter/scalding/commit/f4b77ce5a70c76568117b9b24f534bea8b124ac5

The culprit lines are https://github.com/twitter/scalding/blob/cc6e71d2e4ee26e7c0ac0a77735fd1455d867ee9/scalding-graph/src/test/scala/com/twitter/scalding/graph/LiteralTests.scala#L34-L38

def genUnary: Gen[Literal[Int, Box]] = for {
  fn <- Arbitrary.arbitrary[(Int) => (Int)]
  bfn = { case Box(b) => Box(fn(b)) }: Box[Int] => Box[Int]
  input <- genLiteral
} yield UnaryLit(input, bfn)
// CompilationUnit:1:1 / Body:17:1 / TopStatSeq:19:1 / TopStat:22:1 / Tmpl:22:1 / ObjDef:22:1 / DefTmpl:22:21 / AnonTmpl:22:29 / NamedTmpl:22:29 / TmplBody:22:51 / TmplStat:34:3 / BlockDef:34:3 / Dcl:34:3 / FunDef:34:7 / Body:34:39 / Expr:34:42 / For:34:42 / Body:34:46 / "}":36:51 ..."=> Box[Int"

olafurpg avatar Aug 13 '17 09:08 olafurpg

lol postfix arrow-function type-annotations will be the death of me. This is probably the 10th bug I've bumped into related to those fellas

lihaoyi avatar Aug 13 '17 12:08 lihaoyi