We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f7ff617 commit d7849a5Copy full SHA for d7849a5
tests/run/i8577i.scala
@@ -0,0 +1,16 @@
1
+import scala.quoted._
2
+
3
+object Macro:
4
+ opaque type StrCtx = StringContext
5
+ def apply(ctx: StringContext): StrCtx = ctx
6
+ def unapply(ctx: StrCtx): Option[StringContext] = Some(ctx)
7
8
+extension (ctx: StringContext) def mac: Macro.StrCtx = Macro(ctx)
9
+extension (inline ctx: Macro.StrCtx) transparent inline def unapplySeq(inline input: String): Option[Seq[Any]] =
10
+ Some(Seq(123))
11
12
+@main def Test: Unit =
13
+ "abc" match
14
+ case mac"$x" =>
15
+ val y: Int = x
16
+ assert(x == 123)
0 commit comments