]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: update doc at top of iexport.go on the changes for typeparams
authorDan Scales <danscales@google.com>
Mon, 20 Sep 2021 01:26:19 +0000 (18:26 -0700)
committerDan Scales <danscales@google.com>
Mon, 20 Sep 2021 16:20:33 +0000 (16:20 +0000)
Add in the documentation of the new declarations and type descriptors to
support parameterized functions and types.

Change-Id: Ia21c544caa704309cc8fd639f104c192e1786b72
Reviewed-on: https://go-review.googlesource.com/c/go/+/350951
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/typecheck/iexport.go

index bbdad09782ed5d2e03bc9e57e918ca5d0d47d158..489306e1e6cb1ad46e9013629738eab3361bf84f 100644 (file)
@@ -63,8 +63,9 @@
 //     }
 //
 //     type Func struct {
-//         Tag       byte // 'F'
+//         Tag       byte // 'F' or 'G'
 //         Pos       Pos
+//         TypeParams []typeOff  // only present if Tag == 'G'
 //         Signature Signature
 //     }
 //
@@ -75,8 +76,9 @@
 //     }
 //
 //     type Type struct {
-//         Tag        byte // 'T'
+//         Tag        byte // 'T' or 'U'
 //         Pos        Pos
+//         TypeParams []typeOff  // only present if Tag == 'U'
 //         Underlying typeOff
 //
 //         Methods []struct{  // omitted if Underlying is an interface type
 //         Type typeOff
 //     }
 //
+//     // "Automatic" declaration of each typeparam
+//     type TypeParam struct {
+//         Tag  byte // 'P'
+//         Pos  Pos
+//         Bound typeOff
+//     }
 //
 // typeOff means a uvarint that either indicates a predeclared type,
 // or an offset into the Data section. If the uvarint is less than
 // (*exportWriter).value for details.
 //
 //
-// There are nine kinds of type descriptors, distinguished by an itag:
+// There are twelve kinds of type descriptors, distinguished by an itag:
 //
 //     type DefinedType struct {
 //         Tag     itag // definedType
 //         }
 //     }
 //
+//     // Reference to a type param declaration
+//     type TypeParamType struct {
+//         Tag     itag // typeParamType
+//         Name    stringOff
+//         PkgPath stringOff
+//     }
+//
+//     // Instantiation of a generic type (like List[T2] or List[int])
+//     type InstanceType struct {
+//         Tag     itag // instanceType
+//         Pos     pos
+//         TypeArgs []typeOff
+//         BaseType typeOff
+//     }
+//
+//     type UnionType struct {
+//         Tag     itag // interfaceType
+//         Terms   []struct {
+//             tilde bool
+//             Type  typeOff
+//         }
+//     }
+//
 //
-//  TODO(danscales): fill in doc for 'type TypeParamType' and 'type InstType'
 //
 //     type Signature struct {
 //         Params   []Param