cgen: fix json decode with optional argument (fix #13943) (#13958)

This commit is contained in:
yuyi 2022-04-07 00:34:22 +08:00 committed by GitHub
parent 56e6fd01c5
commit c9dcdf6744
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 4 deletions

View file

@ -0,0 +1,12 @@
import json
struct TodoDto {
foo int
}
fn test_decode_with_encode_arg() ? {
body := TodoDto{}
ret := json.decode(TodoDto, json.encode(body)) ?
println(ret)
assert ret.foo == 0
}