| 1 |
This test checks the basic of 'Declare missing method T.f' quick fix. |
| 2 |
|
| 3 |
-- basic_stub.go -- |
| 4 |
package fromcallbasic |
| 5 |
|
| 6 |
type Basic struct{} |
| 7 |
|
| 8 |
func basic() { |
| 9 |
i := 1 |
| 10 |
b := Basic{} |
| 11 |
f(b.basic(i)) //@quickfix("basic", re"has no field or method", basic) |
| 12 |
} |
| 13 |
|
| 14 |
func f(i int) string { return "s" } |
| 15 |
-- @basic/basic_stub.go -- |
| 16 |
@@ -5 +5,4 @@ |
| 17 |
+func (b Basic) basic(i int) int { |
| 18 |
+ panic("unimplemented") |
| 19 |
+} |
| 20 |
+ |
| 21 |
-- pointer.go -- |
| 22 |
package fromcallbasic |
| 23 |
|
| 24 |
type P struct{} |
| 25 |
|
| 26 |
func recv_param_pointer() { |
| 27 |
p := &P{} |
| 28 |
i := 42 |
| 29 |
p.pointer(&i) //@quickfix("pointer", re"has no field or method", pointer) |
| 30 |
} |
| 31 |
-- @pointer/pointer.go -- |
| 32 |
@@ -5 +5,4 @@ |
| 33 |
+func (p *P) pointer(i *int) { |
| 34 |
+ panic("unimplemented") |
| 35 |
+} |
| 36 |
+ |
| 37 |
-- other.go -- |
| 38 |
package fromcallbasic |
| 39 |
|
| 40 |
type TypeDeclInOtherFile struct{} |
| 41 |
|
| 42 |
-- this.go -- |
| 43 |
package fromcallbasic |
| 44 |
|
| 45 |
func fun() { |
| 46 |
i := 1 |
| 47 |
t := TypeDeclInOtherFile{} |
| 48 |
t.other(i) //@quickfix("other", re"has no field or method", del_other) |
| 49 |
} |
| 50 |
-- @del_other/other.go -- |
| 51 |
@@ -5 +5,3 @@ |
| 52 |
+func (t TypeDeclInOtherFile) other(i int) { |
| 53 |
+ panic("unimplemented") |
| 54 |
+} |
| 55 |
-- should_insert_after.go -- |
| 56 |
package fromcallbasic |
| 57 |
|
| 58 |
type HasMethod struct{} |
| 59 |
|
| 60 |
func (h *HasMethod) m() { |
| 61 |
h.should_insert_after() //@quickfix("should_insert_after", re"has no field or method", insert) |
| 62 |
} |
| 63 |
-- @insert/should_insert_after.go -- |
| 64 |
@@ -8 +8,4 @@ |
| 65 |
+ |
| 66 |
+func (h *HasMethod) should_insert_after() { |
| 67 |
+ panic("unimplemented") |
| 68 |
+} |