Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go2go: embedded type lists type checking seems incorrect #40961

Closed
tdakkota opened this issue Aug 21, 2020 · 1 comment
Closed

cmd/go2go: embedded type lists type checking seems incorrect #40961

tdakkota opened this issue Aug 21, 2020 · 1 comment

Comments

@tdakkota
Copy link

@tdakkota tdakkota commented Aug 21, 2020

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

$ go version
go version devel +12c2128b9e Fri Aug 21 00:12:31 2020 +0000 windows/amd64

Does this issue reproduce with the latest release?

n/a

What operating system and processor architecture are you using (go env)?

  • windows/amd64
  • go2go playground

What did you do?

https://go2goplay.golang.org/p/HClUuUkAS-m

What did you expect to see?

Successful compilation.
MyInt satisfies both type lists.

What did you see instead?

type checking failed for main
prog.go2:27:5: MyInt does not satisfy Sum (MyInt or int not found in ⊥)
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Aug 21, 2020

I believe this is working as intended. Embedding two interfaces with type lists gives you the intersection of the type lists, which in this example is the empty set. See https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md#type-lists-in-embedded-constraints .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.