Skip to content

Given within for-comprehension not found #12646

@qwbarch

Description

@qwbarch

Compiler version

3.0.0

Minimized code

Declaring a result as given works as expected if I'm flat-mapping to another monadic value. For example:

for
   given Int <- List(0)
   x <- List(summon[Int])
yield x

Scastie: https://scastie.scala-lang.org/9nPXzZH0QEaVzz3zI4ER8g

However, if the next step in the for-comprehension is a variable, the given is not found. For example:

for
   given Int <- List(0)
   x = summon[Int]
yield x

Scastie: https://scastie.scala-lang.org/1cuJc8bcS4q59Y5ZoSQ4bw

Output

no implicit argument of type Int was found for parameter x of method summon in object Predef

Expectation

It should compile just like the first example.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions