EindbaasExpress / handsonscala-issuemigrator

Part of the HandsOnScala Course
0 stars 0 forks source link

Using Scala 3 seriously breaks default value handing #119

Open EindbaasExpress opened 2 years ago

EindbaasExpress commented 2 years ago

Minimal example:

case class A(a: Int = 1)

import upickle.default._
implicit val rw: ReadWriter[A] = macroRW[A]

println(read[A]("{\"a\":2}"))
println(read[A]("{}"))

Expected (upickle 1.4.0, Scala 2.13.6):

A(2)
A(1)

Got (upickle 1.4.0, Scala 3.0.1):

A(2)
A(2)

God knows how many projects are silently corrupting their databases. Or leaking data from another user in their API calls. Since the parser is keeping and leaking state, everything is possible. ID: 362 Original Author: strelec