fix optional with empty struct

pull/13970/head
yuyi98 2022-04-08 12:28:37 +08:00
parent 6425000ce4
commit 32a1d933fe
2 changed files with 2 additions and 4 deletions

View File

@ -1,9 +1,7 @@
import json import json
import os import os
struct DbConfig { struct DbConfig {}
foo int
}
fn test_json_decode_with_optional_arg() { fn test_json_decode_with_optional_arg() {
if ret := print_info() { if ret := print_info() {

View File

@ -972,7 +972,7 @@ fn (g Gen) optional_type_text(styp string, base string) string {
ret := 'struct $styp { ret := 'struct $styp {
byte state; byte state;
IError err; IError err;
byte data[sizeof($size)]; byte data[sizeof($size) > 0 ? sizeof($size) : 1];
}' }'
return ret return ret
} }