Skip to content

given in for comprehension requires withFilter #12310

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

Closed
scf37 opened this issue May 2, 2021 · 1 comment
Closed

given in for comprehension requires withFilter #12310

scf37 opened this issue May 2, 2021 · 1 comment

Comments

@scf37
Copy link

scf37 commented May 2, 2021

Compiler version

3.0.0-RC3

Minimized code

case class Monad[A](v: A):
  def map[B](f: A => B): Monad[B] = flatMap(a => Monad(f(a)))
  def flatMap[B](f: A => Monad[B]): Monad[B] = ???

object Test {
  for
    x <- Monad(42)  // OK
  yield x
  
  for
    given x <- Monad(42) // value withFilter is not a member of Monad[A]
  yield x
}

Output

value withFilter is not a member of Monad[A]

where:    A is a type variable with constraint >: (42 : Int)

Expectation

Successful compilation

@scf37 scf37 added the itype:bug label May 2, 2021
@smarter
Copy link
Member

smarter commented May 2, 2021

Already fixed in master: #12184

@smarter smarter closed this as completed May 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants