Description

Type check an ast.Expr to produce an Expr. Errors are accumulated and returned as a single slice. When evaluating constant expressions, non fatal truncation/overflow errors may be raised but type checking will continue. A common pattern to detect errors is

if expr, errs := CheckExpr(...); errs != nil && !expr.IsConst() {
  fatal
}

if expr.IsConst() is true, then the resulting Expr has been successfully checked, regardless of if errors are present.

CheckExpr is referenced in 0 repositories