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

Eval compile error in 2.12.0-RC1: Improvement or regression? #1377

Closed
ghost opened this issue Sep 16, 2016 · 10 comments
Closed

Eval compile error in 2.12.0-RC1: Improvement or regression? #1377

ghost opened this issue Sep 16, 2016 · 10 comments

Comments

@ghost
Copy link

ghost commented Sep 16, 2016

Compiling Eval.scala in 2.12-0-RC1 I get a compile error that is trivial to fix, but nevertheless represents a change as the code is fine in 2.10/2.1. So the question here is whether it is an improvement or a regression that we can highlight.

compile:

[error] core/src/main/scala/cats/Eval.scala:77: overriding value start in class Compute of type () => cats.Eval[this.Start];
[error]  value start has incompatible type
[error]           val start  = c.start
[error]               ^
[error] core/src/main/scala/cats/Eval.scala:78: overriding value run in class Compute of type this.Start => cats.Eval[B];
[error]  value run has incompatible type
[error]           val run = (s: c.Start) =>

Trivial fix:

@@ -74,8 +74,8 @@ sealed abstract class Eval[+A] extends Serializable { self =>
       case c: Eval.Compute[A] =>
         new Eval.Compute[B] {
           type Start = c.Start
-          val start = c.start
-          val run = (s: c.Start) =>
+          val start: () => Eval[Start] = c.start
+          val run: Start => Eval[B] = (s: c.Start) =>
             new Eval.Compute[B] {
               type Start = A
               val start = () => c.run(s)
@non
Copy link
Contributor

non commented Sep 19, 2016

At the least it seems like a change in inference -- either a a known-change in 2.12 or some kind of bug regression.

For our part I don't mind adding the type annotations (it probably makes the code easier to read) but it probably also makes sense reporting upstream to the Scala team. Do you want to do it? If not I'm happy to open one later on.

@ghost
Copy link
Author

ghost commented Sep 19, 2016

@non I very casually mentioned this on gitter scala/contributors. I'm happy to raise an issue on their JIRA later today. I'll post with link when done, so we can track

@ghost
Copy link
Author

ghost commented Sep 19, 2016

@non
Copy link
Contributor

non commented Sep 19, 2016

Thanks!

@SethTisue
Copy link
Member

is there a branch that's set up to use 2.12.0-RC1? I'd like to look at this for you, but I don't want to duplicate work you've already done, either

@ghost
Copy link
Author

ghost commented Sep 21, 2016

@SethTisue #1382 uses 2.12.0-RC1. If you compile this locally, please see the note in the PR re local scoverage

@SethTisue
Copy link
Member

SethTisue commented Sep 22, 2016

The discussion is on JIRA now, but I just wanted to say thanks for the report. It's enormously helpful to get reports like these.

@ghost
Copy link
Author

ghost commented Sep 22, 2016

@SethTisue and FTR for those that do not look into JIRA - Awesome work!!! Really, I mean it

@travisbrown
Copy link
Contributor

This is changed and the issue noted in a comment in #1415, so I think we can close this issue once that's merged.

@SethTisue
Copy link
Member

#1415 is merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants