Skip to content

conditional given with recursive type can't find extension method #8311

Closed
@bishabosha

Description

@bishabosha

Minimized code

package example

trait Show[O]:
  def (o: O).show: String

class Box[A]
class Foo

given Show[Foo] = _.toString
given [A](using Show[A]): Show[Box[A]] = _.toString

def run(s: Box[Box[Foo]]): Unit =
  summon[Show[Box[Box[Foo]]]].show(s) // it can find the given here
  println(s"step: ${s.show}") // tries to call show on Show[Box[Foo]]

Compilation output

-- [E008] Member Not Found Error: givens.scala:14:22 
 14 |  println(s"step: ${s.show}")
    |                    ^^^^^^
    |    value show is not a member of example.Box[example.Box[example.Foo]].
    |    An extension method was tried, but could not be fully constructed:
    |
    |        example.givens$package.given_Show_Box[example.Foo](
    |          example.givens$package.given_Show_Foo
    |        ).show(s)

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