What version of Go are you using (go version)?
$ go version
go version go1.13 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
Darwin/amd64
What did you do?
I used types.CheckExpr to check the expression "foo{i}" in the package:
package fake
type foo struct {}
var _ = foo{i}
What did you expect to see?
I expected to have some way to type check resiliently and get the type for my *ast.CompositeLit.
See https://play.golang.org/p/dDqvcc-jSFM
What did you see instead?
The error for the un-type checkable "i" identifier is returned and no type checking is done. When using *types.Checker you can set the "Error" callback in the config so the type checker doesn't bail out, but CheckExpr doesn't set "Error" in the config.
I was experimenting with types.CheckExpr in gopls to provide completions in the face of certain kinds of syntax errors, but its utility is limited because it isn't resilient to errors.
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env)?Darwin/amd64
What did you do?
I used
types.CheckExprto check the expression "foo{i}" in the package:What did you expect to see?
I expected to have some way to type check resiliently and get the type for my
*ast.CompositeLit.See https://play.golang.org/p/dDqvcc-jSFM
What did you see instead?
The error for the un-type checkable "i" identifier is returned and no type checking is done. When using
*types.Checkeryou can set the "Error" callback in the config so the type checker doesn't bail out, but CheckExpr doesn't set "Error" in the config.I was experimenting with
types.CheckExprin gopls to provide completions in the face of certain kinds of syntax errors, but its utility is limited because it isn't resilient to errors.