golang/go

x/tools/gopls: pointer to struct value field/method candidates not offered in type switch

Open

#38.564 aperta il 21 apr 2020

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)Go (19.008 fork)batch import
Toolsgoplshelp wanted

Metriche repository

Star
 (133.883 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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)?

What did you do?

I haven't been able to reduce the example to anything smaller than this unfortunately:

-- go.mod --
module mod.com

go 1.12

require github.com/yuin/goldmark v1.1.27
-- main.go --
package main

import (
	"io/ioutil"

	"github.com/yuin/goldmark"
	"github.com/yuin/goldmark/ast"
	"github.com/yuin/goldmark/text"
)

func main() {
	input, err := ioutil.ReadFile("input.md")
	if err != nil {
		panic(err)
	}
	p := goldmark.DefaultParser()
	r := text.NewReader(input)
	node := p.Parse(r)
	ast.Walk(node, func(n ast.Node, entering bool) (ast.WalkStatus, error) {
		if !entering {
			return ast.WalkContinue, nil
		}
		switch node := node.(type) {
		case *ast.HTMLBlock:
			node.
		case *ast.FencedCodeBlock:
		}
		return ast.WalkContinue, nil
	})
}

Attempting completion after node. in the *ast.HTMLBlock: case does not give any of the field/method candidates that should be offered for a value of type *ast.HTMLBlock. Instead we get:

What did you expect to see?

The field/method candidates for the *ast.HTMLBlock value.

What did you see instead?

As above


cc @stamblerre @muirdm

FYI @leitzler

Guida contributor