Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
cmd/go2go: provide better error message when saying that type parameter cannot be embedded in interface #39948
What version of Go are you using (
The constraints on T and U don't restrict them to be interfaces just any type that satisfies the empty interface (which is all of them).
I don't know if there is a way to do this. If there is I would have expected
The type checking errors for the original program are:
That's correct. The type constraint for T is
In the current design draft there is no way to write a type constraint that says that a type must be an interface type. Whether this is a real problem depends on why people would want to write that requirement.
Closing because there is no issue. General discussion of the design draft should take place on golang-nuts, not on the issue tracker. Thanks.