go/types already does this, if slightly differently.
Change-Id: I9cf5f493714d865deec5ad23e2ee9b5c5d3f2f0c
Reviewed-on: https://go-review.googlesource.com/c/go/+/475197
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
"cmd/compile/internal/syntax"
"fmt"
"go/constant"
+ . "internal/types/errors"
"strings"
)
Msg string // default error message, user-friendly
Full string // full error message, for debugging (may contain internal details)
Soft bool // if set, error is "soft"
+ Code Code // error code
}
// Error returns an error string formatted as follows:
pos = check.errpos
}
- err := Error{pos, stripAnnotations(msg), msg, soft}
+ err := Error{pos, stripAnnotations(msg), msg, soft, code}
if check.firstErr == nil {
check.firstErr = err
}