Type is not inferred correctly
Probably this is a bug.
I have this simple excerpt of code:
import java.nio.file._
for (f <- Files.newDirectoryStream(Paths.get("/home"))) {
....
}
"fich" is detected as "Any" when it should be a "Path".
So, I don't have code completion on "fich".
I use latest IDEA 13 and Scala plugin. It used to happen also with IDEA 12.
I'm using JDK 7 and Scala 2.10.3.
Thanks in advance for any tip.
Please sign in to leave a comment.
The expression on the right side of your `<-` evaluates to a `java.nio.file.DirectoryStream[java.nio.file.Path]`. To put it simple: This is not a Scala collection and cannot be used in a for-comprehension as you intend.
Thanks for your answer.
I forgot to tell you, I've used
The DirectoryStream is a Java Iterable.
Your example works ok for me. Do you have some example sbt project, with this sample code?
Best regards,
Alexander Podkhalyuzin.
Better than that, I'm providing you a complete and simple scala script:
IDEA plugin doesn't complain about the missing getFileName method, even though it thinks "f" is an Any object.
It's still ok for me with Scala 2.10.3 and JDK 1.7_40.
Best regards,
Alexander Podkhalyuzin.
That's true, I have another installation of IDEA 13 and it works ok.
The difference, is that I have updated the Scala plugin just today.
When I have access to the other computer I will check.
Confirmed that latest updates in the plugin have solved this. :)