@@ -156,11 +156,11 @@ given ToExpr[Boolean] with {
156
156
given ToExpr [StringContext ] with {
157
157
def apply (stringContext : StringContext )(using Quotes ) =
158
158
val parts = Varargs (stringContext.parts.map(Expr (_)))
159
- ' { StringContext ($parts : _ * ) }
159
+ ' { StringContext ($parts* ) }
160
160
}
161
161
```
162
162
The ` Varargs ` constructor just creates an ` Expr[Seq[T]] ` which we can efficiently splice as a varargs.
163
- In general, any sequence can be spliced with ` $mySeq: _ * ` to splice it as a varargs.
163
+ In general, any sequence can be spliced with ` $mySeq* ` to splice it as a varargs.
164
164
165
165
## Quoted patterns
166
166
Quotes can also be used to check if an expression is equivalent to another or to deconstruct an expression into its parts.
@@ -352,7 +352,7 @@ Types represented with `Type[T]` can be matched on using the patten `case '[...]
352
352
inline def mirrorFields [T ]: List [String ] = $ {mirrorFieldsImpl[T ]}
353
353
354
354
def mirrorFieldsImpl [T : Type ](using Quotes ): Expr [List [String ]] =
355
-
355
+
356
356
def rec [A : Type ]: List [String ] = Type .of[A ] match
357
357
case ' [field *: fields] =>
358
358
Type .show[field] :: rec[fields]
@@ -408,8 +408,8 @@ given FromExpr[Boolean] with {
408
408
409
409
given FromExpr [StringContext ] with {
410
410
def unapply (x : Expr [StringContext ])(using Quotes ): Option [StringContext ] = x match {
411
- case ' { new StringContext ($ {Varargs (Exprs (args))}: _ * ) } => Some (StringContext (args : _ * ))
412
- case ' { StringContext ($ {Varargs (Exprs (args))}: _ * ) } => Some (StringContext (args : _ * ))
411
+ case ' { new StringContext ($ {Varargs (Exprs (args))}* ) } => Some (StringContext (args* ))
412
+ case ' { StringContext ($ {Varargs (Exprs (args))}* ) } => Some (StringContext (args* ))
413
413
case _ => None
414
414
}
415
415
}
0 commit comments