From: Cuong Manh Le Date: Tue, 7 Jun 2022 07:57:11 +0000 (+0700) Subject: [dev.unified] test: relax issue7921.go diagnostic message X-Git-Tag: go1.20rc1~1807^2~65 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1a6c96bb9b;p=gostls13.git [dev.unified] test: relax issue7921.go diagnostic message For constants literal, iimport/iexport read/write them as basic literal nodes. So they are printed in diagnostic message as Go syntax. So "foo" will be reported as string("foo"). Unified IR read/write the raw expression as string value, and when printed in diagnostic, the string value is written out exactly as-is, so "foo" will be written as "foo". Thus, this CL relax the test in issue7921.go to match the string value only. Updates #53058 Change-Id: I6fcf4fdcfc4b3be91cb53b081c48bd57186d8f35 Reviewed-on: https://go-review.googlesource.com/c/go/+/410795 Reviewed-by: Cherry Mui Run-TryBot: Cuong Manh Le Reviewed-by: Keith Randall TryBot-Result: Gopher Robot Reviewed-by: Keith Randall --- diff --git a/src/cmd/compile/internal/noder/helpers.go b/src/cmd/compile/internal/noder/helpers.go index 33acd6051a..8efcef26cf 100644 --- a/src/cmd/compile/internal/noder/helpers.go +++ b/src/cmd/compile/internal/noder/helpers.go @@ -39,10 +39,6 @@ func typed(typ *types.Type, n ir.Node) ir.Node { // Values -func Const(pos src.XPos, typ *types.Type, val constant.Value) ir.Node { - return typed(typ, ir.NewBasicLit(pos, val)) -} - func OrigConst(pos src.XPos, typ *types.Type, val constant.Value, op ir.Op, raw string) ir.Node { orig := ir.NewRawOrigExpr(pos, op, raw) return ir.NewConstExpr(val, typed(typ, orig)) diff --git a/test/fixedbugs/issue7921.go b/test/fixedbugs/issue7921.go index 65be4b5bbe..f9efb7f55d 100644 --- a/test/fixedbugs/issue7921.go +++ b/test/fixedbugs/issue7921.go @@ -41,7 +41,7 @@ func bufferNoEscape3(xs []string) string { // ERROR "xs does not escape$" func bufferNoEscape4() []byte { var b bytes.Buffer - b.Grow(64) // ERROR "bufferNoEscape4 ignoring self-assignment in bytes.b.buf = bytes.b.buf\[:bytes.m\]$" "inlining call to bytes.\(\*Buffer\).Grow$" "string\(.*\) escapes to heap" + b.Grow(64) // ERROR "bufferNoEscape4 ignoring self-assignment in bytes.b.buf = bytes.b.buf\[:bytes.m\]$" "inlining call to bytes.\(\*Buffer\).Grow$" `".+" escapes to heap` useBuffer(&b) return b.Bytes() // ERROR "inlining call to bytes.\(\*Buffer\).Bytes$" } diff --git a/test/run.go b/test/run.go index 866654629e..ff3cc1aabb 100644 --- a/test/run.go +++ b/test/run.go @@ -1997,7 +1997,6 @@ var unifiedFailures = setOf( "escape4.go", // unified IR can inline f5 and f6; test doesn't expect this "inline.go", // unified IR reports function literal diagnostics on different lines than -d=inlfuncswithclosures - "fixedbugs/issue7921.go", // prints "… escapes to heap", but test expects "string(…) escapes to heap" "typeparam/issue47631.go", // unified IR can handle local type declarations )