From b53f6dd12ec1388c16902c1e40678530a8350d33 Mon Sep 17 00:00:00 2001 From: Hamza Remmal Date: Thu, 4 Dec 2025 16:29:35 +0100 Subject: [PATCH] chore: add regression test for #8581 --- tests/pos/i8581/Macro_1.scala | 11 +++++++++++ tests/pos/i8581/Test_2.scala | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/pos/i8581/Macro_1.scala create mode 100644 tests/pos/i8581/Test_2.scala diff --git a/tests/pos/i8581/Macro_1.scala b/tests/pos/i8581/Macro_1.scala new file mode 100644 index 000000000000..62bb18d97f7d --- /dev/null +++ b/tests/pos/i8581/Macro_1.scala @@ -0,0 +1,11 @@ +import scala.quoted.* + +case class Position() +object Position { + implicit inline def here: Position = ${ genPosition } + + private def genPosition(using Quotes): Expr[Position] = { + val lineNo: Int = quotes.reflect.Position.ofMacroExpansion.startLine + '{ Position() } + } +} diff --git a/tests/pos/i8581/Test_2.scala b/tests/pos/i8581/Test_2.scala new file mode 100644 index 000000000000..1d699b7db1dd --- /dev/null +++ b/tests/pos/i8581/Test_2.scala @@ -0,0 +1,16 @@ +import scala.concurrent.duration.FiniteDuration +import scala.language.implicitConversions +import scala.reflect.ClassTag + +class AnyShouldWrapper[T] + +class Test { + implicit def convertToAnyShouldWrapper[T](o: T)(implicit pos: Position): AnyShouldWrapper[T] = ??? + + def expectMsgType[T](implicit t: ClassTag[T]): T = ??? + def expectMsgType[T](max: FiniteDuration)(implicit t: ClassTag[T]): T = ??? + + def test(): Unit = { + expectMsgType[Int]: AnyShouldWrapper[Int] + } +}