@@ -283,6 +283,15 @@ object CodecMakerConfig extends CodecMakerConfig(
283
283
report.warning(message, expr)
284
284
None
285
285
}
286
+ case ' { ($ {x}: CodecMakerConfig ).withAllowRecursiveTypes($v) } =>
287
+ val vv = v.valueOrAbort
288
+ val vx = x.valueOrAbort
289
+ Some (vx.withAllowRecursiveTypes(vv))
290
+ case ' { CodecMakerConfig } =>
291
+ Some (CodecMakerConfig )
292
+ case other =>
293
+ report.error(s " Can't interpret ${other.show} as constant expression, tree= $other" )
294
+ None
286
295
}
287
296
288
297
}
@@ -983,7 +992,7 @@ object JsonCodecMaker {
983
992
}
984
993
985
994
986
- def genReadSet [B : Type ,C : Type ](newBuilder : Expr [B ], readVal : Expr [B ] => UpdateOp , default : Expr [C ], result : Expr [B ] => Expr [C ], in : Expr [JsonReader ]): Expr [C ] =
995
+ def genReadSet [B : Type ,C : Type ](newBuilder : Expr [B ], readVal : Quotes ?=> Expr [B ] => UpdateOp , default : Expr [C ], result : Expr [B ] => Expr [C ], in : Expr [JsonReader ]): Expr [C ] =
987
996
' { if ($in.isNextToken('[' )) {
988
997
if ($in.isNextToken(']' )) $default
989
998
else {
@@ -1823,7 +1832,7 @@ object JsonCodecMaker {
1823
1832
case _ => cannotFindValueCodecError(tpe)
1824
1833
}
1825
1834
1826
- def genReadValForGrowable [G <: Growable [V ]: Type ,V : Type ](types : List [TypeRepr ], isStringified : Boolean , x : Expr [G ], in : Expr [JsonReader ]): Expr [Unit ] =
1835
+ def genReadValForGrowable [G <: Growable [V ]: Type ,V : Type ](types : List [TypeRepr ], isStringified : Boolean , x : Expr [G ], in : Expr [JsonReader ])( using Quotes ) : Expr [Unit ] =
1827
1836
' { $x.addOne($ {genReadVal[V ](types, genNullValue[V ](types), isStringified, None , in)}) }
1828
1837
1829
1838
def genArraysCopyOf [T : Type ](tpe : TypeRepr , x: Expr [Array [T ]], newLen: Expr [Int ]): Expr [Array [T ]] = {
0 commit comments