go/types: export TypeParam.Index and remove TypeParam._SetId

This change resolves a TODO regarding a couple uncertain APIs for
types.TypeParam. In the case of TypeParam._Index, we've decided it is
worth exporting. In the case of TypeParam._SetId, we've decided it is
unnecessary.

This aligns go/types with types2 (a doc comment in types2 is also
updated).

Updates #47916

Change-Id: I705e8b3437d014775c473e2f8be6f32b1540bb0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/354370
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
diff --git a/src/cmd/compile/internal/types2/typeparam.go b/src/cmd/compile/internal/types2/typeparam.go
index 6bc9dbc..f7cdff0 100644
--- a/src/cmd/compile/internal/types2/typeparam.go
+++ b/src/cmd/compile/internal/types2/typeparam.go
@@ -50,7 +50,8 @@
 	return typ
 }
 
-// Index returns the index of the type param within its param list.
+// Index returns the index of the type param within its param list, or -1 if
+// the type parameter has not yet been bound to a type.
 func (t *TypeParam) Index() int {
 	return t.index
 }
diff --git a/src/go/types/typeparam.go b/src/go/types/typeparam.go
index e2755cb..af36266 100644
--- a/src/go/types/typeparam.go
+++ b/src/go/types/typeparam.go
@@ -50,19 +50,12 @@
 	return typ
 }
 
-// TODO(rfindley): remove or export these placeholder APIs.
-
-// Index returns the index of the type param within its param list.
-func (t *TypeParam) _Index() int {
+// Index returns the index of the type param within its param list, or -1 if
+// the type parameter has not yet been bound to a type.
+func (t *TypeParam) Index() int {
 	return t.index
 }
 
-// SetId sets the unique id of a type param. Should only be used for type params
-// in imported generic types.
-func (t *TypeParam) _SetId(id uint64) {
-	t.id = id
-}
-
 // Obj returns the type name for t.
 func (t *TypeParam) Obj() *TypeName { return t.obj }