rssh/dotty-cps-async

Regression from 0.9.12 on Scala 3.2.1: extension methods with generic parameters cause compilation failure

ScoreUnder opened this issue · 3 comments

This (minimised) snippet of code works in 0.9.12, but raises a spurious compilation error in 0.9.13:

import cps.*
import cps.monads.FutureAsyncMonad
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global

def test(): Future[Unit] =
  async {
    ().thing()
  }

extension (value: Unit)
  def thing[X]() = ()

I have uploaded a tarball of this with a build.sbt etc for if you are unable to reproduce it through this snippet alone: https://score.moe/a/bug-1672174256-dotty-cps-async.tar.xz

Experienced in 'the real world' in https://github.com/ScoreUnder/canti-bot/blob/c1447d68d91b9aac4a49547add30ea87ac0ec5c5/src/main/scala/score/discord/canti/functionality/PrivateVoiceChats.scala#L453-L504, see async at line 460 and generic extension method recoverToEither (defined here) at line 491.

rssh commented

At the first glance, this is a duplicate of #63. (bug in dotty).
We have 0.9.13 published with a workaround.
[Not 100% sure yet, will recheck now]

rssh commented

oops, see it's about 0.9.13,
Investigating now.

rssh commented

Thanks, fixed.
Will publish 0.9.14 tomorrow.