1
0
mirror of https://github.com/golang/go synced 2024-11-22 20:40:03 -07:00
go/test/interface9.go
Russ Cox c7d30bceb2 describe each interface test
R=r
DELTA=20  (20 added, 0 deleted, 0 changed)
OCL=28707
CL=28716
2009-05-12 16:09:47 -07:00

44 lines
617 B
Go

// 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.
// errchk $G $F.go
// Error messages about missing implicit methods.
package main
type T int
func (t T) V()
func (t *T) P()
type V interface { V() }
type P interface { P(); V() }
type S struct { T; }
type SP struct { *T; }
func main() {
var t T;
var v V;
var p P;
var s S;
var sp SP;
v = t;
p = t; // ERROR "is not"
v = &t;
p = &t;
v = s;
p = s; // ERROR "is not"
v = &s;
p = &s;
v = sp;
p = sp; // no error!
v = &sp;
p = &sp;
}