1
0
mirror of https://github.com/golang/go synced 2024-10-01 01:48:32 -06:00
go/internal/lsp/cache
Rebecca Stambler 3bd20875a2 internal/lsp/cache: hide type errors if we fix up the AST
I was curious about why were logging errors during type-checking in
tests, and the answer turned out to be a bit more sinister than I
expected. We were getting type error messages without filepaths, so I
tried to reproduce it in the playground and wasn't able to. I realized
that these errors were coming from were coming from the "fixed" version
of the AST that we pass to the type checker.

Adding fake positions to our fake Cond statements trivially fixes the
logging issue, but it does nothing to handle the fact that the error
makes no sense to the user - because it applies to something that's not
in the source code. I figured we have two options: (1) skip type errors
for all packages with "fixed" ASTs, or (2) add something to the error
messages to indicate that the source code may not match. Starting with
(1) here, and if it becomes a problem, we can move to 2. All ASTs that
we fix have *ast.BadExpr in them, meaning that, by definition they have
parse errors which we will preferentially show those errors to users in
diagnostics (so I'm not sure how to test this).

Change-Id: I17733968aa15f989cdd3e4e7261c4f4fe9b97495
Reviewed-on: https://go-review.googlesource.com/c/tools/+/227557
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2020-04-10 04:07:51 +00:00
..
analysis.go internal/lsp: add type error fixes to existing diagnostics 2020-04-08 01:45:16 +00:00
cache.go internal/lsp: move the debug.Instance onto the Context 2020-03-03 22:54:53 +00:00
check.go internal/lsp/cache: hide type errors if we fix up the AST 2020-04-10 04:07:51 +00:00
debug.go internal/lsp/lsprpc: add a handshake between forwarder and remote 2020-02-24 22:51:04 +00:00
error_test.go internal/lsp: refactor error handling code in type-checking 2019-10-21 18:57:46 +00:00
errors.go internal/lsp/cache: hide type errors if we fix up the AST 2020-04-10 04:07:51 +00:00
external.go internal/lsp: move the telemetry package 2020-03-18 13:22:49 +00:00
load.go internal/lsp/cache: add concurrency error check for go cmds 2020-04-08 03:22:09 +00:00
mod.go internal/lsp/cache: add concurrency error check for go cmds 2020-04-08 03:22:09 +00:00
os_darwin.go internal/lsp: add a mutex around the view's options 2020-04-02 16:41:49 +00:00
os_windows.go internal/lsp/cache: validate workspace path case 2020-03-27 19:55:53 +00:00
parse.go internal/lsp/cache: hide type errors if we fix up the AST 2020-04-10 04:07:51 +00:00
pkg.go internal/lsp/cache: hide type errors if we fix up the AST 2020-04-10 04:07:51 +00:00
session.go internal/lsp/cache: add concurrency error check for go cmds 2020-04-08 03:22:09 +00:00
snapshot.go internal/lsp/cache: add concurrency error check for go cmds 2020-04-08 03:22:09 +00:00
view_test.go internal/lsp/cache: validate workspace path case 2020-03-27 19:55:53 +00:00
view.go internal/lsp/cache: add concurrency error check for go cmds 2020-04-08 03:22:09 +00:00