Skip to content

Add regression test #16426

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

Merged
merged 1 commit into from
Nov 28, 2022
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)
}
}