diff --git a/vlib/v/tests/fn_expecting_ref_but_returning_struct_test.v b/vlib/v/tests/fn_expecting_ref_but_returning_struct_test.v index f976458686..e8b73f0b3e 100644 --- a/vlib/v/tests/fn_expecting_ref_but_returning_struct_test.v +++ b/vlib/v/tests/fn_expecting_ref_but_returning_struct_test.v @@ -1,4 +1,5 @@ struct Foo { + x int } pub fn (f Foo) str() string { return 'Foo{}' } diff --git a/vlib/v/tests/working_with_an_empty_struct_test.v b/vlib/v/tests/working_with_an_empty_struct_test.v new file mode 100644 index 0000000000..b8772f6c53 --- /dev/null +++ b/vlib/v/tests/working_with_an_empty_struct_test.v @@ -0,0 +1,12 @@ +struct EmptyStruct {} +pub fn (f EmptyStruct) str() string { return 'EmptyStruct{}' } +fn new_s() EmptyStruct { + println('>get_foo') + return EmptyStruct{} +} + +fn test_using_an_empty_struct_compiles_and_works(){ + s := new_s() + eprintln('s: $s') + assert true +}