| 1 |
This test exercises renaming of interface methods. |
| 2 |
|
| 3 |
-- go.mod -- |
| 4 |
module example.com |
| 5 |
go 1.12 |
| 6 |
|
| 7 |
-- a/a.go -- |
| 8 |
package a |
| 9 |
|
| 10 |
type A int |
| 11 |
|
| 12 |
func (A) F() {} //@renameerr("F", "G", errAfToG) |
| 13 |
|
| 14 |
-- b/b.go -- |
| 15 |
package b |
| 16 |
|
| 17 |
import "example.com/a" |
| 18 |
import "example.com/c" |
| 19 |
|
| 20 |
type B interface { F() } //@rename("F", "G", BfToG) |
| 21 |
|
| 22 |
var _ B = a.A(0) |
| 23 |
var _ B = c.C(0) |
| 24 |
|
| 25 |
var _ = B.F |
| 26 |
|
| 27 |
-- c/c.go -- |
| 28 |
package c |
| 29 |
|
| 30 |
type C int |
| 31 |
|
| 32 |
func (C) F() {} //@renameerr("F", "G", errCfToG) |
| 33 |
|
| 34 |
-- d/d.go -- |
| 35 |
package d |
| 36 |
|
| 37 |
import "example.com/b" |
| 38 |
|
| 39 |
var _ = b.B.F |
| 40 |
|
| 41 |
-- @errAfToG -- |
| 42 |
a/a.go:5:10: renaming this method "F" to "G" |
| 43 |
b/b.go:6:6: would make example.com/a.A no longer assignable to interface B |
| 44 |
b/b.go:6:20: (rename example.com/b.B.F if you intend to change both types) |
| 45 |
-- @BfToG/b/b.go -- |
| 46 |
@@ -6 +6 @@ |
| 47 |
-type B interface { F() } //@rename("F", "G", BfToG) |
| 48 |
+type B interface { G() } //@rename("F", "G", BfToG) |
| 49 |
@@ -11 +11 @@ |
| 50 |
-var _ = B.F |
| 51 |
+var _ = B.G |
| 52 |
-- @BfToG/d/d.go -- |
| 53 |
@@ -5 +5 @@ |
| 54 |
-var _ = b.B.F |
| 55 |
+var _ = b.B.G |
| 56 |
-- @errCfToG -- |
| 57 |
c/c.go:5:10: renaming this method "F" to "G" |
| 58 |
b/b.go:6:6: would make example.com/c.C no longer assignable to interface B |
| 59 |
b/b.go:6:20: (rename example.com/b.B.F if you intend to change both types) |