diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/compile/internal/types2/decl.go | 14 | ||||
| -rw-r--r-- | src/internal/types/testdata/fixedbugs/issue59371.go | 7 |
2 files changed, 2 insertions, 19 deletions
diff --git a/src/cmd/compile/internal/types2/decl.go b/src/cmd/compile/internal/types2/decl.go index f7c6a8e573..dd39c42037 100644 --- a/src/cmd/compile/internal/types2/decl.go +++ b/src/cmd/compile/internal/types2/decl.go @@ -416,20 +416,6 @@ func (check *Checker) constDecl(obj *Const, typ, init syntax.Expr, inherited boo func (check *Checker) varDecl(obj *Var, lhs []*Var, typ, init syntax.Expr) { assert(obj.typ == nil) - // If we have undefined variable types due to errors, - // mark variables as used to avoid follow-on errors. - // Matches compiler behavior. - defer func() { - if obj.typ == Typ[Invalid] { - obj.used = true - } - for _, lhs := range lhs { - if lhs.typ == Typ[Invalid] { - lhs.used = true - } - } - }() - // determine type, if any if typ != nil { obj.typ = check.varType(typ) diff --git a/src/internal/types/testdata/fixedbugs/issue59371.go b/src/internal/types/testdata/fixedbugs/issue59371.go index d60810a6f0..d5b4db6a85 100644 --- a/src/internal/types/testdata/fixedbugs/issue59371.go +++ b/src/internal/types/testdata/fixedbugs/issue59371.go @@ -12,9 +12,6 @@ func _() { func _() { var ok = undef /* ERROR "undefined: undef" */ - x, ok := m[0] // must not crash - _ = x - // The next line is only needed for go/types, not types2. - // TODO(gri) find cause and fix - _ = ok + x, ok := m[0] // must not crash + _, _ = x, ok } |
