diff --git a/internal/core/adt/expr.go b/internal/core/adt/expr.go index 0a5002859..a6c1cd4a2 100644 --- a/internal/core/adt/expr.go +++ b/internal/core/adt/expr.go @@ -1711,10 +1711,6 @@ func (x *BuiltinValidator) Source() ast.Node { return x.Src.Source() } -func (x *BuiltinValidator) Pos() token.Pos { - return Pos(x) -} - func (x *BuiltinValidator) Kind() Kind { return x.Builtin.Params[0].Kind() } diff --git a/internal/pkg/builtin.go b/internal/pkg/builtin.go index 1f285f1c1..baa3243dd 100644 --- a/internal/pkg/builtin.go +++ b/internal/pkg/builtin.go @@ -241,12 +241,12 @@ func processErr(call *CallCtxt, errVal interface{}, ret adt.Expr) adt.Expr { case string, fmt.Stringer: // A string or a stringer likely used as a panic value. ret = wrapCallErr(call, &adt.Bottom{ - Err: errors.Newf(call.Pos(), "%s", err), + Err: errors.Newf(call.ctx.Pos(), "%s", err), }) default: // Some other value used when panicking; likely a bug. ret = wrapCallErr(call, &adt.Bottom{ - Err: errors.Newf(call.Pos(), "BUG: non-stringifiable %T", err), + Err: errors.Newf(call.ctx.Pos(), "BUG: non-stringifiable %T", err), }) } return ret diff --git a/internal/pkg/context.go b/internal/pkg/context.go index ca7f61eac..07be918b2 100644 --- a/internal/pkg/context.go +++ b/internal/pkg/context.go @@ -22,7 +22,6 @@ import ( "github.com/cockroachdb/apd/v3" "cuelang.org/go/cue" - "cuelang.org/go/cue/token" "cuelang.org/go/internal/core/adt" "cuelang.org/go/internal/value" ) @@ -38,10 +37,6 @@ type CallCtxt struct { args []adt.Value } -func (c *CallCtxt) Pos() token.Pos { - return c.ctx.Pos() -} - func (c *CallCtxt) Name() string { return c.builtin.name(c.ctx) } diff --git a/internal/pkg/errors.go b/internal/pkg/errors.go index d374fb9f5..4c06c2ae5 100644 --- a/internal/pkg/errors.go +++ b/internal/pkg/errors.go @@ -48,7 +48,7 @@ func (c *CallCtxt) errf(underlying error, format string, args ...interface{}) { case error: errs = errors.Promote(x, "") } - vErr := c.ctx.NewPosf(c.Pos(), format, args...) + vErr := c.ctx.NewPosf(c.ctx.Pos(), format, args...) c.Err = &callError{&adt.Bottom{Code: code, Err: errors.Wrap(vErr, errs)}} }