github.com/xushiwei/go@v0.0.0-20130601165731-2b9d83f45bc9/test/fixedbugs/issue4529.go (about)

     1  // compile
     2  
     3  // Copyright 2012 The Go Authors.  All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  // Issue 4529: escape analysis crashes on "go f(g())"
     8  // when g has multiple returns.
     9  
    10  package main
    11  
    12  type M interface{}
    13  
    14  type A struct {
    15  	a string
    16  	b chan M
    17  }
    18  
    19  func (a *A) I() (b <-chan M, c chan<- M) {
    20  	a.b, c = make(chan M), make(chan M)
    21  	b = a.b
    22  
    23  	return
    24  }
    25  
    26  func Init(a string, b *A, c interface {
    27  	I() (<-chan M, chan<- M)
    28  }) {
    29  	b.a = a
    30  	go b.c(c.I())
    31  }
    32  
    33  func (a *A) c(b <-chan M, _ chan<- M) {}