You can definitely use parametric interfaces in type assertion expressions,
but you can't use interfaces with type lists.
I'm not sure exactly what you're trying to do in your example, but ISTM
that it could be somewhat simpler. You
only need one type parameter: https://go2goplay.golang.org/p/4E0ZnVxJwL9


On Thu, 10 Sep 2020 at 15:54, Viktor Kojouharov <vkojouha...@gmail.com>
wrote:

>
> Would using parametric interfaces be allowed in type assertion expressions
> / type switches?
>
> The current behavior in the go2go playground is for the compiler to return
> the error: "interface contains type constraints (T)" (
> https://go2goplay.golang.org/p/O1Un2Vm9Dh0)
> I was under the impression that since the outer function is already
> parametrised with the same type, this should work without a problem.
>
> Perhaps I'm missing something, but I currently don't see how one can check
> for optional interface implementations of generic types, since this error
> will pretty much stop them.
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/fbe50aaf-1794-4a17-9321-2b923f546d13n%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/fbe50aaf-1794-4a17-9321-2b923f546d13n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAJhgach9vJ_6Tcu8vceMBGyE9L26e20skKQykybuawY7az5Prg%40mail.gmail.com.

Reply via email to