import (
"fmt"
"go/ast"
+ "go/token"
"strings"
)
} else if len(rhs) > 0 {
at = rhs[len(rhs)-1].expr // report at last value
}
- check.errorf(at, _WrongResultCount, "%s return values\n\thave %s\n\twant %s",
- qualifier,
- check.typesSummary(operandTypes(rhs), false),
- check.typesSummary(varTypes(lhs), false),
- )
+ err := newErrorf(at, _WrongResultCount, "%s return values", qualifier)
+ err.errorf(token.NoPos, "have %s", check.typesSummary(operandTypes(rhs), false))
+ err.errorf(token.NoPos, "want %s", check.typesSummary(varTypes(lhs), false))
+ check.report(err)
return
}
if compilerErrorMessages {
if sig.params != nil {
params = sig.params.vars
}
- check.errorf(at, _WrongArgCount, "%s arguments in call to %s\n\thave %s\n\twant %s",
- qualifier, call.Fun,
- check.typesSummary(operandTypes(args), false),
- check.typesSummary(varTypes(params), sig.variadic),
- )
+ err := newErrorf(at, _WrongArgCount, "%s arguments in call to %s", qualifier, call.Fun)
+ err.errorf(token.NoPos, "have %s", check.typesSummary(operandTypes(args), false))
+ err.errorf(token.NoPos, "want %s", check.typesSummary(varTypes(params), sig.variadic))
+ check.report(err)
return
}
import (
"go/constant"
+ "go/token"
"unicode"
)
if compilerErrorMessages {
if cause != "" {
// Add colon at end of line if we have a following cause.
- check.errorf(x, _InvalidConversion, "cannot convert %s to type %s:\n\t%s", x, T, cause)
+ err := newErrorf(x, _InvalidConversion, "cannot convert %s to type %s:", x, T)
+ err.errorf(token.NoPos, cause)
+ check.report(err)
} else {
check.errorf(x, _InvalidConversion, "cannot convert %s to type %s", x, T)
}