From a3cd10035760e303eb4ada157a17fe18555a2b82 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Wed, 15 Apr 2026 04:35:00 +0300 Subject: [PATCH] cgen: fix c error on build with string interpolation of struct with context interface (fixes #15223) --- ...ation_struct_with_context_interface_test.v | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 vlib/v/tests/builtin_strings_and_interpolation/string_interpolation_struct_with_context_interface_test.v diff --git a/vlib/v/tests/builtin_strings_and_interpolation/string_interpolation_struct_with_context_interface_test.v b/vlib/v/tests/builtin_strings_and_interpolation/string_interpolation_struct_with_context_interface_test.v new file mode 100644 index 000000000..006b77c2c --- /dev/null +++ b/vlib/v/tests/builtin_strings_and_interpolation/string_interpolation_struct_with_context_interface_test.v @@ -0,0 +1,20 @@ +import context + +struct Ctx { + ctx context.Context +} + +fn smth_with_ctx(ctx context.Context) Ctx { + return Ctx{ + ctx: ctx + } +} + +fn test_string_interpolation_of_struct_with_context_interface_field() { + ctx := context.todo() + rslt := smth_with_ctx(ctx) + s := '${rslt}' + assert s.starts_with('Ctx{') + assert s.contains('ctx:') + assert s.contains('context.TODO') +} -- 2.39.5