mirror of
https://github.com/golang/go
synced 2024-11-25 11:48:04 -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
|
// "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.go": func(f *ast.File) { fixTokenPos(f); fixCheckErrorfCall(f) },
|
||||||
"instantiate_test.go": func(f *ast.File) { renameImportPath(f, `"cmd/compile/internal/types2"->"go/types"`) },
|
"instantiate_test.go": func(f *ast.File) { renameImportPath(f, `"cmd/compile/internal/types2"->"go/types"`) },
|
||||||
"lookup.go": func(f *ast.File) { fixTokenPos(f) },
|
"literals.go": func(f *ast.File) {
|
||||||
"main_test.go": nil,
|
renameImportPath(f, `"cmd/compile/internal/syntax"->"go/ast"`)
|
||||||
"map.go": nil,
|
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) {
|
"mono.go": func(f *ast.File) {
|
||||||
fixTokenPos(f)
|
fixTokenPos(f)
|
||||||
insertImportPath(f, `"go/ast"`)
|
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.
|
// Copyright 2024 The Go Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// 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)
|
check.errorf(kv, InvalidLitField, "invalid field name %s in struct literal", kv.Key)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
i := fieldIndex(utyp.fields, check.pkg, key.Name, false)
|
i := fieldIndex(fields, check.pkg, key.Name, false)
|
||||||
if i < 0 {
|
if i < 0 {
|
||||||
var alt Object
|
var alt Object
|
||||||
if j := fieldIndex(fields, check.pkg, key.Name, true); j >= 0 {
|
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)
|
// i < len(fields)
|
||||||
fld := fields[i]
|
fld := fields[i]
|
||||||
if !fld.Exported() && fld.pkg != check.pkg {
|
if !fld.Exported() && fld.pkg != check.pkg {
|
||||||
check.errorf(x,
|
check.errorf(x, UnexportedLitField, "implicit assignment to unexported field %s in struct literal of type %s", fld.name, base)
|
||||||
UnexportedLitField,
|
|
||||||
"implicit assignment to unexported field %s in struct literal of type %s", fld.name, base)
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
etyp := fld.typ
|
etyp := fld.typ
|
||||||
|
Loading…
Reference in New Issue
Block a user