diff options
author | Russ Cox <rsc@golang.org> | 2008-10-08 09:21:57 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2008-10-08 09:21:57 -0700 |
commit | e3993a627ac46f58dcb7d9b9408857d644a3ea2a (patch) | |
tree | ba4db825dc2016fbeb114668b1447487be5fdbaf /test/interface2.go | |
parent | a4d7067b3ab0686d787dbfe5199df4c510dd9a85 (diff) | |
download | golang-e3993a627ac46f58dcb7d9b9408857d644a3ea2a.tar.gz |
more interface checks:
- pointer to interface cannot have methods
- record type names for better runtime error
R=r,ken
DELTA=85 (80 added, 0 deleted, 5 changed)
OCL=16658
CL=16722
Diffstat (limited to 'test/interface2.go')
-rw-r--r-- | test/interface2.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/interface2.go b/test/interface2.go new file mode 100644 index 000000000..8dfc9d8ff --- /dev/null +++ b/test/interface2.go @@ -0,0 +1,23 @@ +// $G $D/$F.go && $L $F.$A && ! ./$A.out + +// 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 + +type S struct + +type I interface { + Foo() +} + +func main() { + var s *S; + var i I; + i = s; +} + +// hide S down here to avoid static warning +type S struct { +} |