Type inference issue when using Scala IO 0.4

Hi,

I've found a frustrating type inference issue when writing code which
uses Jesse Eichar's Scala IO library.

Here's a really short example:


import scalax.file.ramfs.RamFileSystem

object Test extends App {

    val fs = new RamFileSystem()

    val root = fs.root / "somedir" createDirectory()

    val indexDir = root / "_index" createDirectory()

    println("IndexDir =" + indexDir)
}



This code compiles OK but the presentation compiler complains about the
second call to createDirectory.

It seems to have inferred the type of root to be Any when it should be
at least Path according to the signature of createDirectory.

This of course means that any subsequent code won't type check unless
explicit types and casts are used.

This was using the latest IDEA EAP (117.281) and originally against
Scala Plugin build 683.  I also upgraded to build 708 but the same happened.

The project uses Scala 2.9.1 with the 0.4 release of scala-io-core and
scala-io-file for Scala 2.9.1 from Maven Central.

Interestingly I was previously using a SNAPSHOT build of Scala IO and
the problem didn't occur then.  I'm afraid I don't have and can no
longer find the source of the snapshot to see what changed between the
two versions.

So I guess this should be logged as a bug or is it an already known problem?


Thanks,
Steve Sowerby.


0
4 comments

Please create new ticket to http://youtrack.jetbrains.com/issues/SCL
I'll check it and try to fix (and possibly explain actual problem).

Best regards,
Alexander Podkhlayuzin.

0

I'm a bit puzzled when I see people reporting single "good code red" issues as if they were surprised. I estimate that I have several such errors in most files in my projects.

Am I doing something wrong?

0

I think it depends on your code style (and possibly library set is also important). For example hard usage of path dependent types is problem for plugin now and I'm planning to fix it as soon as possible.
Fixing such cases is like communism building, however my hope is to reduce amount of possibilies to get red code as much as possible (I think we are on the way now).

Best regards,
Alexander Podkhalyuzin.

0

Thanks,
Bug reported:
http://youtrack.jetbrains.com/issue/SCL-4314

And I've tried, but as yet failed, to simplify it to not need the
external libraries.
I've added the current attempt to the bug.


On 04/05/2012 16:18, Alexander Podkhalyuzin wrote:

Please create new ticket to http://youtrack.jetbrains.com/issues/SCL
I'll check it and try to fix (and possibly explain actual problem).

>

Best regards,
Alexander Podkhlayuzin.

>

---
Original message URL: http://devnet.jetbrains.net/message/5458749#5458749


0

Please sign in to leave a comment.