1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

json: fix option sumtype with int types (#18013)

This commit is contained in:
Felipe Pena
2023-04-22 04:58:01 -03:00
committed by GitHub
parent c43ea09d87
commit 89b7bebc3c
2 changed files with 18 additions and 1 deletions

View File

@@ -0,0 +1,13 @@
import json
struct Test {
optional_sumtype ?MySumtype
}
type MySumtype = int | string
fn test_simple() {
test := Test{}
encoded := json.encode(test)
assert dump(encoded) == '{}'
}