]> Cypherpunks repositories - gostls13.git/commitdiff
const bug, name bug - working on both
authorRuss Cox <rsc@golang.org>
Sat, 4 Oct 2008 00:06:24 +0000 (17:06 -0700)
committerRuss Cox <rsc@golang.org>
Sat, 4 Oct 2008 00:06:24 +0000 (17:06 -0700)
R=r
DELTA=43  (43 added, 0 deleted, 0 changed)
OCL=16468
CL=16475

test/bugs/bug110.go [new file with mode: 0644]
test/bugs/bug111.go [new file with mode: 0644]

diff --git a/test/bugs/bug110.go b/test/bugs/bug110.go
new file mode 100644 (file)
index 0000000..84273b4
--- /dev/null
@@ -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 (file)
index 0000000..e49357a
--- /dev/null
@@ -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")
+       }
+}