diff --git a/src/cmd/compile/internal/types2/api.go b/src/cmd/compile/internal/types2/api.go index 74c549076d..49cc0e54ec 100644 --- a/src/cmd/compile/internal/types2/api.go +++ b/src/cmd/compile/internal/types2/api.go @@ -208,11 +208,19 @@ type Info struct { // // The Types map does not record the type of every identifier, // only those that appear where an arbitrary expression is - // permitted. For instance, the identifier f in a selector - // expression x.f is found only in the Selections map, the - // identifier z in a variable declaration 'var z int' is found - // only in the Defs map, and identifiers denoting packages in - // qualified identifiers are collected in the Uses map. + // permitted. For instance: + // - an identifier f in a selector expression x.f is found + // only in the Selections map; + // - an identifier z in a variable declaration 'var z int' + // is found only in the Defs map; + // - an identifier p denoting a package in a qualified + // identifier p.X is found only in the Uses map. + // + // Similarly, no type is recorded for the (synthetic) FuncType + // node in a FuncDecl.Type field, since there is no corresponding + // syntactic function type expression in the source in this case + // Instead, the function type is found in the Defs.map entry for + // the corresponding function declaration. Types map[syntax.Expr]TypeAndValue // If StoreTypesInSyntax is set, type information identical to diff --git a/src/go/types/api.go b/src/go/types/api.go index dea974bec8..beb2258c8b 100644 --- a/src/go/types/api.go +++ b/src/go/types/api.go @@ -217,11 +217,19 @@ type Info struct { // // The Types map does not record the type of every identifier, // only those that appear where an arbitrary expression is - // permitted. For instance, the identifier f in a selector - // expression x.f is found only in the Selections map, the - // identifier z in a variable declaration 'var z int' is found - // only in the Defs map, and identifiers denoting packages in - // qualified identifiers are collected in the Uses map. + // permitted. For instance: + // - an identifier f in a selector expression x.f is found + // only in the Selections map; + // - an identifier z in a variable declaration 'var z int' + // is found only in the Defs map; + // - an identifier p denoting a package in a qualified + // identifier p.X is found only in the Uses map. + // + // Similarly, no type is recorded for the (synthetic) FuncType + // node in a FuncDecl.Type field, since there is no corresponding + // syntactic function type expression in the source in this case + // Instead, the function type is found in the Defs.map entry for + // the corresponding function declaration. Types map[ast.Expr]TypeAndValue // Instances maps identifiers denoting generic types or functions to their