Commit 91c8e5f8 authored by Russ Cox's avatar Russ Cox

cmd/compile: fix export type conversion loss in inlined func body

Fixes #12677.

Change-Id: I72012f55615fcf5f4a16c054706c9bcd82e49ccd
Reviewed-on: https://go-review.googlesource.com/17817Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent a4028111
......@@ -1120,7 +1120,7 @@ func exprfmt(n *Node, prec int) string {
if n.Val().Ctype() == CTNIL && n.Orig != nil && n.Orig != n {
return exprfmt(n.Orig, prec)
}
if n.Type != nil && n.Type != Types[n.Type.Etype] && n.Type != idealbool && n.Type != idealstring {
if n.Type != nil && n.Type.Etype != TIDEAL && n.Type.Etype != TNIL && n.Type != idealbool && n.Type != idealstring {
// Need parens when type begins with what might
// be misinterpreted as a unary operator: * or <-.
if Isptr[n.Type.Etype] || (n.Type.Etype == TCHAN && n.Type.Chan == Crecv) {
......
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package p
func Baz(f int) float64 {
return 1 / float64(int(1)<<(uint(f)))
}
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package q
import "./p"
func f() { println(p.Baz(2)) }
// compiledir
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Issue 12677: Type loss during export/import of inlined function body.
package ignored
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment