internal/typesinternal: document ReadGo116ErrorData

Change-Id: I5afe3e4d3f137758da404e779d6bc9b0a57b6a02
Reviewed-on: https://go-review.googlesource.com/c/tools/+/351089
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
diff --git a/internal/typesinternal/types.go b/internal/typesinternal/types.go
index c3e1a39..7c77c2f 100644
--- a/internal/typesinternal/types.go
+++ b/internal/typesinternal/types.go
@@ -30,10 +30,15 @@
 	return true
 }
 
-func ReadGo116ErrorData(terr types.Error) (ErrorCode, token.Pos, token.Pos, bool) {
+// ReadGo116ErrorData extracts additional information from types.Error values
+// generated by Go version 1.16 and later: the error code, start position, and
+// end position. If all positions are valid, start <= err.Pos <= end.
+//
+// If the data could not be read, the final result parameter will be false.
+func ReadGo116ErrorData(err types.Error) (code ErrorCode, start, end token.Pos, ok bool) {
 	var data [3]int
 	// By coincidence all of these fields are ints, which simplifies things.
-	v := reflect.ValueOf(terr)
+	v := reflect.ValueOf(err)
 	for i, name := range []string{"go116code", "go116start", "go116end"} {
 		f := v.FieldByName(name)
 		if !f.IsValid() {