-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
Generics: cannot union types with behavioral interfaces #49054
Labels
Comments
We've decided not to allow interfaces in unions, for the first version of generics at least. See #45346 (comment) |
Here is the compromise I came up with. It keeps the code as generic as it can at the cost of:
https://go.dev/play/p/NaEMP4hLBhq?v=gotip
I see this as a pattern that will likely crop up quite often. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
N/A: tip
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I attempted to make use of the
Stringish
example from the proposal:What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: