]> Cypherpunks repositories - gostls13.git/commitdiff
go/doc: mark comparable predeclared
authorJonathan Amsterdam <jba@google.com>
Fri, 11 Feb 2022 13:54:29 +0000 (08:54 -0500)
committerJonathan Amsterdam <jba@google.com>
Fri, 11 Feb 2022 16:05:02 +0000 (16:05 +0000)
Add comparable to the list of predeclared types.

Fixes golang/go#51141.

Change-Id: I4a2d4e7e5680e115de9bca03b6c8ad454551cb82
Reviewed-on: https://go-review.googlesource.com/c/go/+/385114
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/go/doc/reader.go
src/go/doc/testdata/b.0.golden
src/go/doc/testdata/b.1.golden
src/go/doc/testdata/b.2.golden
src/go/doc/testdata/b.go

index de1d42210640fb6947b37ac1e94f418c079f9490..d9e721d01b001deb0e25d8d584da41f0acd4016e 100644 (file)
@@ -927,6 +927,7 @@ var predeclaredTypes = map[string]bool{
        "any":        true,
        "bool":       true,
        "byte":       true,
+       "comparable": true,
        "complex64":  true,
        "complex128": true,
        "error":      true,
index 9d93392eaa59331c2943c8731df1802db6c9cde5..c06246a7b11875505f3006686016b08e58075353 100644 (file)
@@ -46,6 +46,9 @@ VARIABLES
 
 
 FUNCTIONS
+       // Associated with comparable type if AllDecls is set. 
+       func ComparableFactory() comparable
+
        // 
        func F(x int) int
 
index 66c47b5c2a7175d853cd5f9293b3563a9d91eef7..2b62c3400c39f098bd5f0ca2f74d394b0cdcae6c 100644 (file)
@@ -38,6 +38,12 @@ TYPES
        // 
        func (x *T) M()
 
+       // Should only appear if AllDecls is set. 
+       type comparable struct{}        // overrides a predeclared type comparable
+
+       // Associated with comparable type if AllDecls is set. 
+       func ComparableFactory() comparable
+
        // 
        type notExported int
 
index 9d93392eaa59331c2943c8731df1802db6c9cde5..c06246a7b11875505f3006686016b08e58075353 100644 (file)
@@ -46,6 +46,9 @@ VARIABLES
 
 
 FUNCTIONS
+       // Associated with comparable type if AllDecls is set. 
+       func ComparableFactory() comparable
+
        // 
        func F(x int) int
 
index e50663b3dfaa8747cd13b173fd2baff61705db91..61b512bc8a97d89e72131698ee4d4b54e516abac 100644 (file)
@@ -27,9 +27,15 @@ func UintFactory() uint {}
 // Associated with uint type if AllDecls is set.
 func uintFactory() uint {}
 
+// Associated with comparable type if AllDecls is set.
+func ComparableFactory() comparable {}
+
 // Should only appear if AllDecls is set.
 type uint struct{} // overrides a predeclared type uint
 
+// Should only appear if AllDecls is set.
+type comparable struct{} // overrides a predeclared type comparable
+
 // ----------------------------------------------------------------------------
 // Exported declarations associated with non-exported types must always be shown.