Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions tests/pos-macros/i16420/Macro.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import scala.quoted.{Expr, Quotes, Type}

object Converter {
private def handleUnit[R](f: Expr[Int ?=> R])(using q: Quotes, rt: Type[R]): Expr[Unit] = '{}

class UnitConverter[R] extends Converter[EmptyTuple, R, Int ?=> R] {
inline def convert(inline f: Int ?=> R): Unit = ${ handleUnit[R]('f) }
}

inline given unitHandler[R]: UnitConverter[R] = new UnitConverter[R]
}


trait Converter[T <: Tuple, R, F] {
inline def convert(inline fn: F): Unit
}

abstract class Directive[R <: Tuple] {
inline def apply[O, F](using inline c: Converter[R, O, F])(inline fn: F): Unit =
c.convert(fn)
}
8 changes: 8 additions & 0 deletions tests/pos-macros/i16420/Test.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
object Meow extends App {
case class Meow(s: String, i: Int)

val dir: Directive[EmptyTuple] = ???
dir {
Meow("asd", 123)
}
}