From: Russ Cox Date: Sat, 4 Oct 2008 00:06:24 +0000 (-0700) Subject: const bug, name bug - working on both X-Git-Tag: weekly.2009-11-06~3047 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7766b12ead95c1f722f4a2a993acc8081f96fd8e;p=gostls13.git const bug, name bug - working on both R=r DELTA=43 (43 added, 0 deleted, 0 changed) OCL=16468 CL=16475 --- diff --git a/test/bugs/bug110.go b/test/bugs/bug110.go new file mode 100644 index 0000000000..84273b4758 --- /dev/null +++ b/test/bugs/bug110.go @@ -0,0 +1,19 @@ +// $G $D/$F.go && $L $F.$A || echo BUG: const bug + +// 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 + +const A = 0 + +func f() { + const A = 5 +} + +func main() { + if A != 0 { + panic("A=", A) + } +} diff --git a/test/bugs/bug111.go b/test/bugs/bug111.go new file mode 100644 index 0000000000..e49357aa9a --- /dev/null +++ b/test/bugs/bug111.go @@ -0,0 +1,32 @@ +// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG should compile and run + +// 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; + +export type Iffy interface { + Me() Iffy +} + +export type Stucky struct { + n int +} + +func (s *Stucky) Me() Iffy { + ncall++ + return s +} + +func main() { + s := new(Stucky); + i := s.Me(); + j := i.Me(); + j.Me(); + if ncall != 3 { + panic("bug111") + } +}