You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ go tool go2go run err.go2
# command-line-arguments
./err.go2:8: undefined: embedPair
./err.go2:8: type a is not an expression
./err.go2:8: type b is not an expression
where err.go2 is:
package main
type a struct{}
type b struct{}
type c struct{}
type embedPair(type T, U) struct {
T
U
}
func main() {
_ = embedPair(embedPair(a, b), c){}
}
We were relying on calling typeString and treating that as an AST ident,
with special handling for instantiated types, but that fails if there is
an instantiated type within a type literal.
Fixes#39881
Change-Id: I793fe359868d8d73e830aa8dc67cf52de99355a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/240197
Reviewed-by: Ian Lance Taylor <[email protected]>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, as of commit 1b08ace
What did you do?
where err.go2 is:
It gives a different error in the playground: https://go2goplay.golang.org/p/2h7HWFVkvW2
(a couple days ago it crashed, so this is better than it was)
What did you expect to see?
I expected it to construct a type like:
Only
x
will be unnamed, so I'm not sure how this is supposed to work, which is why I was trying it.What did you see instead?
It gives confusing error messages.
The text was updated successfully, but these errors were encountered: