]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.unified] test: relax issue7921.go diagnostic message
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Tue, 7 Jun 2022 07:57:11 +0000 (14:57 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Thu, 9 Jun 2022 01:34:45 +0000 (01:34 +0000)
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 <cherryyz@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/noder/helpers.go
test/fixedbugs/issue7921.go
test/run.go

index 33acd6051ace8050aaf096b621cd4f9674f06741..8efcef26cf24162f1cf93d0dd9faa8decdb322c8 100644 (file)
@@ -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))
index 65be4b5bbee8d1e73443fbfb6859d76655fb903d..f9efb7f55dd4630e73617952407e7c1a22605fdf 100644 (file)
@@ -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$"
 }
index 866654629e9186be869c1cf53aba8381797408c5..ff3cc1aabb692ea448611cdf8c28025aa77c4214 100644 (file)
@@ -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
 )