diff --git a/doc/go_spec.html b/doc/go_spec.html index 237176f4a7..d812860f4b 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -944,6 +944,29 @@ multi-dimensional types. [2][2][2]float64 // same as [2]([2]([2]float64)) +
+An array type T may not have an element of type T,
+or of a type containing T as a component, directly or indirectly,
+if those containing types are only array or struct types.
+
+// valid array types
+type (
+ T1 [10]T1 // element type of T1 is T1
+ T2 [10]struct{ f T2 } // T2 contains T2 as component of a struct
+ T3 [10]T4 // T3 contains T3 as component of a struct in T4
+ T4 struct{ f T3 } // T4 contains T4 as component of array T3 in a struct
+)
+
+// valid array types
+type (
+ T5 [10]*T5 // T5 contains T5 as component of a pointer
+ T6 [10]func() T6 // T6 contains T6 as component of a function type
+ T7 [10]struct{ f []T7 } // T7 contains T7 as component of a slice in a struct
+)
+
+
@@ -1136,6 +1159,29 @@ struct { } +
+A struct type T may not contain a field of type T,
+or of a type containing T as a component, directly or indirectly,
+if those containing types are only array or struct types.
+
+// invalid struct types
+type (
+ T1 struct{ T1 } // T1 contains a field of T1
+ T2 struct{ f [10]T2 } // T2 contains T2 as component of an array
+ T3 struct{ T4 } // T3 contains T3 as component of an array in struct T4
+ T4 struct{ f [10]T3 } // T4 contains T4 as component of struct T3 in an array
+)
+
+// valid struct types
+type (
+ T5 struct{ f *T5 } // T5 contains T5 as component of a pointer
+ T6 struct{ f func() T6 } // T6 contains T6 as component of a function type
+ T7 struct{ f [10][]T7 } // T7 contains T7 as component of a slice in an array
+)
+
+
@@ -1511,17 +1557,17 @@ type Floatish struct {
-An interface type T may not embed any type element
-that is, contains, or embeds T, recursively.
+An interface type T may not embed a type element
+that is, contains, or embeds T, directly or indirectly.
-// illegal: Bad cannot embed itself
+// illegal: Bad may not embed itself
type Bad interface {
Bad
}
-// illegal: Bad1 cannot embed itself using Bad2
+// illegal: Bad1 may not embed itself using Bad2
type Bad1 interface {
Bad2
}
@@ -1529,10 +1575,15 @@ type Bad2 interface {
Bad1
}
-// illegal: Bad3 cannot embed a union containing Bad3
+// illegal: Bad3 may not embed a union containing Bad3
type Bad3 interface {
~int | ~string | Bad3
}
+
+// illegal: Bad4 may not embed an array containing Bad4 as element type
+type Bad4 interface {
+ [10]Bad4
+}