mirror of
https://github.com/vlang/v.git
synced 2025-09-08 06:41:58 -04:00
parent
07ce904431
commit
195f1612f8
8
vlib/json/tests/json_decode_sumtype_option_test.v
Normal file
8
vlib/json/tests/json_decode_sumtype_option_test.v
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
|
type Any = string | f32 | bool | ?int
|
||||||
|
|
||||||
|
fn test_main() {
|
||||||
|
x := json.decode([]Any, '["hi", -9.8e7, true, null]')!
|
||||||
|
assert dump(x) == [Any('hi'), Any(f32(-9.8e+7)), Any(true), Any('')]
|
||||||
|
}
|
@ -1161,6 +1161,9 @@ pub fn (mut w Walker) mark_by_sym(isym ast.TypeSymbol) {
|
|||||||
w.features.used_maps++
|
w.features.used_maps++
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if typ.has_flag(.option) {
|
||||||
|
w.used_option++
|
||||||
|
}
|
||||||
w.mark_by_type(typ)
|
w.mark_by_type(typ)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user