Commit 82d1a9dc authored by Robert Griesemer's avatar Robert Griesemer

go/printer: more accurate comment for incomplete structs/interfaces

A struct or interface type node is marked incomplete if fields or
methods have been removed through any kind of filtering, not just
because entries are not exported.

The current message was misleading in some cases (for instance:
"godoc -src reflect Implements").

This CL requires CL 4527050 .

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/4529054
parent d376935a
......@@ -439,7 +439,7 @@ func (p *printer) fieldList(fields *ast.FieldList, isStruct, isIncomplete bool)
p.print(formfeed)
}
p.flush(p.fset.Position(rbrace), token.RBRACE) // make sure we don't loose the last line comment
p.setLineComment("// contains unexported fields")
p.setLineComment("// contains filtered or unexported fields")
}
} else { // interface
......@@ -466,7 +466,7 @@ func (p *printer) fieldList(fields *ast.FieldList, isStruct, isIncomplete bool)
p.print(formfeed)
}
p.flush(p.fset.Position(rbrace), token.RBRACE) // make sure we don't loose the last line comment
p.setLineComment("// contains unexported methods")
p.setLineComment("// contains filtered or unexported methods")
}
}
......
......@@ -8,7 +8,7 @@ type SZ struct{}
// The S0 struct; no field is exported.
type S0 struct {
// contains unexported fields
// contains filtered or unexported fields
}
// The S1 struct; some fields are not exported.
......@@ -16,7 +16,7 @@ type S1 struct {
S0
A, B, C float // 3 exported fields
D int // 2 unexported fields
// contains unexported fields
// contains filtered or unexported fields
}
// The S2 struct; all fields are exported.
......@@ -30,14 +30,14 @@ type SZ interface{}
// The I0 interface; no method is exported.
type I0 interface {
// contains unexported methods
// contains filtered or unexported methods
}
// The I1 interface; some methods are not exported.
type I1 interface {
I0
F(x float) float // exported methods
// contains unexported methods
// contains filtered or unexported methods
}
// The I2 interface; all methods are exported.
......@@ -53,5 +53,5 @@ type S3 struct {
F1 int // line comment for F1
// lead comment for F2
F2 int // line comment for F2
// contains unexported fields
// contains filtered or unexported fields
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment