aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2021-09-03 10:49:32 +0700
committerCuong Manh Le <cuong.manhle.vn@gmail.com>2021-09-09 04:37:47 +0000
commit376a079762bf8db387510d50ed718ec1259d1b7c (patch)
treec620005686f2c3abcf5f0443ea0c4d6385f5d564 /test
parent6edc57983a39b3cb911ea88b75a7ad39664383ec (diff)
downloadgo-376a079762bf8db387510d50ed718ec1259d1b7c.tar.gz
go-376a079762bf8db387510d50ed718ec1259d1b7c.zip
cmd/compile: fix unified IR panic when expanding nested inline function
When reading body of inlining function, which has another inlined function in the body, the reader still add this inlined function to todoBodies, which it shouldn't because the inlined function was read already. To fix this, introduce new flag to signal that we are done construting all functions in todoBodies, thus the addBody shouldn't add anything to todoBodies then. Updates #48094 Change-Id: I45105dd518f0a7b69c6dcbaf23b957623f271203 Reviewed-on: https://go-review.googlesource.com/c/go/+/347529 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'test')
-rw-r--r--test/typeparam/issue48094b.dir/a.go8
-rw-r--r--test/typeparam/issue48094b.dir/b.go9
-rw-r--r--test/typeparam/issue48094b.go7
3 files changed, 24 insertions, 0 deletions
diff --git a/test/typeparam/issue48094b.dir/a.go b/test/typeparam/issue48094b.dir/a.go
new file mode 100644
index 0000000000..a113a224f7
--- /dev/null
+++ b/test/typeparam/issue48094b.dir/a.go
@@ -0,0 +1,8 @@
+// Copyright 2021 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 a
+
+func F() { G(0) }
+func G[T any](t T) {}
diff --git a/test/typeparam/issue48094b.dir/b.go b/test/typeparam/issue48094b.dir/b.go
new file mode 100644
index 0000000000..242b34aa31
--- /dev/null
+++ b/test/typeparam/issue48094b.dir/b.go
@@ -0,0 +1,9 @@
+// Copyright 2021 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 b
+
+import "./a"
+
+func H() { a.F() }
diff --git a/test/typeparam/issue48094b.go b/test/typeparam/issue48094b.go
new file mode 100644
index 0000000000..b83fbd7af1
--- /dev/null
+++ b/test/typeparam/issue48094b.go
@@ -0,0 +1,7 @@
+// compiledir
+
+// Copyright 2021 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 ignored