Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make sure unserialize also works:

type foo = { int x, bool y }
function bar(){
  foo a = {x:1, y:true}
  Debug.warning(Json.serialize(OpaSerialize.Json.serialize(a)))
  b = Json.deserialize(Json.serialize(OpaSerialize.Json.serialize(a)))
  option(foo) c = OpaSerialize.Json.unserialize(Option.get(b))
  Debug.warning(Debug.dump(Option.get(c)))
}
bar()

outputs:
{"y":true,"x":1}
{x: $1$; y: {Bool: {true}}}
  • Loading branch information...
commit 5b9efc808630f96f5841e4cf1cbebfbbecd7897e 1 parent 5733126
Alok Menghrajani authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 stdlib/core/rpc/core/opaserialize.opa
View
4 stdlib/core/rpc/core/opaserialize.opa
@@ -733,6 +733,10 @@ OpaSerializeClosure = {{
record_to_list(json,[])
/* Particular named type ******************/
+ /* Bool */
+ | (_, {TyName_ident = "bool"; TyName_args = _}) ->
+ magic_some(json)
+
/* Session */
| (_, {TyName_ident = "Session.private.native"; TyName_args = _})
| (_, {TyName_ident = "channel"; TyName_args = _})

2 comments on commit 5b9efc8

@alokmenghrajani

for some reason, this code works inside the bar() function, but if I take it out of there, I get the following error:

File "stdlib/core/opatype.opa", line 451, characters 11-195, (451:11-453:61 | 16677-16861)
@fail: [OpaType.fields_of_fields_list] Can't select a row for :
value (dump): {Bool: {true}}list fields : {true : {}} / {false : {}}
Error: uncaught OPA exception {fail: $"[OpaType.fields_of_fields_list] Can't select a row for :\nvalue (dump): {Bool: {true}}list fields : {true : {}} / {false : {}}"$; position: $"File \"stdlib/core/opatype.opa\", line 451, characters 11-195, (451:11-453:61 | 16677-16861)"$}
*** Stack trace:
Fatal error: exception Failure("Barrier (bslvalue_record_fold_record : 305) was not released, don't wait anymore")

@alokmenghrajani

am i going down a rabbit hole?

Please sign in to comment.
Something went wrong with that request. Please try again.