Skip to content

Commit 3a34de9

Browse files
authored
More efficient reading of non-specialized maps with Scala 3
1 parent b78fa5d commit 3a34de9

File tree

1 file changed

+2
-2
lines changed
  • jsoniter-scala-macros/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/macros

1 file changed

+2
-2
lines changed

jsoniter-scala-macros/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/macros/JsonCodecMaker.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2357,12 +2357,12 @@ object JsonCodecMaker {
23572357
def readVal1(using Quotes) =
23582358
genReadVal(tpe1 :: types, genNullValue[t1](tpe1 :: types), isStringified, false, in)
23592359

2360-
genReadMapAsArray(newBuilder, x => '{ $x.addOne(($readVal1, { if ($in.isNextToken(',')) $readVal2 else $in.commaError() })): Unit},
2360+
genReadMapAsArray(newBuilder, x => '{ $x.addOne(new Tuple2($readVal1, { if ($in.isNextToken(',')) $readVal2 else $in.commaError() })): Unit},
23612361
x => '{ $x.result() }, in, default).asExprOf[T]
23622362
} else {
23632363
def readKey(using Quotes) = genReadKey[t1](tpe1 :: types, in)
23642364

2365-
genReadMap(newBuilder, x => '{ $x.addOne(($readKey, $readVal2)): Unit },
2365+
genReadMap(newBuilder, x => '{ $x.addOne(new Tuple2($readKey, $readVal2)): Unit },
23662366
x => '{ $x.result() }, in, default).asExprOf[T]
23672367
}
23682368
} else if (tpe <:< TypeRepr.of[BitSet]) withDecoderFor(methodKey, default, in) { (in, default) =>

0 commit comments

Comments
 (0)