Skip to content

Add regression test for issue 22585 #23484

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
Jul 7, 2025
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
22 changes: 22 additions & 0 deletions tests/pos-macros/i22585/Macro.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import scala.quoted.*

trait Hammer[I, O] {
def hammer(input: I): O
}

object Hammer {
inline def makeProductHammerMacro[I, O](): Hammer[I, O] =
${ makeProductHammerMacroImpl[I, O] }

def makeProductHammerMacroImpl[I: Type, O: Type](using Quotes): Expr[Hammer[I, O]] =
'{ makeHammer[I, O]() }

inline def makeHammer[S, O](): Hammer[S, O] =
new Hammer[S, O] {
lazy val (hammer: Hammer[?, Int], idx: Int) = ???

override def hammer(input: S): O = {
hammer.hammer(???.asInstanceOf).asInstanceOf[O]
}
}
}
5 changes: 5 additions & 0 deletions tests/pos-macros/i22585/Main.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
object HammerSpec {
case class A(x: Int)
case class B(x: Int)
Hammer.makeProductHammerMacro[A, B]()
}
Loading