1
0
mirror of https://github.com/golang/go synced 2024-11-11 23:50:22 -07:00

test: fix return.go to not use fallthrough in a type switch

The gc compiler only gives an error about fallthrough in a
type switch if it has not given any errors in an earlier pass.
Remove all functions in this test that use fallthrough in a
type switch because they don't test anything useful and they
cause gccgo to give unexpected errors.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12614043
This commit is contained in:
Ian Lance Taylor 2013-08-07 11:05:19 -07:00
parent 5a54696d78
commit 5e0278b7a0

View File

@ -666,17 +666,6 @@ func _() int {
}
}
func _() int {
print(1)
switch x.(type) {
case int:
print(2)
fallthrough
default:
return 4
}
}
// if no default or some case doesn't terminate, switch is no longer okay
func _() int {
@ -708,17 +697,6 @@ func _() int {
}
} // ERROR "missing return"
func _() int {
print(1)
switch x.(type) {
case int:
print(2)
fallthrough
case float64:
return 4
}
} // ERROR "missing return"
func _() int {
print(1)
switch x.(type) {
@ -1356,16 +1334,6 @@ func _() int {
}
}
func _() int {
switch x.(type) {
case int:
print(2)
fallthrough
default:
return 4
}
}
// if no default or some case doesn't terminate, switch is no longer okay
func _() int {
@ -1394,16 +1362,6 @@ func _() int {
}
} // ERROR "missing return"
func _() int {
switch x.(type) {
case int:
print(2)
fallthrough
case float64:
return 4
}
} // ERROR "missing return"
func _() int {
switch x.(type) {
case int:
@ -2102,17 +2060,6 @@ var _ = func() int {
}
}
var _ = func() int {
print(1)
switch x.(type) {
case int:
print(2)
fallthrough
default:
return 4
}
}
// if no default or some case doesn't terminate, switch is no longer okay
var _ = func() int {
@ -2144,17 +2091,6 @@ var _ = func() int {
}
} // ERROR "missing return"
var _ = func() int {
print(1)
switch x.(type) {
case int:
print(2)
fallthrough
case float64:
return 4
}
} // ERROR "missing return"
var _ = func() int {
print(1)
switch x.(type) {
@ -2792,16 +2728,6 @@ var _ = func() int {
}
}
var _ = func() int {
switch x.(type) {
case int:
print(2)
fallthrough
default:
return 4
}
}
// if no default or some case doesn't terminate, switch is no longer okay
var _ = func() int {
@ -2830,16 +2756,6 @@ var _ = func() int {
}
} // ERROR "missing return"
var _ = func() int {
switch x.(type) {
case int:
print(2)
fallthrough
case float64:
return 4
}
} // ERROR "missing return"
var _ = func() int {
switch x.(type) {
case int: