Home | History | Annotate | Download | only in issue10700.dir
      1 // errorcheck -0 -m -l
      2 
      3 // Copyright 2015 The Go Authors. All rights reserved.
      4 // Use of this source code is governed by a BSD-style
      5 // license that can be found in the LICENSE file.
      6 
      7 package main
      8 
      9 import "./other"
     10 
     11 type Imported interface {
     12 	Do()
     13 }
     14 
     15 type HasAMethod struct {
     16 	x int
     17 }
     18 
     19 func (me *HasAMethod) Do() {
     20 	println(me.x)
     21 }
     22 
     23 func InMyCode(x *Imported, y *HasAMethod, z *other.Exported) {
     24 	x.Do() // ERROR "x\.Do undefined \(type \*Imported is pointer to interface, not interface\)"
     25 	x.do() // ERROR "x\.do undefined \(type \*Imported is pointer to interface, not interface\)"
     26 	(*x).Do()
     27 	x.Dont()    // ERROR "x\.Dont undefined \(type \*Imported is pointer to interface, not interface\)"
     28 	(*x).Dont() // ERROR "\(\*x\)\.Dont undefined \(type Imported has no field or method Dont\)"
     29 
     30 	y.Do()
     31 	y.do() // ERROR "y\.do undefined \(type \*HasAMethod has no field or method do, but does have Do\)"
     32 	(*y).Do()
     33 	(*y).do()   // ERROR "\(\*y\)\.do undefined \(type HasAMethod has no field or method do, but does have Do\)"
     34 	y.Dont()    // ERROR "y\.Dont undefined \(type \*HasAMethod has no field or method Dont\)"
     35 	(*y).Dont() // ERROR "\(\*y\)\.Dont undefined \(type HasAMethod has no field or method Dont\)"
     36 
     37 	z.Do() // ERROR "z\.Do undefined \(type \*other\.Exported is pointer to interface, not interface\)"
     38 	z.do() // ERROR "z\.do undefined \(type \*other\.Exported is pointer to interface, not interface\)"
     39 	(*z).Do()
     40 	(*z).do()     // ERROR "\(\*z\)\.do undefined \(type other.Exported has no field or method do, but does have Do\)"
     41 	z.Dont()      // ERROR "z\.Dont undefined \(type \*other\.Exported is pointer to interface, not interface\)"
     42 	(*z).Dont()   // ERROR "\(\*z\)\.Dont undefined \(type other\.Exported has no field or method Dont\)"
     43 	z.secret()    // ERROR "z\.secret undefined \(type \*other\.Exported is pointer to interface, not interface\)"
     44 	(*z).secret() // ERROR "\(\*z\)\.secret undefined \(cannot refer to unexported field or method secret\)"
     45 
     46 }
     47 
     48 func main() {
     49 }
     50