mirror of
https://github.com/golang/go.git
synced 2026-04-03 09:49:56 +09:00
When reading multiple promoted fields in a struct literal from UIR, don't overwrite the (top-level) struct literal type needed for the next field. Fixes #78262. For #9859. Change-Id: Ifac64537bebcb7dbb79a6173d0cd032cbf0b8ed8 Reviewed-on: https://go-review.googlesource.com/c/go/+/757225 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
28 lines
379 B
Go
28 lines
379 B
Go
// run
|
|
|
|
// Copyright 2026 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 main
|
|
|
|
type A struct {
|
|
a int
|
|
B
|
|
}
|
|
|
|
type B struct {
|
|
b int
|
|
C
|
|
}
|
|
|
|
type C struct {
|
|
c int
|
|
}
|
|
|
|
func main() {
|
|
_ = A{a: 1, b: 2}
|
|
_ = A{a: 1, c: 3}
|
|
_ = A{a: 1, b: 2, c: 3} // don't panic during compilation
|
|
}
|