Skip to content

Commit 5aec4f8

Browse files
Merge pull request #8948 from dotty-staging/move-quoted-to-src-bootstrapped
Only compile quoted code in bootstrapped library
2 parents dd98d4a + f784e6b commit 5aec4f8

File tree

29 files changed

+78
-7
lines changed

29 files changed

+78
-7
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package dotty.internal
2+
3+
import scala.quoted._
4+
5+
object CompileTimeMacros:
6+
def codeExpr(using qctx: QuoteContext)(sc: Expr[StringContext], args: Expr[Seq[Any]]): Expr[String] =
7+
(sc, args) match
8+
case (Expr.StringContext(Consts(parts)), Varargs(args2)) =>
9+
Expr(StringContext(parts: _*).s(args2.map(_.show): _*))
10+
case _ =>
11+
qctx.throwError("compiletime.code must be used as a string interpolator `code\"...\"`")

0 commit comments

Comments
 (0)