зеркало из https://github.com/golang/tools.git
change types.Named to types.Basic for iota, true, and false
This commit is contained in:
Родитель
9d40727055
Коммит
88ecf46921
|
@ -556,7 +556,7 @@ func (tv *tokenVisitor) ident(id *ast.Ident) {
|
|||
case *types.Builtin:
|
||||
emit(semtok.TokFunction, "defaultLibrary")
|
||||
case *types.Const:
|
||||
if is[*types.Named](obj.Type()) &&
|
||||
if is[*types.Basic](obj.Type()) &&
|
||||
(id.Name == "iota" || id.Name == "true" || id.Name == "false") {
|
||||
emit(semtok.TokVariable, "readonly", "defaultLibrary")
|
||||
} else {
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
This test checks semanticTokens on builtin constants.
|
||||
(test for #70219.)
|
||||
|
||||
-- settings.json --
|
||||
{
|
||||
"semanticTokens": true
|
||||
}
|
||||
|
||||
-- flags --
|
||||
-ignore_extra_diags
|
||||
|
||||
-- default_lib_const.go --
|
||||
package p
|
||||
|
||||
func _() {
|
||||
a, b := false, true //@ token("false", "variable", "readonly defaultLibrary"), token("true", "variable", "readonly defaultLibrary")
|
||||
}
|
||||
|
||||
const (
|
||||
c = iota //@ token("iota", "variable", "readonly defaultLibrary")
|
||||
)
|
Загрузка…
Ссылка в новой задаче