File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,5 +5,12 @@ expect "Break on * interface_var in ${test_file}:14\r\n"
55expect "${test_file}:14 vdbg> "
66send "p a\n"
77expect "a = Test{\r\n a: MySum(true)"
8+ send "c\n"
9+ expect "Break on * struct_to_interface_field in ${test_file}:33\r\n"
10+ expect "${test_file}:33 vdbg> "
11+ send "p t1\n"
12+ expect "t1 = Test{\r\n a: MySum(false)"
13+ send "p t2\n"
14+ expect "t2 = Test{\r\n a: MySum(false)"
815send "q\n"
916expect eof
Original file line number Diff line number Diff line change @@ -17,6 +17,23 @@ fn interface_var(a ITest) {
1717 }
1818}
1919
20+ struct MyTest {
21+ t ITest
22+ }
23+
24+ fn struct_to_interface_field() {
25+ t1 := Test{}
26+ _ := MyTest{
27+ t: t1
28+ }
29+ mut t2 := Test{}
30+ _ := MyTest{
31+ t: t2
32+ }
33+ $dbg;
34+ }
35+
2036fn main() {
2137 interface_var(Test{ a: true })
38+ struct_to_interface_field()
2239}
Original file line number Diff line number Diff line change @@ -4832,7 +4832,7 @@ fn (mut g Gen) debugger_stmt(node ast.DebuggerStmt) {
48324832 '&'
48334833 } else if ! str_method_expects_ptr && obj.typ.is_ptr () {
48344834 '*' .repeat (obj.typ.nr_muls ())
4835- } else if ! str_method_expects_ptr && obj_sym.is_heap () {
4835+ } else if ! str_method_expects_ptr && ( obj_sym.is_heap () || obj.is_auto_heap ) {
48364836 '*'
48374837 } else if obj.is_auto_heap && var_typ.is_ptr () && str_method_expects_ptr {
48384838 '*'
You can’t perform that action at this time.
0 commit comments