Open amnaredo opened 3 years ago
Trying to read wrong JSON as a tagged union type, e.g.:
sealed trait T object T { case class A(a: String) extends T case class B(b: Int) extends T } ... val x = read[T]("""{ "test" : "hello" }""")
results in a scala.MatchError (compiled with Scala.js):
caught scala.MatchError: Obj(ArrayBuffer((test,Str(hello)))) (of class upickle.Js$Obj) $c_s_PartialFunction$$anon$1.apply__O__sr_Nothing$ @ PartialFunction.scala:253 $c_s_PartialFunction$$anon$1.apply__O__O @ PartialFunction.scala:251 $c_Lupickle_AttributeTagged$$anonfun$annotate$2.applyOrElse__Lupickle_Js$Value__F1__O @ Api.scala:49
Which points to this code where there is an obviously unsafe match block.
Is this the expected behaviour?
ID: 101 Original Author: mechkg
It is, kinda. we introduced it a while ago and I don't remember why lol. I think @tindzk needed it for something
Original Author: lihaoyi
Trying to read wrong JSON as a tagged union type, e.g.:
results in a scala.MatchError (compiled with Scala.js):
Which points to this code where there is an obviously unsafe match block.
Is this the expected behaviour?
ID: 101 Original Author: mechkg