Skip to content

No equivalency between context bounds and using #8896

Closed
@yilinwei

Description

@yilinwei

Minimized code

trait Foo[A]

object Example {

  given as Foo[Int] {
  }

  def foo[A : Foo]: A => A = identity 

  def foo2[A](using Foo[A]): A => A = identity // this definition works!

  def test(): Unit = {
    foo(32) // fails to compile because it thinks `32` is an implicit parameter
  }

}

Output

[error] 107 |    foo(32)
[error]     |        ^^
[error]     |        Found:    (32 : Int)
[error]     |        Required: profunctor.optics.core.Foo[A]
[error]     |
[error]     |        where:    A is a type variable

Expectation

Both of these expressions should be equivalent ideally.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions