go.tools/go/types: clean up internal iota in all cases
R=dsymonds CC=golang-dev https://golang.org/cl/33570043
This commit is contained in:
parent
3d343e42d1
commit
62a3fc7538
|
|
@ -661,6 +661,7 @@ func (check *checker) constDecl(obj *Const, typ, init ast.Expr) {
|
|||
if !isConstType(t) {
|
||||
check.errorf(typ.Pos(), "invalid constant type %s", t)
|
||||
obj.typ = Typ[Invalid]
|
||||
check.iota = nil
|
||||
return
|
||||
}
|
||||
obj.typ = t
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ const c0 = x /* ERROR "not constant" */
|
|||
// typed constants must have constant types
|
||||
const _ interface /* ERROR invalid constant type */ {} = 0
|
||||
|
||||
func _ () {
|
||||
const _ interface /* ERROR invalid constant type */ {} = 0
|
||||
for i := 0; i < 10; i++ {} // don't crash with non-nil iota here
|
||||
}
|
||||
|
||||
// untyped constants
|
||||
const (
|
||||
// boolean values
|
||||
|
|
|
|||
Loading…
Reference in New Issue