mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
all: merge dev.typealias into master
For #18130.f8b4123613[dev.typealias] spec: use term 'embedded field' rather than 'anonymous field'9ecc3ee252[dev.typealias] cmd/compile: avoid false positive cycles from type aliases49b7af8a30[dev.typealias] reflect: add test for type aliases9bbb07ddec[dev.typealias] cmd/compile, reflect: fix struct field names for embedded byte, rune43c7094386[dev.typealias] reflect: fix StructOf use of StructField to match StructField docs9657e0b077[dev.typealias] cmd/doc: update for type aliasde2e5459ae[dev.typealias] cmd/compile: declare methods after resolving receiver type9259f3073a[dev.typealias] test: match gccgo error messages on alias2.go5d92916770[dev.typealias] cmd/compile: change Func.Shortname to *Syma7c884efc1[dev.typealias] go/internal/gccgoimporter: support for type aliases5802cfd900[dev.typealias] cmd/compile: export/import test cases for type aliasesd7cabd40dd[dev.typealias] go/types: clarified doc stringcc2dcce3d7[dev.typealias] cmd/compile: a few better comments related to alias types5c160b28ba[dev.typealias] cmd/compile: improved error message for cyles involving type aliasesb2386dffa1[dev.typealias] cmd/compile: type-check type alias declarationsac8421f9a5[dev.typealias] cmd/compile: various minor cleanupsf011e0c6c3[dev.typealias] cmd/compile, go/types, go/importer: various alias related fixes49de5f0351[dev.typealias] cmd/compile, go/importer: define export format and implement importing of type aliases5ceec42dc0[dev.typealias] go/types: export TypeName.IsAlias so clients can use itaa1f0681bc[dev.typealias] go/types: improved Object printingc80748e389[dev.typealias] go/types: remove some more vestiges of prior alias implementation80d8b69e95[dev.typealias] go/types: implement type aliasesa917097b5e[dev.typealias] go/build: add go1.9 build tag3e11940437[dev.typealias] cmd/compile: recognize type aliases but complain for now (not yet supported)e0a05c274a[dev.typealias] cmd/gofmt: added test cases for alias type declarations2e5116bd99[dev.typealias] go/ast, go/parser, go/printer, go/types: initial type alias support Change-Id: Ia65f2e011fd7195f18e1dce67d4d49b80a261203
This commit is contained in:
commit
c47df7ae17
63 changed files with 1335 additions and 840 deletions
|
|
@ -340,13 +340,16 @@ func Main() {
|
|||
// Phase 1: const, type, and names and types of funcs.
|
||||
// This will gather all the information about types
|
||||
// and methods but doesn't depend on any of it.
|
||||
// We also defer type alias declarations until phase 2
|
||||
// to avoid cycles like #18640.
|
||||
defercheckwidth()
|
||||
|
||||
// Don't use range--typecheck can add closures to xtop.
|
||||
timings.Start("fe", "typecheck", "top1")
|
||||
for i := 0; i < len(xtop); i++ {
|
||||
if xtop[i].Op != ODCL && xtop[i].Op != OAS && xtop[i].Op != OAS2 {
|
||||
xtop[i] = typecheck(xtop[i], Etop)
|
||||
n := xtop[i]
|
||||
if op := n.Op; op != ODCL && op != OAS && op != OAS2 && (op != ODCLTYPE || !n.Left.Name.Param.Alias) {
|
||||
xtop[i] = typecheck(n, Etop)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -356,8 +359,9 @@ func Main() {
|
|||
// Don't use range--typecheck can add closures to xtop.
|
||||
timings.Start("fe", "typecheck", "top2")
|
||||
for i := 0; i < len(xtop); i++ {
|
||||
if xtop[i].Op == ODCL || xtop[i].Op == OAS || xtop[i].Op == OAS2 {
|
||||
xtop[i] = typecheck(xtop[i], Etop)
|
||||
n := xtop[i]
|
||||
if op := n.Op; op == ODCL || op == OAS || op == OAS2 || op == ODCLTYPE && n.Left.Name.Param.Alias {
|
||||
xtop[i] = typecheck(n, Etop)
|
||||
}
|
||||
}
|
||||
resumecheckwidth()
|
||||
|
|
@ -367,8 +371,9 @@ func Main() {
|
|||
timings.Start("fe", "typecheck", "func")
|
||||
var fcount int64
|
||||
for i := 0; i < len(xtop); i++ {
|
||||
if xtop[i].Op == ODCLFUNC || xtop[i].Op == OCLOSURE {
|
||||
Curfn = xtop[i]
|
||||
n := xtop[i]
|
||||
if op := n.Op; op == ODCLFUNC || op == OCLOSURE {
|
||||
Curfn = n
|
||||
decldepth = 1
|
||||
saveerrors()
|
||||
typecheckslice(Curfn.Nbody.Slice(), Etop)
|
||||
|
|
@ -460,8 +465,9 @@ func Main() {
|
|||
timings.Start("be", "compilefuncs")
|
||||
fcount = 0
|
||||
for i := 0; i < len(xtop); i++ {
|
||||
if xtop[i].Op == ODCLFUNC {
|
||||
funccompile(xtop[i])
|
||||
n := xtop[i]
|
||||
if n.Op == ODCLFUNC {
|
||||
funccompile(n)
|
||||
fcount++
|
||||
}
|
||||
}
|
||||
|
|
@ -924,7 +930,7 @@ func mkpackage(pkgname string) {
|
|||
continue
|
||||
}
|
||||
|
||||
if s.Def.Sym != s && s.Flags&SymAlias == 0 {
|
||||
if s.isAlias() {
|
||||
// throw away top-level name left over
|
||||
// from previous import . "x"
|
||||
if s.Def.Name != nil && s.Def.Name.Pack != nil && !s.Def.Name.Pack.Used && nsyntaxerrors == 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue