go/types: fix Eval to use correct file set when evaluating an expression

Change-Id: I221bd26cc90755de57c8f1941cabddd14d56584d
Reviewed-on: https://go-review.googlesource.com/10999
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
Robert Griesemer 2015-06-12 16:37:39 -07:00
parent 85ad76014a
commit d241a1448b
1 changed files with 1 additions and 5 deletions

View File

@ -65,11 +65,7 @@ func Eval(fset *token.FileSet, pkg *Package, pos token.Pos, expr string) (tv Typ
}
// parse expressions
// BUG(gri) In case of type-checking errors below, the type checker
// doesn't have the correct file set for expr. The correct
// solution requires a ParseExpr that uses the incoming
// file set fset.
node, err := parser.ParseExpr(expr)
node, err := parser.ParseExprFrom(fset, "eval", expr, 0)
if err != nil {
return TypeAndValue{}, err
}