diff --git a/go/types/types.go b/go/types/types.go index dc11adf..1bdd7f3 100644 --- a/go/types/types.go +++ b/go/types/types.go @@ -239,7 +239,6 @@ func (ctxt *exprTypeContext) exprType(n ast.Node, expectTuple bool, pkg string) _, t := ctxt.exprType(expr, false, pkg) if t.Kind == ast.Typ { debugp("expected value, got type %v", t) - t = badType } return obj, t @@ -310,7 +309,7 @@ func (ctxt *exprTypeContext) exprType(n ast.Node, expectTuple bool, pkg string) return nil, ctxt.certify(n.Elt, ast.Var, t.Pkg) case *ast.MapType: t := ctxt.certify(n.Value, ast.Var, t.Pkg) - if expectTuple { + if expectTuple && t.Kind != ast.Bad { return nil, ctxt.newType(MultiValue{[]ast.Expr{t.Node.(ast.Expr), predecl("bool")}}, ast.Var, t.Pkg) } return nil, t diff --git a/godef.go b/godef.go index 84f5ae3..ec7a034 100644 --- a/godef.go +++ b/godef.go @@ -103,7 +103,7 @@ func main() { case ast.Expr: if !*tflag { // try local declarations only - if obj, typ := types.ExprType(e, types.DefaultImporter, types.FileSet); obj != nil { + if obj, typ := types.ExprType(e, types.DefaultImporter, types.FileSet); obj != nil && typ.Kind != ast.Bad { done(obj, typ) } }