scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
232 stars 21 forks source link

Partial application of curried functions using infix #5073

Open scabug opened 12 years ago

scabug commented 12 years ago

We get a compiler error when trying to partially apply a /: (left fold)

def f(xs: List[Int]) = (0 /: xs) _

:15: error: missing arguments for method /: in trait TraversableOnce; follow this method with `_' if you want to treat it as a partially applied function Here are some workarounds: def f(xs: List[Int]) = xs.foldLeft(0) _ def f(xs: List[Int]) = xs./:(0) _ def f(xs: List[Int]): ((Int, Int) => Int) => Int = (0 /: xs) http://stackoverflow.com/q/7735736/770361
scabug commented 12 years ago

Imported From: https://issues.scala-lang.org/browse/SI-5073?orig=1 Reporter: Luigi Plinge (rbj2001) Affected Versions: 2.9.0-1, 2.9.1 Duplicates #1980

scabug commented 12 years ago

@paulp said: This is essentially a duplicate of #1980 because they're both caused by the odd desugaring performed on right associative operations. Maybe I can get both.

som-snytt commented 5 years ago

I'll try to follow up in https://github.com/scala/scala/pull/7741 which possibly makes it worse if possible.