mirror of
https://github.com/golang/go
synced 2024-11-17 23:04:56 -07:00
c4f87ed26f
Some special-case code paths in order.go didn't expect OCALLFUNC to have Ninit; in particular, OAS2FUNC and ODEFER/OGO failed to call o.init on their child OCALLFUNC node. This resulted in not all of the AST being properly ordered. This was noticed because order is responsible for introducing an invariant around how OAPPEND is used, which is enforced by walk. However, there were perhaps simpler cases (e.g., simple order of evaluation) that were being silently miscompiled. Fixes #31010. Change-Id: Ib928890ab5ec2aebd8e30a030bc2b404387f9123 Reviewed-on: https://go-review.googlesource.com/c/go/+/169257 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
25 lines
364 B
Go
25 lines
364 B
Go
// compile
|
|
|
|
// Copyright 2019 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
|
|
|
|
var (
|
|
x int
|
|
xs []int
|
|
)
|
|
|
|
func a([]int) (int, error)
|
|
|
|
func b() (int, error) {
|
|
return a(append(xs, x))
|
|
}
|
|
|
|
func c(int, error) (int, error)
|
|
|
|
func d() (int, error) {
|
|
return c(b())
|
|
}
|