mirror of
https://github.com/golang/go
synced 2024-11-25 08:47:56 -07:00
go/types: generate literals.go from corresponding types2 source
Change-Id: I0635101b984725ee24c2207ebfdb413d29212b67 Reviewed-on: https://go-review.googlesource.com/c/go/+/610558 Reviewed-by: Tim King <taking@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
aca0e2bb27
commit
e3f3083113
@ -136,9 +136,15 @@ var filemap = map[string]action{
|
||||
// "initorder.go": fixErrErrorfCall, // disabled for now due to unresolved error_ use implications for gopls
|
||||
"instantiate.go": func(f *ast.File) { fixTokenPos(f); fixCheckErrorfCall(f) },
|
||||
"instantiate_test.go": func(f *ast.File) { renameImportPath(f, `"cmd/compile/internal/types2"->"go/types"`) },
|
||||
"lookup.go": func(f *ast.File) { fixTokenPos(f) },
|
||||
"main_test.go": nil,
|
||||
"map.go": nil,
|
||||
"literals.go": func(f *ast.File) {
|
||||
renameImportPath(f, `"cmd/compile/internal/syntax"->"go/ast"`)
|
||||
renameSelectorExprs(f, "syntax.Name->ast.Ident", "key.Value->key.Name", "atyp.Elem->atyp.Elt") // must happen before renaming identifiers
|
||||
renameIdents(f, "syntax->ast")
|
||||
renameSelectors(f, "ElemList->Elts")
|
||||
},
|
||||
"lookup.go": func(f *ast.File) { fixTokenPos(f) },
|
||||
"main_test.go": nil,
|
||||
"map.go": nil,
|
||||
"mono.go": func(f *ast.File) {
|
||||
fixTokenPos(f)
|
||||
insertImportPath(f, `"go/ast"`)
|
||||
|
@ -1,3 +1,6 @@
|
||||
// Code generated by "go test -run=Generate -write=all"; DO NOT EDIT.
|
||||
// Source: ../../cmd/compile/internal/types2/literals.go
|
||||
|
||||
// Copyright 2024 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.
|
||||
@ -81,7 +84,7 @@ func (check *Checker) compositeLit(T *target, x *operand, e *ast.CompositeLit, h
|
||||
check.errorf(kv, InvalidLitField, "invalid field name %s in struct literal", kv.Key)
|
||||
continue
|
||||
}
|
||||
i := fieldIndex(utyp.fields, check.pkg, key.Name, false)
|
||||
i := fieldIndex(fields, check.pkg, key.Name, false)
|
||||
if i < 0 {
|
||||
var alt Object
|
||||
if j := fieldIndex(fields, check.pkg, key.Name, true); j >= 0 {
|
||||
@ -117,9 +120,7 @@ func (check *Checker) compositeLit(T *target, x *operand, e *ast.CompositeLit, h
|
||||
// i < len(fields)
|
||||
fld := fields[i]
|
||||
if !fld.Exported() && fld.pkg != check.pkg {
|
||||
check.errorf(x,
|
||||
UnexportedLitField,
|
||||
"implicit assignment to unexported field %s in struct literal of type %s", fld.name, base)
|
||||
check.errorf(x, UnexportedLitField, "implicit assignment to unexported field %s in struct literal of type %s", fld.name, base)
|
||||
continue
|
||||
}
|
||||
etyp := fld.typ
|
||||
|
Loading…
Reference in New Issue
Block a user