ensime returning some unexpected type errors

30 views
Skip to first unread message

Alexandre Bertails

unread,
Apr 28, 2012, 5:20:20 PM4/28/12
to ens...@googlegroups.com
Hi,

I just bumped into the latest version of ensime to take advantage of the multi-project support. But ensime now returns some errors that don't look to be errors ("sbt compile" still works just fine). Is this a known issue that others have experienced?

My project is available at https://github.com/betehess/pimp-my-rdf and the problem should be easy to reproduce.

Alexandre.

Aemon Cannon

unread,
Apr 28, 2012, 9:46:00 PM4/28/12
to ens...@googlegroups.com
Hi Alexandre,

The presentation compiler embedded in ensime does sometimes return different results from the official compiler. Especially for tricky implicit resolution.
However, the fact that your project worked with older versions makes me think it might be a project configuration issue. What types of errors are you seeing?

Alexandre Bertails

unread,
Apr 29, 2012, 9:32:23 AM4/29/12
to ens...@googlegroups.com
Hi Aemon,

On Sat, Apr 28, 2012 at 9:46 PM, Aemon Cannon <aemon...@gmail.com> wrote:
> Hi Alexandre,
>
> The presentation compiler embedded in ensime does sometimes return different
> results from the official compiler. Especially for tricky implicit
> resolution.
> However, the fact that your project worked with older versions makes me
> think it might be a project configuration issue. What types of errors are
> you seeing?

For example, I have something like that:

[[
ERROR: overloaded method value read with alternatives: (s:
String,base: String)scalaz.Validation[Throwable,Rdf#Graph] <and>
(file: java.io.File,base:
String)scalaz.Validation[Throwable,Rdf#Graph] cannot be applied to
(java.io.InputStreamReader, String) : line 37
]]

The corresponding code is at [1]. That's basic OOP with method
overloading (the real method is a few line down), so I don't really
understand how the presentation compiler can be so wrong here.

Alexandre.

[1] https://github.com/betehess/pimp-my-rdf/blob/master/n3/src/main/scala/TurtleReader.scala#L37

Alexandre Bertails

unread,
Apr 29, 2012, 10:39:52 AM4/29/12
to ens...@googlegroups.com
On Sun, Apr 29, 2012 at 9:32 AM, Alexandre Bertails
<alex...@bertails.org> wrote:
> Hi Aemon,
>
> On Sat, Apr 28, 2012 at 9:46 PM, Aemon Cannon <aemon...@gmail.com> wrote:
>> Hi Alexandre,
>>
>> The presentation compiler embedded in ensime does sometimes return different
>> results from the official compiler. Especially for tricky implicit
>> resolution.
>> However, the fact that your project worked with older versions makes me
>> think it might be a project configuration issue. What types of errors are
>> you seeing?
>
> For example, I have something like that:
>
> [[
> ERROR: overloaded method value read with alternatives:   (s:
> String,base: String)scalaz.Validation[Throwable,Rdf#Graph] <and>
> (file: java.io.File,base:
> String)scalaz.Validation[Throwable,Rdf#Graph]  cannot be applied to
> (java.io.InputStreamReader, String) : line 37
> ]]
>
> The corresponding code is at [1]. That's basic OOP with method
> overloading (the real method is a few line down), so I don't really
> understand how the presentation compiler can be so wrong here.

So, I don't know why, but defining [[ type RdfGraph = Rdf#Graph ]]
then referring to RDFGraph instead of the type projection makes ensime
happier. That is scary, isn't it?

If anybody has an idea on what's going on...

Alexandre.

Aemon Cannon

unread,
Apr 30, 2012, 7:10:28 PM4/30/12
to ens...@googlegroups.com
Looks like a pres compiler bug to me. You're using the latest ensime? (scala 2.9.2 compiler?)

Alexandre Bertails

unread,
Apr 30, 2012, 8:49:00 PM4/30/12
to ens...@googlegroups.com
On Mon, Apr 30, 2012 at 7:10 PM, Aemon Cannon <aemon...@gmail.com> wrote:
> Looks like a pres compiler bug to me. You're using the latest ensime? (scala
> 2.9.2 compiler?)

Yes, I actually now use the github version.

If this is a presentation compiler bug, what would be the best way to
reproduce this bug out of ensime?

Alexandre.

Aemon Cannon

unread,
Apr 30, 2012, 10:37:41 PM4/30/12
to ens...@googlegroups.com
Hey Alexandre,

You can use something like this to isolate:

----
import scala.tools.nsc.Settings
import scala.tools.nsc.reporters.ConsoleReporter
import scala.tools.nsc.interactive.Global

object Main{

  def main(args:Array[String]){
    val settings = new Settings(Console.println)
    settings.processArguments(
      List("-verbose", 
"-classpath","/path/to/scala-library.jar",
"-sourcepath","."), false)
    settings.usejavacp.value = false

    val reporter = new ConsoleReporter(settings)
    val c = new Global(settings, reporter)
    val x = new c.Response[Unit]()
    c.askReload(List(c.getSourceFile("test.scala")),x)
    x.get
  }
}


Let us know what you come up with!

-Aemon
Reply all
Reply to author
Forward
0 new messages