Skip to content

Possible Regression in 2.12.0-RC1 inferencing type annotation #9931

Closed
scala/scala
#10170
@scabug

Description

@scabug

This is documented in typelevel/cats#1377 and we are not sure if this a known change/improvement or bug.

Compiling file Eval.scala
Compile errror:

[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)

Apologies if this is a false alarm, we do not mind just applying the fix but as Erik says in the issue, it makes sense to let you guys know just in case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions