mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
non-pkg: gofix -r error -force=error
R=golang-dev, iant, r, r CC=golang-dev https://golang.org/cl/5307066
This commit is contained in:
parent
eb6929299b
commit
44526cdbe0
63 changed files with 300 additions and 320 deletions
|
|
@ -12,16 +12,14 @@ type I interface {
|
|||
f()
|
||||
}
|
||||
|
||||
|
||||
var callee string
|
||||
var error bool
|
||||
var error_ bool
|
||||
|
||||
type T int
|
||||
|
||||
func (t *T) f() { callee = "f" }
|
||||
func (i *T) g() { callee = "g" }
|
||||
|
||||
|
||||
// test1 and test2 are the same except that in the interface J
|
||||
// the entries are swapped. test2 and test3 are the same except
|
||||
// that in test3 the interface J is declared outside the function.
|
||||
|
|
@ -36,11 +34,10 @@ func test1(x I) {
|
|||
x.(J).f()
|
||||
if callee != "f" {
|
||||
println("test1 called", callee)
|
||||
error = true
|
||||
error_ = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func test2(x I) {
|
||||
type J interface {
|
||||
g()
|
||||
|
|
@ -49,11 +46,10 @@ func test2(x I) {
|
|||
x.(J).f()
|
||||
if callee != "f" {
|
||||
println("test2 called", callee)
|
||||
error = true
|
||||
error_ = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
type J interface {
|
||||
g()
|
||||
I
|
||||
|
|
@ -63,7 +59,7 @@ func test3(x I) {
|
|||
x.(J).f()
|
||||
if callee != "f" {
|
||||
println("test3 called", callee)
|
||||
error = true
|
||||
error_ = true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -72,7 +68,7 @@ func main() {
|
|||
test1(x)
|
||||
test2(x)
|
||||
test3(x)
|
||||
if error {
|
||||
if error_ {
|
||||
panic("wrong method called")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue