Skip to content

Commit b9f14a4

Browse files
committed
Fix #9240: Add regression test
This was fixed in #9221
1 parent e67908d commit b9f14a4

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

tests/pos-macros/i9240/Macro_1.scala

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import scala.quoted._
2+
import scala.tasty._
3+
4+
inline def diveInto[T]: String = ${ diveIntoImpl[T]() }
5+
6+
def diveIntoImpl[T]()(implicit qctx: QuoteContext, ttype: scala.quoted.Type[T]): Expr[String] =
7+
import qctx.tasty._
8+
Expr( unwindType(qctx.tasty)(typeOf[T]) )
9+
10+
def unwindType(reflect: Reflection)(aType: reflect.Type): String =
11+
import reflect._
12+
13+
aType match {
14+
case AppliedType(t,tob) =>
15+
val cs = t.classSymbol.get.primaryConstructor // this is shared
16+
val a = cs.paramSymss // this call succeeds
17+
// println("a: "+a)
18+
val b = cs.paramSymss // this call explodes
19+
// println("b: "+b)
20+
21+
case _ =>
22+
}
23+
"OK!"
24+

tests/pos-macros/i9240/Test_2.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
def test =
2+
diveInto[String]
3+
diveInto[List[Int]]
4+
diveInto[scala.collection.immutable.HashSet[String]]

0 commit comments

Comments
 (0)