scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

transparent inline implicit conversion fails within inline def

Open soronpo opened this issue 3 years ago • 0 comments

If we remove inline from def baz there is no error.

Compiler version

v3.2.0-RC2

Minimized code

https://scastie.scala-lang.org/S2Dv4bCfThyJGo6F2JQqqg

import language.implicitConversions
trait Exactly:
  type Out
  val value: Out
object Exactly:
  implicit transparent inline def conv[T](value: T): Exactly = Exact[T](value)

type Exact[T] = Exactly { type Out = T }
object Exact:
  def apply[T](value_ : T): Exact[T] = new Exactly:
    type Out = T
    val value = value_

def foo[T](arg: Exact[T]): Unit = {}
inline def baz(arg: Int): Unit = foo(arg)

Output

Found:    (arg : Int)
Required: Playground.Exact[T]

where:    T is a type variable

Expectation

No error.

soronpo avatar Jul 21 '22 18:07 soronpo