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 4323: inlining of functions with local variables 8// forgets to typecheck the declarations in the inlined copy. 9 10package main 11 12type reader struct { 13 C chan T 14} 15 16type T struct{ C chan []byte } 17 18var r = newReader() 19 20func newReader() *reader { return new(reader) } 21 22func (r *reader) Read(n int) ([]byte, error) { 23 req := T{C: make(chan []byte)} 24 r.C <- req 25 return <-req.C, nil 26} 27 28func main() { 29 s, err := r.Read(1) 30 _, _ = s, err 31} 32