1
0
mirror of https://github.com/golang/go synced 2024-11-05 17:06:13 -07:00
go/test/interface/receiver1.go
Russ Cox b9159722dd add test for yesterday's interface rule change (interface/convert1.go).
move interface tests to subdirectory.

R=r
DELTA=1632  (827 added, 804 deleted, 1 changed)
OCL=29181
CL=29191
2009-05-21 13:46:20 -07:00

44 lines
657 B
Go

// errchk $G $D/$F.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.
// 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|requires a pointer"
v = &t;
p = &t;
v = s;
p = s; // ERROR "is not|requires a pointer"
v = &s;
p = &s;
v = sp;
p = sp; // no error!
v = &sp;
p = &sp;
}