question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

0.9.8→0.9.9 regression? but SSC(C)E triggers on earlier versions too

See original GitHub issue

I have a new build failure on my project which traces to an Update dotty-cps-async to 0.9.9 commit. I have tried to minimise the failing code to the shortest possible example, but after minimisation it seems to trigger the same problem in older versions too.

I will give the minimised example here:

import cps.*
import cps.monads.FutureAsyncMonad

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future

class TestCase:
  val objs = Seq(
    new AnyRef:
      def curry(v: Any)(w: Any): Unit = ()

      def bad_func(): Future[Unit] =
        async {
          for message <- Nil.toSeq do
            curry(Nil.toSeq)
          ()
        }
  )

This code has quickly turned into nonsense, but nonetheless it triggers the following failure:

java.lang.Exception: unexpected tree: closure($anonfun)
dotty.tools.dotc.transform.init.Semantic$.cases(Semantic.scala:1271)
dotty.tools.dotc.transform.init.Semantic$.eval$$anonfun$1(Semantic.scala:1071)
dotty.tools.dotc.transform.init.Semantic$Cache$Cache.assume(Semantic.scala:314)
dotty.tools.dotc.transform.init.Semantic$.eval(Semantic.scala:1071)
dotty.tools.dotc.transform.init.Semantic$.cases(Semantic.scala:1195)
dotty.tools.dotc.transform.init.Semantic$.eval$$anonfun$1(Semantic.scala:1071)
dotty.tools.dotc.transform.init.Semantic$Cache$Cache.assume(Semantic.scala:314)
dotty.tools.dotc.transform.init.Semantic$.eval(Semantic.scala:1071)
dotty.tools.dotc.transform.init.Semantic$.$anonfun$22(Semantic.scala:903)
dotty.tools.dotc.transform.init.Semantic$.promote(Semantic.scala:903)
dotty.tools.dotc.transform.init.Semantic$ArgInfo.promote(Semantic.scala:1051)
[...]

Some interesting things break this example and cause the code to compile properly again:

  • Turning the val into a def
  • Wrapping the val in a function
  • Not wrapping the object in a Seq
  • Using a sequence which isn’t generated through a function call on another object (i.e. Nil.toSeq causes an error, but Nil itself doesn’t cause the error. One could replace it with something like Some(Seq(1, 2, 3)).get and still encounter an error)
  • Moving the anonymous class to an outer class (but inner classes/objects still fail)

This appears to be a confluence of many factors, to a somewhat surprising degree of complexity.

The original project at the broken commit is here: https://github.com/ScoreUnder/canti-bot/tree/cb179d537c0494ddddb4dfd24904f75aae30611c

The offending function on which the example is based is here: https://github.com/ScoreUnder/canti-bot/blob/cb179d537c0494ddddb4dfd24904f75aae30611c/src/main/scala/score/discord/canti/functionality/Spoilers.scala#L74-L90

If you edit the build.sbt in that project to lower the version of dotty-cps-async from 0.9.9 to 0.9.8, it will compile properly again.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
rsshcommented, Jul 9, 2022

preparing a next release, will write here, when it will be available.

0reactions
ScoreUndercommented, Jul 11, 2022

All good from my end, thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Graphite Documentation - Read the Docs
Graphite is an enterprise-scale monitoring tool that runs well on cheap hardware. It was originally designed and written.
Read more >
Picking input prop(s) - Plotly/Dash-Labs - IssueHint
0.9.8→0.9.9 regression ? but SSC(C)E triggers on earlier versions too, 8, 2022-07-07, 2022-09-16. [Samsung Galaxy XCover5] Error during OTA, 11, 2022-04-23 ...
Read more >
Graphite Documentation
Graphite is an enterprise-scale monitoring tool that runs well on cheap hardware. It was originally designed and written by Chris Davis at Orbitz...
Read more >
Popular labels from issues and pull requests on open source ...
Popular labels from issues and pull requests on open source GitHub repositories - Pulled from https://libraries.io - labels.md.
Read more >
Changelog.all - Rise Mirror
If users have the possibility to create very long mount points, such as with FUSE, ... skipped new namespacing tests that fail with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found