Commit 5e0278b7 authored by Ian Lance Taylor's avatar Ian Lance Taylor

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
parent 5a54696d
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment