2012-02-18 22:15:42 +01:00
|
|
|
// run
|
2008-10-03 17:06:24 -07:00
|
|
|
|
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
var ncall int;
|
|
|
|
|
2009-01-20 14:40:40 -08:00
|
|
|
type Iffy interface {
|
2008-10-03 17:06:24 -07:00
|
|
|
Me() Iffy
|
|
|
|
}
|
|
|
|
|
2009-01-20 14:40:40 -08:00
|
|
|
type Stucky struct {
|
2008-10-03 17:06:24 -07:00
|
|
|
n int
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Stucky) Me() Iffy {
|
2008-10-07 12:31:31 -07:00
|
|
|
ncall++;
|
2008-10-03 17:06:24 -07:00
|
|
|
return s
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
2009-01-06 15:19:02 -08:00
|
|
|
s := new(Stucky);
|
2008-10-03 17:06:24 -07:00
|
|
|
i := s.Me();
|
|
|
|
j := i.Me();
|
|
|
|
j.Me();
|
|
|
|
if ncall != 3 {
|
|
|
|
panic("bug111")
|
|
|
|
}
|
|
|
|
}
|