-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
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.
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.