]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.unified] cmd/compile: export/import implicit attribute for conversion exprs
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Mon, 6 Jun 2022 15:23:48 +0000 (22:23 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Mon, 6 Jun 2022 19:21:04 +0000 (19:21 +0000)
So they can be formatted more presicely, and make it easier in the
transition to Unified IR.

Updates #53058

Change-Id: I8b5a46db05a2e2822289458995b8653f0a3ffbbe
Reviewed-on: https://go-review.googlesource.com/c/go/+/410594
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>

src/cmd/compile/internal/typecheck/iexport.go
src/cmd/compile/internal/typecheck/iimport.go
test/fixedbugs/issue42284.dir/b.go
test/run.go

index fa0e292ed26fe19790046a5972d2096f87b068a1..43ec7b80a096336d4237a6f6529609b7ae0d800d 100644 (file)
@@ -1978,6 +1978,7 @@ func (w *exportWriter) expr(n ir.Node) {
                w.pos(n.Pos())
                w.typ(n.Type())
                w.expr(n.X)
+               w.bool(n.Implicit())
 
        case ir.OREAL, ir.OIMAG, ir.OCAP, ir.OCLOSE, ir.OLEN, ir.ONEW, ir.OPANIC:
                n := n.(*ir.UnaryExpr)
index 1968af7f1c3eb84d68eceb92e29a3ec5d8842fe8..96aaac6362f2b760fa1fc393a447c2bfc074c3e0 100644 (file)
@@ -1489,7 +1489,9 @@ func (r *importReader) node() ir.Node {
                return n
 
        case ir.OCONV, ir.OCONVIFACE, ir.OCONVIDATA, ir.OCONVNOP, ir.OBYTES2STR, ir.ORUNES2STR, ir.OSTR2BYTES, ir.OSTR2RUNES, ir.ORUNESTR, ir.OSLICE2ARRPTR:
-               return ir.NewConvExpr(r.pos(), op, r.typ(), r.expr())
+               n := ir.NewConvExpr(r.pos(), op, r.typ(), r.expr())
+               n.SetImplicit(r.bool())
+               return n
 
        case ir.OCOPY, ir.OCOMPLEX, ir.OREAL, ir.OIMAG, ir.OAPPEND, ir.OCAP, ir.OCLOSE, ir.ODELETE, ir.OLEN, ir.OMAKE, ir.ONEW, ir.OPANIC, ir.ORECOVER, ir.OPRINT, ir.OPRINTN, ir.OUNSAFEADD, ir.OUNSAFESLICE:
                pos := r.pos()
index 652aa3212265a32964a027582abab46790f84fc1..8cd93b8db453f9c110849533b5d3c85692c2b039 100644 (file)
@@ -7,7 +7,7 @@ package b
 import "./a"
 
 func g() {
-       h := a.E() // ERROR "inlining call to a.E" "a.I\(a.T\(0\)\) does not escape"
+       h := a.E() // ERROR "inlining call to a.E" "T\(0\) does not escape"
        h.M()      // ERROR "devirtualizing h.M to a.T"
 
        // BAD: T(0) could be stack allocated.
index cb1622ccc9763d3504ce09efce109ea72662e2c4..8ef11020da963e1d6e8d2aa4b5bd0ddcc674ebf6 100644 (file)
@@ -1998,7 +1998,6 @@ var unifiedFailures = setOf(
        "inline.go",    // unified IR reports function literal diagnostics on different lines than -d=inlfuncswithclosures
        "linkname3.go", // unified IR is missing some linkname errors
 
-       "fixedbugs/issue42284.go",  // prints "T(0) does not escape", but test expects "a.I(a.T(0)) does not escape"
        "fixedbugs/issue7921.go",   // prints "… escapes to heap", but test expects "string(…) escapes to heap"
        "typeparam/issue47631.go",  // unified IR can handle local type declarations
        "fixedbugs/issue42058a.go", // unified IR doesn't report channel element too large