Skip to content

implicit search fails with intra-parameter-list dependency #5427

@smarter

Description

@smarter

Adapted from https://contributors.scala-lang.org/t/better-type-inference-for-scala-send-us-your-problematic-cases/2410/53?u=smarter:

trait Foo[In] { type Out }

object Test {
  implicit def fooInt: Foo[Int] { type Out = String } = ???
  implicit def str: String = ???

  def test1[A](f1: Foo[A])(implicit f2: f1.Out) = ???
  def test2[A](implicit f1: Foo[A], f2: f1.Out) = ???

  test1(fooInt) // OK
  test2 // error: no implicit argument of type f1.Out was found for parameter f2 of method test2
}

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