1
0
mirror of https://github.com/golang/go synced 2024-10-01 11:28:34 -06:00
go/internal/lsp/testdata/bad/bad1.go
Michael Matloob a8576e2603 internal/lsp: connect basic analysis functionality
This starts hooking up the analysis framework into the LSP. It runs
the Tests analysis (which I think might be the only one that doesn't
need facts or results) and reports its diagnostics if there are
no parse or typecheck failures.

Next step: figure out how to pass through results.

Change-Id: I21702d1cf5d54da399df54437f556b9351caa864
Reviewed-on: https://go-review.googlesource.com/c/161358
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-02-06 21:48:25 +00:00

28 lines
1.1 KiB
Go

// +build go1.11
package bad
// import (
// "github.com/bob/pkg" //@diag("\"github.com/bob/pkg\"", "LSP", "unable to import "\"github.com/bob/pkg\"")
// )
var a unknown //@item(global_a, "a", "unknown", "var"),diag("unknown", "LSP", "undeclared name: unknown")
func random() int { //@item(random, "random()", "int", "func")
//@complete("", global_a, bob, random, random2, random3, stuff)
return 0
}
func random2(y int) int { //@item(random2, "random2(y int)", "int", "func"),item(bad_y_param, "y", "int", "var")
x := 6 //@item(x, "x", "int", "var"),diag("x", "LSP", "x declared but not used")
var q blah //@item(q, "q", "blah", "var"),diag("q", "LSP", "q declared but not used"),diag("blah", "LSP", "undeclared name: blah")
var t blob //@item(t, "t", "blob", "var"),diag("t", "LSP", "t declared but not used"),diag("blob", "LSP", "undeclared name: blob")
//@complete("", q, t, x, bad_y_param, global_a, bob, random, random2, random3, stuff)
return y
}
func random3(y ...int) { //@item(random3, "random3(y ...int)", "", "func"),item(y_variadic_param, "y", "[]int", "var")
//@complete("", y_variadic_param, global_a, bob, random, random2, random3, stuff)
}