@@ -42,7 +42,7 @@ trait MacroAnnotation extends StaticAnnotation:
42
42
* This example shows how to modify a `def` and add a `val` next to it using a macro annotation.
43
43
* ```scala
44
44
* import scala.quoted.*
45
- * import scala.collection.mutable
45
+ * import scala.collection.concurrent
46
46
*
47
47
* class memoize extends MacroAnnotation:
48
48
* def transform(using Quotes)(tree: quotes.reflect.Definition): List[quotes.reflect.Definition] =
@@ -52,14 +52,14 @@ trait MacroAnnotation extends StaticAnnotation:
52
52
* (param.tpt.tpe.asType, tpt.tpe.asType) match
53
53
* case ('[t], '[u]) =>
54
54
* 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)
56
56
* val cacheRhs =
57
57
* given Quotes = cacheSymbol.asQuotes
58
- * '{ mutable.Map .empty[t, u] }.asTerm
58
+ * '{ concurrent.TrieMap .empty[t, u] }.asTerm
59
59
* val cacheVal = ValDef(cacheSymbol, Some(cacheRhs))
60
60
* val newRhs =
61
61
* 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]]
63
63
* val paramRefExpr = Ref(param.symbol).asExprOf[t]
64
64
* val rhsExpr = rhsTree.asExprOf[u]
65
65
* '{ $cacheRefExpr.getOrElseUpdate($paramRefExpr, $rhsExpr) }.asTerm
@@ -82,7 +82,7 @@ trait MacroAnnotation extends StaticAnnotation:
82
82
* and the macro will modify the definition to create
83
83
* ```scala
84
84
* val fibCache$macro$1 =
85
- * scala.collection.mutable.Map .empty[Int, Int]
85
+ * scala.collection.concurrent.TrieMap .empty[Int, Int]
86
86
* def fib(n: Int): Int =
87
87
* fibCache$macro$1.getOrElseUpdate(
88
88
* n,
0 commit comments