Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: const tokenized as a string #42715

Closed
stamblerre opened this issue Nov 19, 2020 · 2 comments
Closed

x/tools/gopls: const tokenized as a string #42715

stamblerre opened this issue Nov 19, 2020 · 2 comments
Assignees
Labels
Milestone

Comments

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Nov 19, 2020

Screen Shot 2020-11-19 at 12 55 41 AM

In the above screenshot, the mod const is tokenized as a string, leading it to appear the same as a string in the given function.

To repro, add the following to any file in golang.org/x/tools/gopls/internal/regtest:

func TestUseOfInvalidMetadata(t *testing.T) {
	const mod = `
-- go.mod --
module mod.com

go 1.12
-- main.go --
package main

import "mod.com/a"

func _() {
	a.Hello()
}
-- a/a.go --
package a

func Hello() {}
`
	run(t, mod, func(t *testing.T, env *Env) {

	})
}

/cc @pjweinb

@stamblerre stamblerre added this to the gopls/unplanned milestone Nov 19, 2020
@pjweinb pjweinb self-assigned this Nov 19, 2020
@pjweinb
Copy link

@pjweinb pjweinb commented Nov 19, 2020

And also the assignment of tokens to predeclared identifiers is inconsistent. (true, false, nil, iota)

@gopherbot
Copy link

@gopherbot gopherbot commented Nov 24, 2020

Change https://golang.org/cl/272208 mentions this issue: internal/lsp: revise some semantic token details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.