diff options
| author | Cuong Manh Le <cuong.manhle.vn@gmail.com> | 2026-03-04 17:05:30 +0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2026-03-06 10:31:15 -0800 |
| commit | 73db2f85aab25c06f47c832364600d2c5e243ffa (patch) | |
| tree | 3df4770561b624a4a6948eb954a5f420cf5eb9d4 /src | |
| parent | bf1b0973db38346afae460e80d18020fa7de4e8c (diff) | |
| download | go-73db2f85aab25c06f47c832364600d2c5e243ffa.tar.xz | |
cmd/compile: remove left over constant checking
Updates #77919
Change-Id: I300025cbfc1baf95dacde0ef66bd4b13484f2aa4
Reviewed-on: https://go-review.googlesource.com/c/go/+/751380
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/compile/internal/typecheck/expr.go | 5 | ||||
| -rw-r--r-- | src/cmd/compile/internal/typecheck/func.go | 14 |
2 files changed, 0 insertions, 19 deletions
diff --git a/src/cmd/compile/internal/typecheck/expr.go b/src/cmd/compile/internal/typecheck/expr.go index 7dc29636cc..53c291291f 100644 --- a/src/cmd/compile/internal/typecheck/expr.go +++ b/src/cmd/compile/internal/typecheck/expr.go @@ -6,7 +6,6 @@ package typecheck import ( "fmt" - "go/constant" "internal/types/errors" "strings" @@ -846,10 +845,6 @@ func tcStringHeader(n *ir.StringHeaderExpr) ir.Node { n.Ptr = Expr(n.Ptr) n.Len = DefaultLit(Expr(n.Len), types.Types[types.TINT]) - if ir.IsConst(n.Len, constant.Int) && ir.Int64Val(n.Len) < 0 { - base.Fatalf("len for OSTRINGHEADER must be non-negative") - } - return n } diff --git a/src/cmd/compile/internal/typecheck/func.go b/src/cmd/compile/internal/typecheck/func.go index 5765731546..79093e5194 100644 --- a/src/cmd/compile/internal/typecheck/func.go +++ b/src/cmd/compile/internal/typecheck/func.go @@ -12,7 +12,6 @@ import ( "fmt" "go/constant" - "go/token" ) // MakeDotArgs package all the arguments that match a ... T parameter into a []T. @@ -564,11 +563,6 @@ func tcMake(n *ir.CallExpr) ir.Node { n.SetType(nil) return n } - if ir.IsConst(l, constant.Int) && r != nil && ir.IsConst(r, constant.Int) && constant.Compare(l.Val(), token.GTR, r.Val()) { - base.Errorf("len larger than cap in make(%v)", t) - n.SetType(nil) - return n - } nn = ir.NewMakeExpr(n.Pos(), ir.OMAKESLICE, l, r) case types.TMAP: @@ -655,14 +649,6 @@ func tcMakeSliceCopy(n *ir.MakeExpr) ir.Node { base.Errorf("non-integer len argument in OMAKESLICECOPY") } - if ir.IsConst(n.Len, constant.Int) { - if ir.ConstOverflow(n.Len.Val(), types.Types[types.TINT]) { - base.Fatalf("len for OMAKESLICECOPY too large") - } - if constant.Sign(n.Len.Val()) < 0 { - base.Fatalf("len for OMAKESLICECOPY must be non-negative") - } - } return n } |
