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
Type checking doesn't enter the body of the third loop because the range operand has the wrong type and the var y was declared with := not assigned with =. It should probably try harder; e.g., declare the variable y with type Invalid. (See also Google internal bug #19639588.)
package main
func main() {
for y := range "" {
_ = "" + 1 // type error => body was type-checked
}
for range 1 {
_ = "" + 1 // type error => body was type-checked
}
for y := range 1 {
_ = "" + 1 // no type error => body not type-checked
}
}
The text was updated successfully, but these errors were encountered:
Type checking doesn't enter the body of the third loop because the range operand has the wrong type and the var y was declared with := not assigned with =. It should probably try harder; e.g., declare the variable y with type Invalid. (See also Google internal bug #19639588.)
package main
func main() {
for y := range "" {
_ = "" + 1 // type error => body was type-checked
}
for range 1 {
_ = "" + 1 // type error => body was type-checked
}
for y := range 1 {
_ = "" + 1 // no type error => body not type-checked
}
}
The text was updated successfully, but these errors were encountered: