diff options
| author | Anthony Martin <ality@pbrane.org> | 2011-05-24 19:48:19 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2011-05-24 19:48:19 -0400 |
| commit | 0b209b36b6ae03f81d93f07bcbbdcb8fa8a1aebe (patch) | |
| tree | c6c169e158880c88af24db88f67773551ec64975 /test/bugs | |
| parent | 3857747dce065b3cfae3e9df38ea90dd84661f19 (diff) | |
| download | go-0b209b36b6ae03f81d93f07bcbbdcb8fa8a1aebe.tar.xz | |
gc: relax assignability of method receivers
The spec was adjusted in commit df410d6a4842 to allow the
implicit assignment of strutures with unexported fields in
method receivers. This change updates the compiler.
Also moved bug322 into fixedbugs and updated golden.out
to reflect the removal of the last known bug.
Fixes #1402.
R=golang-dev, gri, rsc
CC=golang-dev
https://golang.org/cl/4526069
Diffstat (limited to 'test/bugs')
| -rw-r--r-- | test/bugs/bug322.dir/lib.go | 15 | ||||
| -rw-r--r-- | test/bugs/bug322.dir/main.go | 47 | ||||
| -rw-r--r-- | test/bugs/bug322.go | 8 |
3 files changed, 0 insertions, 70 deletions
diff --git a/test/bugs/bug322.dir/lib.go b/test/bugs/bug322.dir/lib.go deleted file mode 100644 index 0de56d3d64..0000000000 --- a/test/bugs/bug322.dir/lib.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2011 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 lib - -type T struct { - x int // non-exported field -} - -func (t T) M() { -} - -func (t *T) PM() { -} diff --git a/test/bugs/bug322.dir/main.go b/test/bugs/bug322.dir/main.go deleted file mode 100644 index 0ab5b32e45..0000000000 --- a/test/bugs/bug322.dir/main.go +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2011 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 - -import "./lib" - -type I interface { - M() -} - -type PI interface { - PM() -} - -func main() { - var t lib.T - t.M() - t.PM() - - // This is still an error. - // var i1 I = t - // i1.M() - - // This combination is illegal because - // PM requires a pointer receiver. - // var pi1 PI = t - // pi1.PM() - - var pt = &t - pt.M() - pt.PM() - - var i2 I = pt - i2.M() - - var pi2 PI = pt - pi2.PM() -} - -/* -These should not be errors anymore: - -bug322.dir/main.go:19: implicit assignment of unexported field 'x' of lib.T in method receiver -bug322.dir/main.go:32: implicit assignment of unexported field 'x' of lib.T in method receiver -*/ diff --git a/test/bugs/bug322.go b/test/bugs/bug322.go deleted file mode 100644 index ad0e62dc8c..0000000000 --- a/test/bugs/bug322.go +++ /dev/null @@ -1,8 +0,0 @@ -// $G $D/$F.dir/lib.go && $G $D/$F.dir/main.go && $L main.$A && ./$A.out || echo BUG: fails incorrectly - -// Copyright 2011 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. - -// Test case for issue 1402. -ignored |
