@@ -42,7 +42,7 @@ trait MacroAnnotation extends StaticAnnotation:
4242 * This example shows how to modify a `def` and add a `val` next to it using a macro annotation.
4343 * ```scala
4444 * import scala.quoted.*
45- * import scala.collection.mutable
45+ * import scala.collection.concurrent
4646 *
4747 * class memoize extends MacroAnnotation:
4848 * def transform(using Quotes)(tree: quotes.reflect.Definition): List[quotes.reflect.Definition] =
@@ -52,14 +52,14 @@ trait MacroAnnotation extends StaticAnnotation:
5252 * (param.tpt.tpe.asType, tpt.tpe.asType) match
5353 * case ('[t], '[u]) =>
5454 * val cacheName = Symbol.freshName(name + "Cache")
55- * val cacheSymbol = Symbol.newVal(Symbol.spliceOwner, cacheName, TypeRepr.of[mutable .Map[t, u]], Flags.Private, Symbol.noSymbol)
55+ * val cacheSymbol = Symbol.newVal(Symbol.spliceOwner, cacheName, TypeRepr.of[concurrent .Map[t, u]], Flags.Private, Symbol.noSymbol)
5656 * val cacheRhs =
5757 * given Quotes = cacheSymbol.asQuotes
58- * '{ mutable.Map .empty[t, u] }.asTerm
58+ * '{ concurrent.TrieMap .empty[t, u] }.asTerm
5959 * val cacheVal = ValDef(cacheSymbol, Some(cacheRhs))
6060 * val newRhs =
6161 * given Quotes = tree.symbol.asQuotes
62- * val cacheRefExpr = Ref(cacheSymbol).asExprOf[mutable .Map[t, u]]
62+ * val cacheRefExpr = Ref(cacheSymbol).asExprOf[concurrent .Map[t, u]]
6363 * val paramRefExpr = Ref(param.symbol).asExprOf[t]
6464 * val rhsExpr = rhsTree.asExprOf[u]
6565 * '{ $cacheRefExpr.getOrElseUpdate($paramRefExpr, $rhsExpr) }.asTerm
@@ -82,7 +82,7 @@ trait MacroAnnotation extends StaticAnnotation:
8282 * and the macro will modify the definition to create
8383 * ```scala
8484 * val fibCache$macro$1 =
85- * scala.collection.mutable.Map .empty[Int, Int]
85+ * scala.collection.concurrent.TrieMap .empty[Int, Int]
8686 * def fib(n: Int): Int =
8787 * fibCache$macro$1.getOrElseUpdate(
8888 * n,
0 commit comments