Plugin doesn't detect implicit conversion on function result

Hi,

For some reason this expression below won't perform the implicit conversion through option2Iterable. Using Ctrl+Shift+Q in the latest IDEA 13, I notice that this particular conversion doesn't appear there in the former case (where I get an underlined error), but does appear in the latter case (where the expression typechecks).
Therefore, it seems like the result of a function fails to be converted properly.

// Get an error in the IDE (but compiles fine)
val f = {_: Int => Some("yo")}
// I get this same error twice (under `f`): Expected Int => GenTraversableOnce[_B], but got Int => Some[String]
// Here, pressing CTRL+SHIFT+Q on `f` shows me only `any2*` implicit conversions
 val x = Seq(1,2) flatMap f

 // Works
// Option correctly converts to Iterable via `option2Iterable`
// Pressing CTRL+SHIFT+Q on Some("yo") reveals option2Iterable
 val y = Seq(1,2) flatMap (_ => Some("yo"))

Thanks!

Scala plugin version         0.26.318

4 comments
Comment actions Permalink

I created an issue: http://youtrack.jetbrains.com/issue/SCL-6353
Thank you for the report!

Best regards,
Alexander Podkhalyuzin.

0
Comment actions Permalink

Actually the shortest workaround is to use f(_) instead of just f.

Best regards,
Alexander Podkhalyuzin.

0
Comment actions Permalink

Thanks! Yeah, that's even better.
Btw the issue doesn't seem to contain any code and its title seems truncated -- "Good code is red: Implicit conversion on et"

0
Comment actions Permalink

Yes, our issue tracker weird bug. I fixed issue text, thank you!.

Best regards,
Alexadner Podkhalyuzin.

0

Please sign in to leave a comment.