]> Cypherpunks repositories - gostls13.git/commitdiff
reflect: doc fixes for obsolete types.
authorDavid Symonds <dsymonds@golang.org>
Wed, 27 Jul 2011 03:29:44 +0000 (13:29 +1000)
committerDavid Symonds <dsymonds@golang.org>
Wed, 27 Jul 2011 03:29:44 +0000 (13:29 +1000)
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4802061

src/pkg/reflect/all_test.go
src/pkg/reflect/type.go
src/pkg/unsafe/unsafe.go

index ac43b50bb164e6ff542971a797284a952d1ee6d6..15c69c1f069773faded5b143cb5f4c0b91071be3 100644 (file)
@@ -1327,8 +1327,8 @@ func TestImportPath(t *testing.T) {
        }
 }
 
-func TestDotDotDot(t *testing.T) {
-       // Test example from FuncType.DotDotDot documentation.
+func TestVariadic(t *testing.T) {
+       // Test example from Type documentation.
        var f func(x int, y ...float64)
        typ := TypeOf(f)
        if typ.NumIn() == 2 && typ.In(0) == TypeOf(int(0)) {
index 28d94eb4088c8dfd53c4118ed8f291f62d7aab8a..4c377e1fe10f965a335ddc6e51c82a38e09f8d05 100644 (file)
@@ -114,11 +114,11 @@ type Type interface {
        // is a "..." parameter.  If so, t.In(t.NumIn() - 1) returns the parameter's
        // implicit actual type []T.
        //
-       // For concreteness, if t represents func(x int, y ... float), then
+       // For concreteness, if t represents func(x int, y ... float64), then
        //
        //      t.NumIn() == 2
        //      t.In(0) is the reflect.Type for "int"
-       //      t.In(1) is the reflect.Type for "[]float"
+       //      t.In(1) is the reflect.Type for "[]float64"
        //      t.IsVariadic() == true
        //
        // IsVariadic panics if the type's Kind is not Func.
@@ -232,8 +232,8 @@ const (
 
 // commonType is the common implementation of most values.
 // It is embedded in other, public struct types, but always
-// with a unique tag like "uint" or "float" so that the client cannot
-// convert from, say, *UintType to *FloatType.
+// with a unique tag like `reflect:"array"` or `reflect:"ptr"`
+// so that code cannot convert from, say, *arrayType to *ptrType.
 
 type commonType struct {
        size       uintptr
@@ -977,8 +977,8 @@ func PtrTo(t Type) Type {
        }
        rt.i = (*runtime.PtrType)(unsafe.Pointer(&rt.ptrType))
 
-       // initialize p using *byte's PtrType as a prototype.
-       // have to do assignment as PtrType, not runtime.PtrType,
+       // initialize p using *byte's ptrType as a prototype.
+       // have to do assignment as ptrType, not runtime.PtrType,
        // in order to write to unexported fields.
        p = &rt.ptrType
        bp := (*ptrType)(unsafe.Pointer(unsafe.Typeof((*byte)(nil)).(*runtime.PtrType)))
index 8507bed52589db6026df3d1a7878a9af5468467d..a1257066eff70d249457ed39a49971cf25e9d34d 100644 (file)
@@ -47,7 +47,7 @@ func Reflect(i interface{}) (typ interface{}, addr Pointer)
 // empty interface value with contents the type and the value (not the pointer to
 // the value).  The typ is assumed to contain a pointer to a runtime type; the type
 // information in the interface{} is ignored, so that, for example, both
-// *reflect.StructType and *runtime.StructType can be passed for typ.
+// *reflect.structType and *runtime.StructType can be passed for typ.
 func Unreflect(typ interface{}, addr Pointer) (ret interface{})
 
 // New allocates and returns a pointer to memory for a new value of the given type.