@@ -26,14 +26,24 @@ func TestTupleMember(t *testing.T) {
2626 x := types .NewField (token .NoPos , pkg .Types , "x" , types .Typ [types .Int ], false )
2727 y := types .NewField (token .NoPos , pkg .Types , "y" , types .Typ [types .Int ], false )
2828 typ := pkg .NewTuple (true , x , y )
29+ pt := types .NewNamed (types .NewTypeName (token .NoPos , pkg .Types , "Point" , typ ), typ , nil )
2930 a := types .NewParam (token .NoPos , pkg .Types , "a" , typ )
30- pkg .NewFunc (nil , "foo" , types .NewTuple (a ), nil , false ).BodyStart (pkg ).
31+ b := types .NewParam (token .NoPos , pkg .Types , "b" , pt )
32+ typf := types .NewSignatureType (nil , nil , nil , nil , types .NewTuple (b ), false )
33+ f := types .NewParam (token .NoPos , pkg .Types , "f" , typf )
34+ pkg .NewFunc (nil , "foo" , types .NewTuple (a , f ), nil , false ).BodyStart (pkg ).
3135 Val (ctxRef (pkg , "a" )).
3236 MemberRef ("x" ).
3337 Val (ctxRef (pkg , "a" )).
3438 MemberVal ("y" ).
3539 Assign (1 ).
3640 EndStmt ().
41+ DefineVarStart (token .NoPos , "x" , "y" ).
42+ Val (ctxRef (pkg , "a" )).
43+ EndInit (1 ).
44+ DefineVarStart (token .NoPos , "x2" , "y2" ).
45+ Val (ctxRef (pkg , "f" )).Call (0 ).
46+ EndInit (1 ).
3747 Debug (func (cb * gogen.CodeBuilder ) {
3848 cb .Val (ctxRef (pkg , "a" ))
3949 cb .Member ("unknown" , gogen .MemberFlagRef )
@@ -46,8 +56,12 @@ func TestTupleMember(t *testing.T) {
4656func foo(a struct {
4757 X_0 int
4858 X_1 int
49- }) {
59+ }, f func() (b Point) ) {
5060 a.X_0 = a.X_1
61+ x, y := a.X_0, a.X_1
62+ x2, y2 := func(v Point) (int, int) {
63+ return v.X_0, v.X_1
64+ }(f())
5165}
5266` )
5367}
0 commit comments