| 1 |
This test checks that completion works immediately after a dot |
| 2 |
in a selector expression when the AST is broken due to a syntax error. |
| 3 |
See https://github.com/golang/go/issues/65529. |
| 4 |
|
| 5 |
-- flags -- |
| 6 |
-ignore_extra_diags |
| 7 |
|
| 8 |
-- go.mod -- |
| 9 |
module mod.test |
| 10 |
|
| 11 |
go 1.21 |
| 12 |
|
| 13 |
-- dot_pkg.go -- |
| 14 |
package main |
| 15 |
|
| 16 |
import "math" |
| 17 |
|
| 18 |
func main() { |
| 19 |
math.Sqrt(, 0) |
| 20 |
math. //@rank(re"\\.()", "Abs", "Sqrt"),acceptcompletion(re"\\.()", "Abs", dot_pkg) |
| 21 |
} |
| 22 |
|
| 23 |
-- @dot_pkg/dot_pkg.go -- |
| 24 |
package main |
| 25 |
|
| 26 |
import "math" |
| 27 |
|
| 28 |
func main() { |
| 29 |
math.Sqrt(, 0) |
| 30 |
math.Abs(${1:}) //@rank(re"\\.()", "Abs", "Sqrt"),acceptcompletion(re"\\.()", "Abs", dot_pkg) |
| 31 |
} |
| 32 |
|
| 33 |
-- dot_field.go -- |
| 34 |
package main |
| 35 |
|
| 36 |
import "fmt" |
| 37 |
|
| 38 |
type Foo struct { |
| 39 |
BarInt int |
| 40 |
} |
| 41 |
|
| 42 |
func main() { |
| 43 |
f := Foo{} |
| 44 |
fmt.Println(, 0) |
| 45 |
f. //@rank(re"\\.()", "BarInt"),acceptcompletion(re"\\.()", "BarInt", dot_field) |
| 46 |
} |
| 47 |
|
| 48 |
-- @dot_field/dot_field.go -- |
| 49 |
package main |
| 50 |
|
| 51 |
import "fmt" |
| 52 |
|
| 53 |
type Foo struct { |
| 54 |
BarInt int |
| 55 |
} |
| 56 |
|
| 57 |
func main() { |
| 58 |
f := Foo{} |
| 59 |
fmt.Println(, 0) |
| 60 |
f.BarInt //@rank(re"\\.()", "BarInt"),acceptcompletion(re"\\.()", "BarInt", dot_field) |
| 61 |
} |
| 62 |
|