Skip to content

Export is missing more refined "given with" instances #12949

Closed
@soronpo

Description

@soronpo

When a given with expression returns a more refined instance, export is missing it from the implicit scope.
Regular givens or transparent inline givens are OK.

Compiler version

v3.0.1-RC2 (also tested on nightly)

Minimized code

object Catch22:
  trait TC[V]
  object TC:
    export Hodor.TC.given

object Hodor:
  object TC:
    import Catch22.TC
    given fromString[V <: String]: TC[V] = ???
    transparent inline given fromDouble[V <: Double]: TC[V] =
      new TC[V]:
        type Out = Double
    given fromInt[V <: Int]: TC[V] with
      type Out = Int

object Test:
  summon[Catch22.TC["hi"]] //works
  summon[Catch22.TC[7.7]] //works
  summon[Catch22.TC[1]] //error

Output

no implicit argument of type Catch22.TC[(1 : Int)] was found for parameter x of method summon in object Predef.
I found:

    Catch22.TC.fromDouble[V]

But given instance fromDouble in object TC does not match type Catch22.TC[(1 : Int)].

Expectation

No error.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions