Looks the non-omitted "true" is also a typed value of "bool" type.

package main

type T bool

func f() T {return T(false)}

func main() {
    switch true {
    case f(): // invalid case f() in switch (mismatched types T and bool)
    }
}

On Friday, February 2, 2018 at 10:11:31 AM UTC-5, di...@veryhaha.com wrote:
>
> Why not make it untyped?
>
> package main
>
> type T bool
>
> func f() T {return T(false)}
>
> func main() {
>     switch {
>     case f(): // invalid case f() in switch (mismatched types T and bool)
>     }
> }
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to