Skip to content

inline and opaque types, illegal given resolution #22370

Open
@road21

Description

@road21

Compiler version

3.3.4, 3.6.2

Minimized code

import scala.compiletime.*

object module:
  opaque type X[x] = x
  object X:
    given X[Int] = 5
    inline def get[x] = summonInline[X[x]]
  end X  
  //summon[X[Int]] // doesn't compile and this is probably ok
end module

import module.X
summon[X[Int]]
X.get[Int] // doesn't compile and this is a bug

https://scastie.scala-lang.org/road21/RKS79oblTUG87DzuRlPkAg/23

Output

Compiler error:
No given instance of type module$_this.X[Int] was found

Expectation

No compiler error

I expect that inlining happens in-place and given should be found. If I move the get method to separate object It compiles (shown in scastie link).

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