| 1 |
This test checks that we don't suggest completion to an untyped conversion such |
| 2 |
as "untyped float(abcdef)". |
| 3 |
|
| 4 |
-- main.go -- |
| 5 |
package main |
| 6 |
|
| 7 |
func main() { |
| 8 |
abcdef := 32 //@diag("abcdef", re"not used") |
| 9 |
x := 1.0 / abcd //@acceptcompletion(re"abcd()", "abcdef", int), diag("x", re"not used"), diag("abcd", re"(undefined|undeclared)") |
| 10 |
|
| 11 |
// Verify that we don't suggest converting compatible untyped constants. |
| 12 |
const untypedConst = 42 |
| 13 |
y := 1.1 / untypedC //@acceptcompletion(re"untypedC()", "untypedConst", untyped), diag("y", re"not used"), diag("untypedC", re"(undefined|undeclared)") |
| 14 |
} |
| 15 |
|
| 16 |
-- @int/main.go -- |
| 17 |
package main |
| 18 |
|
| 19 |
func main() { |
| 20 |
abcdef := 32 //@diag("abcdef", re"not used") |
| 21 |
x := 1.0 / float64(abcdef) //@acceptcompletion(re"abcd()", "abcdef", int), diag("x", re"not used"), diag("abcd", re"(undefined|undeclared)") |
| 22 |
|
| 23 |
// Verify that we don't suggest converting compatible untyped constants. |
| 24 |
const untypedConst = 42 |
| 25 |
y := 1.1 / untypedC //@acceptcompletion(re"untypedC()", "untypedConst", untyped), diag("y", re"not used"), diag("untypedC", re"(undefined|undeclared)") |
| 26 |
} |
| 27 |
|
| 28 |
-- @untyped/main.go -- |
| 29 |
package main |
| 30 |
|
| 31 |
func main() { |
| 32 |
abcdef := 32 //@diag("abcdef", re"not used") |
| 33 |
x := 1.0 / abcd //@acceptcompletion(re"abcd()", "abcdef", int), diag("x", re"not used"), diag("abcd", re"(undefined|undeclared)") |
| 34 |
|
| 35 |
// Verify that we don't suggest converting compatible untyped constants. |
| 36 |
const untypedConst = 42 |
| 37 |
y := 1.1 / untypedConst //@acceptcompletion(re"untypedC()", "untypedConst", untyped), diag("y", re"not used"), diag("untypedC", re"(undefined|undeclared)") |
| 38 |
} |
| 39 |
|