Skip to content

given inside for comprehension propagation issue #14836

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
SimY4 opened this issue Apr 4, 2022 · 2 comments
Closed

given inside for comprehension propagation issue #14836

SimY4 opened this issue Apr 4, 2022 · 2 comments
Labels
itype:bug stat:duplicate stat:needs triage Every issue needs to have an "area" and "itype" label

Comments

@SimY4
Copy link

SimY4 commented Apr 4, 2022

Compiler version

Scala 3.1.1-2

Minimized code

trait C
object C:
  def provide: Option[C] = Some(new C {})

def consume(arg: Int)(using C): Unit = ()

val result1 = for {
  given C <- C.provide
  a = consume(42) // Error: no implicit of type C
} yield a


val result2 = for {
  c <- C.provide
  a = {
    given C = c
    consume(42) // this works fine
  }
} yield a

Expectation

given argument would be implicitly passed down to a method that expects it

@SimY4 SimY4 added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 4, 2022
@som-snytt
Copy link
Contributor

Duplicates #12646

@bishabosha
Copy link
Member

added the example to the original issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
itype:bug stat:duplicate stat:needs triage Every issue needs to have an "area" and "itype" label
Projects
None yet
Development

No branches or pull requests

3 participants