x/tools/gopls: type alias rename changes aliased type #61625
Labels
FrozenDueToAge
gopls
Issues related to the Go language server, gopls.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
gopls version
`gopls -v version` -> v0.12.4
Build info ---------- golang.org/x/tools/gopls v0.12.4 golang.org/x/tools/[email protected] h1:nce5etAamR46d9oNGxop1aRK5rDQ0NqcY/SHIcyfEKY= github.com/BurntSushi/[email protected] h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= github.com/google/[email protected] h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/sergi/[email protected] h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= golang.org/x/[email protected] h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= golang.org/x/exp/[email protected] h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y= golang.org/x/[email protected] h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= golang.org/x/[email protected] h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/[email protected] h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= golang.org/x/[email protected] h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58= golang.org/x/[email protected] h1:5PWemM67wMSPpO0Y3lOPlyvgO3z56YkZRxPFcdd300g= golang.org/x/[email protected] h1:A9kONVi4+AnuOr1dopsibH6hLi1Huy54cbeJxnq4vmU= honnef.co/go/[email protected] h1:6qXr+R5w+ktL5UkwEbPp+fEvfyoMPche6GkOpGHZcLc= mvdan.cc/[email protected] h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM= mvdan.cc/xurls/[email protected] h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc= go: go1.20.6Behavior is unchanged by golang.org/x/tools/[email protected]
go env
`go env` -> go1.20.6
GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/murman/.cache/go-build" GOENV="/home/murman/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/murman/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/murman/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/home/murman/sdk/go1.20.6" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/home/murman/sdk/go1.20.6/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.20.6" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/home/murman/allium/renamefail/go.mod" GOWORK="" CGO_CFLAGS="-O2 -g" CGO_CPPFLAGS="" CGO_CXXFLAGS="-O2 -g" CGO_FFLAGS="-O2 -g" CGO_LDFLAGS="-O2 -g" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2239966941=/tmp/go-build -gno-record-gcc-switches"What did you do?
With my cursor on type alias
A
, attempt to rename it toB
. (VSCode F2; B; Enter)This is reduced from my original reduction (below). This tries to hint at the motivation: the generic type parameter couldn't be inferred, and (in the real case) I needed it multiple times, so I aliased it. Then I changed my mind about the name.
What did you expect to see?
I expected all instances of A to be replaced with B:
What did you see instead?
I saw all instances of LongNameHere turned into B:
or in the longer version:
In the real case this affected multiple files in a manner consistent with a rename of the aliased type instead of the type alias.
Editor and settings
I was able to reproduce this while commenting out all my VSCode go settings, so am omitting settings for now. Ping me if I'm wrong here.
Logs
Ditto.
The text was updated successfully, but these errors were encountered: