mirror of
https://github.com/golang/go.git
synced 2026-04-03 17:59:55 +09:00
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>
This commit is contained in:
committed by
Gopher Robot
parent
bf1b0973db
commit
73db2f85aa
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user