Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Presentation compiler spurious error with cats, circe, slick, doobie, freek.... Anything Type involved #9716

Closed
scabug opened this issue Mar 23, 2016 · 14 comments

Comments

@scabug
Copy link

scabug commented Mar 23, 2016

I'm trying circe for Json, and the presentation compiler (that's the Scala IDE dev who said it :) is reporting false errors, as soon as I tried to do... well, almost anything related to circe jsons decoder :)

For example:

    // depency on circe 0.3.0, see: https://github.com/travisbrown/circe/
    import io.circe._
    import io.circe.generic.semiauto._
    import io.circe.parser._

    final case class User(email: String)

    object UserDecode {
      implicit lazy val userEventDecoder: Decoder[User] = deriveDecoder[User]
    }

The code compile, but on line 'implicit lazy val...', eclipse show a red-cross error under User:

Multiple markers at this line:
  not enough arguments for method deriveDecoder: (implicit decode: shapeless.Lazy[io.circe.generic.decoding.DerivedDecoder[nrm_marketing_data.User]])io.circe.Decoder[nrm_marketing_data.User]. Unspecified value parameter decode.
  could not find implicit value for parameter decode: shapeless.Lazy[io.circe.generic.decoding.DerivedDecoder[nrm_marketing_data.User]]

The same symptoms are appering with several cats methods, like traverseU.
Also: I don't have completion on anyting after the error, in the scope, for example in:

    ...... = {
    deriveDecoder[User].prepare( _.downField("user").downField("firstName")
    }

I don't have completion on prepare, and hitting crtl+space after ".p" leads to 0 scala completion.
Also, the type given on tooltip on mouse over is "val somevar: "
So, in short, presentation compiler gave up at this point.

@scabug
Copy link
Author

scabug commented Mar 23, 2016

Imported From: https://issues.scala-lang.org/browse/SI-9716?orig=1
Reporter: Francois Armand (fanf)
Affected Versions: 2.11.7, 2.11.8
Attachments:

@scabug
Copy link
Author

scabug commented Mar 23, 2016

@dragos said:
This was initially reported on the IDE mailing list, but this is a presentation compiler bug, so I directed the user here. Hopefully we can get some help from the Scala team on this one.

@scabug
Copy link
Author

scabug commented Jul 3, 2016

@gaydenko said:
Yes, all ENSIME users are also affected by the issue.

@scabug
Copy link
Author

scabug commented Sep 2, 2016

Francois Armand (fanf) said (edited on Sep 2, 2016 9:26:00 AM UTC):
I'm upgrading that ticket because in fact, anything a little type involved make the presentation compiler go wild and display spurious error. Even with simple project with Slick, which is lightbend stack. And things are getting worse, not better.

I'm joining an example of what happen on all files with such errors. You can see that there is no error reported for the selected file, but still the presentation compiler insist to add one or two by on each line.

Restarting the presentation compiler helps, but just until I'm making any modification. That makes developping with an IDE which takes advantage of the Presentation compiler extremelly painfull.

So basically, now that more typesafe lib are common or even part of lightbend stack, there is some serious work to be done on the scala presentation compiler.

I'm using the last version of Scala IDE (4.4.1 righ now) with Scala 2.11.8.

@scabug
Copy link
Author

scabug commented Sep 2, 2016

@dragos said:
Since this has been silently moved to the Backlog it would be nice to get some explanation from the core team whether the presentation compiler is no longer supported.

@scabug
Copy link
Author

scabug commented Sep 24, 2016

@dragos said:
Ping @SethTisue

@scabug
Copy link
Author

scabug commented Sep 24, 2016

@SethTisue said:
hey, I just work here

@scabug
Copy link
Author

scabug commented Sep 26, 2016

Rahel Lüthy (netzwerg) said:
Another manifestation (in a scalajs-react project): https://github.com/ensime/ensime-server/issues/1605

@scabug
Copy link
Author

scabug commented Nov 25, 2016

@dragos said:
@SethTisue I was asking you precisely because you work there :)

@scabug
Copy link
Author

scabug commented Jan 8, 2017

@gaydenko said:
Hi! Is 2.11.9 going to be free from the bug?

@scabug
Copy link
Author

scabug commented Jan 9, 2017

@adriaanm said:
We have not had a chance to work on this one, sorry! Given the 2.11.9 timeline (due out in two weeks), it's unlikely it will be fixed there in time.

@scabug
Copy link
Author

scabug commented Apr 6, 2017

@retronym said:
A workaround appears to be adding -Ymacro-expand:normal to the Scala compiler options in Scala IDE. The presentation compiler defaults to -Ymacro-expand:discard, which discards the term expansions of macros, and just copies the computed type to the original macro application. Under -Ymacro-expand:normal, the IDE is unable to offer completion within macro arguments.

https://gist.github.com/retronym/38b183dca95953f84b66

1 similar comment
@scabug
Copy link
Author

scabug commented Apr 6, 2017

@retronym said:
A workaround appears to be adding -Ymacro-expand:normal to the Scala compiler options in Scala IDE. The presentation compiler defaults to -Ymacro-expand:discard, which discards the term expansions of macros, and just copies the computed type to the original macro application. Under -Ymacro-expand:normal, the IDE is unable to offer completion within macro arguments.

https://gist.github.com/retronym/38b183dca95953f84b66

@fanf
Copy link

fanf commented May 19, 2017

As already said in the tpolecat/doobie#508, I can confirm that adding -Ymacro-expand:normal helps a lot regarding spurious errors.

I also want to emphasis a behaviour of ScalaIDE that made me think at first that the option was not doing anything: in Scala IDE, when using right click on project -> scala -> set the scala installation, Scala IDE actually change the per project settings config to "enable", and so your global command line args for scalac are no more used, and you need to copy/past them in ALL your projects dedicated properties.

Hope it will help others.

retronym added a commit to retronym/t9716 that referenced this issue Jun 7, 2017
```
% sbt compile
// okay

% sbt 'set scalacOptions in ThisBuild := Seq("-Ymacro-expand:discard")' compile
[error] /Users/jz/code/t9716/client/src/main/scala/sample/Client.scala:10: could not find Lazy implicit value of type io.circe.generic.decoding.DerivedDecoder[sample.User]
[error]   implicit lazy val userEventDecoder: Decoder[User] = deriveDecoder[User]
[error]                                                                    ^
[error] one error found
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants