You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
./prog.go:8:4: cannot use x (type rune) as type int in assignment
Note the error (correctly) says rune, not int32. When we introduced rune and byte as aliases we were careful to preserve the right printing even though the two names were equivalent.
It appears the compiler does not extend the same courtesy to explicitly-defined aliases. If instead we use:
package main
func main() {
var (
x RUNE
y int
)
y = x
}
type RUNE = int32
Consider
(https://play.golang.org/p/gA4OC1S_718).
The compiler error is:
Note the error (correctly) says rune, not int32. When we introduced rune and byte as aliases we were careful to preserve the right printing even though the two names were equivalent.
It appears the compiler does not extend the same courtesy to explicitly-defined aliases. If instead we use:
(https://play.golang.org/p/_7cffE6QOjo).
then the compiler error is:
It should say RUNE not int32.
The text was updated successfully, but these errors were encountered: