2009-05-21 14:46:20 -06:00
|
|
|
// errchk $G $D/$F.go
|
|
|
|
|
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
2009-05-06 18:05:55 -06:00
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2009-05-12 17:09:47 -06:00
|
|
|
// Error messages about missing implicit methods.
|
|
|
|
|
2009-05-06 18:05:55 -06:00
|
|
|
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;
|
2009-05-19 16:23:43 -06:00
|
|
|
p = t; // ERROR "is not|requires a pointer"
|
2009-09-14 22:03:53 -06:00
|
|
|
_, _= v, p;
|
2009-05-06 18:05:55 -06:00
|
|
|
v = &t;
|
|
|
|
p = &t;
|
2009-09-14 22:03:53 -06:00
|
|
|
_, _= v, p;
|
2009-05-06 18:05:55 -06:00
|
|
|
|
|
|
|
v = s;
|
2009-05-19 16:23:43 -06:00
|
|
|
p = s; // ERROR "is not|requires a pointer"
|
2009-09-14 22:03:53 -06:00
|
|
|
_, _= v, p;
|
2009-05-06 18:05:55 -06:00
|
|
|
v = &s;
|
|
|
|
p = &s;
|
2009-09-14 22:03:53 -06:00
|
|
|
_, _= v, p;
|
2009-05-06 18:05:55 -06:00
|
|
|
|
|
|
|
v = sp;
|
|
|
|
p = sp; // no error!
|
2009-09-14 22:03:53 -06:00
|
|
|
_, _= v, p;
|
2009-05-06 18:05:55 -06:00
|
|
|
v = &sp;
|
|
|
|
p = &sp;
|
2009-09-14 22:03:53 -06:00
|
|
|
_, _= v, p;
|
2009-05-06 18:05:55 -06:00
|
|
|
}
|
|
|
|
|