Skip to content

cmd/go2go: embedding doesn't seem to work? #39881

Closed
@lavalamp

Description

@lavalamp

What version of Go are you using (go version)?

$ go version
go version devel +1b08acee45 Thu Jun 25 23:22:18 2020 +0000 linux/amd64

Does this issue reproduce with the latest release?

Yes, as of commit 1b08ace

What did you do?

$ 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){}
}

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:

type x struct {
  a
  b
}

type y struct {
  x
  c
}

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions