Skip to content

Implicit search failure for context functions #14214

Closed
@odersky

Description

@odersky

Compiler version

3.1.1-RC2

Minimized example

class Dummy
given Dummy = ???
trait Foo
given foo: Foo = ???

object Test:
  summon[Dummy ?=> Foo] // fails
  summon[Dummy ?=> Foo](using foo)  // works
  summon[Dummy ?=> Foo](using (_: Dummy) ?=> foo)  // works

Output

-- Error: ../new/test.scala:7:23 -----------------------------------------------
7 |  summon[Dummy ?=> Foo] // fails
  |                       ^
  |no implicit argument of type (Dummy) ?=> Foo was found for parameter x of method summon in object Predef.
  |I found:
  |
  |    foo
  |
  |But given instance foo does not match type (Dummy) ?=> Foo.

Expectation

Should compile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions