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:
13
vlib/json/json_encode_sumtype_test.v
Normal file
13
vlib/json/json_encode_sumtype_test.v
Normal 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) == '{}'
|
||||
}
|
||||
Reference in New Issue
Block a user