Consider

type Int int
var y int = Int(3)

The spec says

A value x is assignable to a variable 
<https://golang.org/ref/spec#Variables> of type T ("x is assignable to T") 
if one of the following conditions applies:


   - x's type V and T have identical underlying types 
      <https://golang.org/ref/spec#Types> and at least one of V or T is not 
      a defined <https://golang.org/ref/spec#Type_definitions> type.
      - [other conditions]
   

Here, x's type V is Int, whose underlying type is int, so the underlying 
types are the same. And one of V and T (namely, T, which is int) is not a 
defined type.


So the spec says the assignment should work. But the playground says


cannot use Int(3) (type Int) as type int in assignment


-- 
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