scala / bug

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

better fault tolerance in typechecker for "not enough arguments" error #8739

Open scabug opened 10 years ago

scabug commented 10 years ago

See: http://stackoverflow.com/questions/24851454/presentation-compiler-type-completion-in-method-call-with-more-than-one-argumen#comment38591097_24851454

And: https://github.com/retronym/scala/commit/c1460f50945a161599d6d454da355ee20aa402b2

scabug commented 10 years ago

Imported From: https://issues.scala-lang.org/browse/SI-8739?orig=1 Reporter: @retronym

scabug commented 8 years ago

@adriaanm said: We had a recent PR around arity mismatches by @som-snytt, I believe -- maybe that fixed this one too?

scabug commented 8 years ago

@som-snytt said (edited on Jun 23, 2016 7:00:17 AM UTC): No, totally unrelated, but this is interesting. Still no completions in arg of f2. The WIP typechecks the available arg while erroring. Another idea is to insert the required commas. The IDE offers placeholders.

This effort on SO deserves preservation: "if i type comma after dot and then try again to complete after dot, it works!"

scala> def f(g: String => Int) = g("42")
f: (g: String => Int)Int

scala> f(x => x.
*  [snip...]                     

scala> def f2(g: String => Int, i: Int) = g("42") * i
f2: (g: String => Int, i: Int)Int

scala> f2(x => x.
!=   ##   +   ->   ==   asInstanceOf   ensuring   equals   formatted   getClass   hashCode   isInstanceOf   toString   ?

scala> f2(x => x.

scala> f2(x => x. , )
*   [etc...]

WIP repurposed https://github.com/scala/scala/pull/5243

It drove me nuts when Eclipse couldn't autocomplete inside Java 8 lambdas.

SethTisue commented 1 year ago

https://github.com/scala/scala/pull/5243 could perhaps be revived, if this is still an issue?