Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
soronpo opened this issue Jun 26, 2021 · 2 comments · Fixed by #12979
Closed

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

soronpo opened this issue Jun 26, 2021 · 2 comments · Fixed by #12979
Assignees
Milestone

Comments

@soronpo
Copy link
Contributor

soronpo commented Jun 26, 2021

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.

odersky added a commit to dotty-staging/dotty that referenced this issue Jun 29, 2021
@dwijnand dwijnand added the needs-minor-release This PR cannot be merged until the next minor release label Jul 1, 2021
@dwijnand dwijnand added this to the 3.1.0 milestone Jul 1, 2021
bishabosha added a commit to dotty-staging/dotty that referenced this issue Jul 2, 2021
bishabosha added a commit to dotty-staging/dotty that referenced this issue Jul 2, 2021
Co-authored-by: Martin Odersky <odersky@gmail.com>
Co-authored-by: Jamie Thompson <bishbashboshjt@gmail.com>
odersky added a commit to dotty-staging/dotty that referenced this issue Jul 23, 2021
dwijnand pushed a commit to dotty-staging/dotty that referenced this issue Aug 19, 2021
odersky added a commit to dotty-staging/dotty that referenced this issue Aug 23, 2021
@dwijnand dwijnand removed the needs-minor-release This PR cannot be merged until the next minor release label Aug 23, 2021
@soronpo
Copy link
Contributor Author

soronpo commented Aug 27, 2021

@odersky FYI, although this minimized solution is resolved, I'm still experiencing differences between transparent inline given and given with in my library on a local snapshot of the compiler. I'll try to minimize again and open a new issue.

@soronpo
Copy link
Contributor Author

soronpo commented Aug 27, 2021

From some experimentation I see it's probably related to match types and and since I have two open issues with match types, I'll first wait for them to be resolved before I continue pursuing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants