Skip to content

withFilter required for irrefutable for comprehension pattern #15579

Closed
@Swoorup

Description

@Swoorup

Tuple decomposition seems to have regressed in some cases. The following works fine under 3.1.3

Compiler version

3.2.0-RC1

Minimized code

//> using scala "3.2.0-RC1"
//> using option "-source:future"
//> using option "-Ykind-projector"
//> using lib "org.typelevel::cats-effect::3.3.13"

import cats.Monad
import cats.effect.Temporal
import cats.syntax.all.*

trait ProjectionStore[F[_], State, Output]:
  def loadRecent: F[(Int, Option[State])]

def test[F[_]: Temporal](store: ProjectionStore[F, Int, Int]) = 
  for (x, y) <- store.loadRecent
  yield println(s"x: $x, y: $y")

Output

[error] ./t.scala:14:17: value withFilter is not a member of F[(Int, Option[Int])]
[error]
[error] where:    F is a type in method test with bounds <: [_] =>> Any
[error]   for (x, y) <- store.loadRecent
[error]                 ^^^^^^^^^^^^^^^^
Error compiling project (Scala 3.2.0-RC1, JVM)
Compilation failed

Expectation

Compilation passes

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions