@@ -9,7 +9,7 @@ implement a type class `derived` method using macros only. We follow the same
99example of deriving ` Eq ` instances and for simplicity we support a ` Product `
1010type e.g., a case class ` Person ` . The low-level method we will use to implement
1111the ` derived ` method exploits quotes, splices of both expressions and types and
12- the ` scala.quoted.matching.summonExpr ` method which is the equivalent of
12+ the ` scala.quoted.Expr.summon ` method which is the equivalent of
1313` summonFrom ` . The former is suitable for use in a quote context, used within
1414macros.
1515
@@ -44,7 +44,7 @@ from the signature. The body of the `derived` method is shown below:
4444given derived [T : Type ](using qctx : QuoteContext ) as Expr [Eq [T ]] = {
4545 import qctx .tasty ._
4646
47- val ev : Expr [Mirror .Of [T ]] = summonExpr (using ' [Mirror .Of [T ]]).get
47+ val ev : Expr [Mirror .Of [T ]] = Expr .summon (using ' [Mirror .Of [T ]]).get
4848
4949 ev match {
5050 case ' { $m : Mirror .ProductOf [T ] { type MirroredElemTypes = $elementTypes }} =>
@@ -70,7 +70,7 @@ given derived[T: Type](using qctx: QuoteContext) as Expr[Eq[T]] = {
7070
7171Note, that in the ` inline ` case we can merely write
7272` summonAll[m.MirroredElemTypes] ` inside the inline method but here, since
73- ` summonExpr ` is required, we can extract the element types in a macro fashion.
73+ ` Expr.summon ` is required, we can extract the element types in a macro fashion.
7474Being inside a macro, our first reaction would be to write the code below. Since
7575the path inside the type argument is not stable this cannot be used:
7676
@@ -178,7 +178,7 @@ object Eq {
178178 given derived [T : Type ](using qctx : QuoteContext ) as Expr [Eq [T ]] = {
179179 import qctx .tasty ._
180180
181- val ev : Expr [Mirror .Of [T ]] = summonExpr (using ' [Mirror .Of [T ]]).get
181+ val ev : Expr [Mirror .Of [T ]] = Expr .summon (using ' [Mirror .Of [T ]]).get
182182
183183 ev match {
184184 case ' { $m : Mirror .ProductOf [T ] { type MirroredElemTypes = $elementTypes }} =>
0 commit comments