doc/ref: allow embeding to be Expression

And implementation.

Change-Id: I63f2b7b91e0635d071311346e216729f87b21b2e
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/3188
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cmd/cue/cmd/get_go.go b/cmd/cue/cmd/get_go.go
index bedc4e8..437a8e8 100644
--- a/cmd/cue/cmd/get_go.go
+++ b/cmd/cue/cmd/get_go.go
@@ -945,9 +945,8 @@
 				if i > 0 {
 					fmt.Fprintln(e.w)
 				}
-				fmt.Fprint(e.w, "\n(")
+				fmt.Fprint(e.w, "\n")
 				e.printType(typ)
-				fmt.Fprint(e.w, ")")
 			} else {
 				switch x := typ.(type) {
 				case *types.Struct:
diff --git a/cmd/cue/cmd/testdata/pkg/cuelang.org/go/cmd/cue/cmd/testdata/code/go/pkg1/file1_go_gen.cue b/cmd/cue/cmd/testdata/pkg/cuelang.org/go/cmd/cue/cmd/testdata/code/go/pkg1/file1_go_gen.cue
index 718e3ae..14b6774 100644
--- a/cmd/cue/cmd/testdata/pkg/cuelang.org/go/cmd/cue/cmd/testdata/code/go/pkg1/file1_go_gen.cue
+++ b/cmd/cue/cmd/testdata/pkg/cuelang.org/go/cmd/cue/cmd/testdata/code/go/pkg1/file1_go_gen.cue
@@ -14,7 +14,7 @@
 	Int:    int
 	String: string
 
-	(Inline)
+	Inline
 
 	NoInline:   NoInline
 	CustomJSON: CustomJSON
diff --git a/cue/parser/parser.go b/cue/parser/parser.go
index 6234910..5cc3c69 100644
--- a/cue/parser/parser.go
+++ b/cue/parser/parser.go
@@ -883,36 +883,28 @@
 }
 
 func (p *parser) parseLabel(f *ast.Field) (expr ast.Expr, ok bool) {
-	switch p.tok {
-	case token.IDENT:
-		ident := p.parseIdent()
-		f.Label = ident
-		expr = ident
+	tok := p.tok
+	switch tok {
+	case token.IDENT, token.STRING, token.INTERPOLATION,
+		token.NULL, token.TRUE, token.FALSE:
+		expr = p.parsePrimaryExpr()
 
-	case token.STRING:
-		// JSON compatibility.
+		switch x := expr.(type) {
+		case *ast.BasicLit:
+			switch x.Kind {
+			case token.STRING, token.NULL, token.TRUE, token.FALSE:
+				// Keywords that represent operands.
 
-		expr = p.parseOperand()
-		f.Label = expr.(ast.Label)
+				// Allowing keywords to be used as a labels should not interfere with
+				// generating good errors: any keyword can only appear on the RHS of a
+				// field (after a ':'), whereas labels always appear on the LHS.
 
-	case token.INTERPOLATION:
-		expr = p.parseInterpolation()
-		f.Label = expr.(ast.Label)
+				f.Label, ok = x, true
+			}
 
-	case token.NULL, token.TRUE, token.FALSE:
-		// Keywords that represent operands.
-
-		// Allowing keywords to be used as a labels should not interfere with
-		// generating good errors: any keyword can only appear on the RHS of a
-		// field (after a ':'), whereas labels always appear on the LHS.
-		ident := &ast.BasicLit{
-			Kind:     p.tok,
-			ValuePos: p.pos,
-			Value:    p.lit,
+		case ast.Label:
+			f.Label, ok = x, true
 		}
-		p.next()
-		f.Label = ident
-		expr = ident
 
 	case token.IF, token.FOR, token.IN, token.LET:
 		// Keywords representing clauses.
@@ -921,8 +913,9 @@
 			Name:    p.lit,
 		}
 		p.next()
+		ok = true
 
-	case token.LSS: // element templates
+	case token.LSS:
 		pos := p.pos
 		c := p.openComments()
 		p.next()
@@ -934,12 +927,9 @@
 		p.next()
 		label := &ast.TemplateLabel{Langle: pos, Ident: ident, Rangle: gtr}
 		c.closeNode(p, label)
-		f.Label = label
-
-	default:
-		return expr, false
+		f.Label, ok = label, true
 	}
-	return expr, true
+	return expr, ok
 }
 
 func (p *parser) parseStruct() (expr ast.Expr) {
diff --git a/cue/parser/parser_test.go b/cue/parser/parser_test.go
index 0d35ef5..6907865 100644
--- a/cue/parser/parser_test.go
+++ b/cue/parser/parser_test.go
@@ -96,6 +96,14 @@
 		`{ V1, V2 }`,
 		`{V1, V2}`,
 	}, {
+		"selector embedding",
+		`Def :: {
+			a.b.c
+
+			foo: 2
+		}`,
+		`Def :: {a.b.c, foo: 2}`,
+	}, {
 		"ellipsis in structs",
 		`Def :: {
 			b: "2"
diff --git a/doc/ref/spec.md b/doc/ref/spec.md
index 3569fa8..4945ffa 100644
--- a/doc/ref/spec.md
+++ b/doc/ref/spec.md
@@ -1165,12 +1165,11 @@
 carefully.
 -->
 ```
-StructLit       = "{" [ DeclarationList [ "," [ "..." ] ] "}" .
-DeclarationList = Declaration { "," Declaration }
-Declaration     = FieldDecl | DefinitionDecl | AliasDecl | ComprehensionDecl | Embedding .
+StructLit       = "{" { Declaration "," } [ "..." ] "}" .
+Declaration     = FieldDecl | DefinitionDecl | AliasDecl | Comprehension | Embedding .
 FieldDecl       = Label { Label } ":" Expression { attribute } .
 DefinitionDecl  = Label "::" Expression { attribute } .
-Embedding       = Operand .
+Embedding       = Expression .
 
 AliasDecl       = Label "=" Expression .
 BindLabel       = "<" identifier ">" .
@@ -1178,10 +1177,6 @@
 ExpressionLabel = BindLabel
 Label           = ConcreteLabel [ "?" ] | ExpressionLabel .
 
-<!-- (jba) According to this grammar, I must write a "?" after a bind label, so
-"<Name>: name" is illegal.
--->
-
 attribute       = "@" identifier "(" attr_elems ")" .
 attr_elems      = attr_elem { "," attr_elem }
 attr_elem       =  attr_string | attr_label | attr_nest .
@@ -1302,6 +1297,9 @@
 A struct resulting from such a unification is closed if either of the involved
 structs were closed.
 
+Syntactically, embeddings may be any expression except that it only
+allows binary expressions with operators `&` or `|`.
+
 ```
 S1: {
     a: 1
@@ -1619,11 +1617,6 @@
 of all fields with the same identifier.
 String labels do not bind an identifier to the respective field.
 
-```
-TopLevelDecl   = Declaration | Emit .
-Emit           = Operand .
-```
-
 The _scope_ of a declared identifier is the extent of source text in which the
 identifier denotes the specified field, alias, or package.
 
@@ -2596,7 +2589,7 @@
 resulting in the unification of their values.
 
 ```
-ComprehensionDecl   = Clauses StructLit .
+Comprehension       = Clauses StructLit .
 ListComprehension   = "[" Expression Clauses "]" .
 
 Clauses             = Clause { Clause } .
@@ -2877,9 +2870,22 @@
 packages whose contents it wishes to use, followed by a possibly empty set of
 declarations.
 
+Like with a struct, a source file may contain embeddings.
+Unlike with a struct, the embedded expressions may be any value.
+If the result of the unification of all embedded values is not a struct,
+it will be output instead of its enclosing file when exporting CUE
+to a data format
 
 ```
-SourceFile      = [ PackageClause "," ] { ImportDecl "," } { TopLevelDecl "," } .
+SourceFile      = [ PackageClause "," ] { ImportDecl "," } { Declaration "," } .
+```
+
+```
+"Hello \(place)!"
+
+place: "world"
+
+// Outputs "Hello world!"
 ```
 
 ### Package clause
diff --git a/doc/tutorial/kubernetes/quick/pkg/k8s.io/api/apps/v1beta1/types_go_gen.cue b/doc/tutorial/kubernetes/quick/pkg/k8s.io/api/apps/v1beta1/types_go_gen.cue
index dab4f32..fd4c052 100644
--- a/doc/tutorial/kubernetes/quick/pkg/k8s.io/api/apps/v1beta1/types_go_gen.cue
+++ b/doc/tutorial/kubernetes/quick/pkg/k8s.io/api/apps/v1beta1/types_go_gen.cue
@@ -43,7 +43,7 @@
 
 // Scale represents a scaling request for a resource.
 Scale :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.
 	// +optional
@@ -67,7 +67,7 @@
 // The StatefulSet guarantees that a given network identity will always
 // map to the same storage identity.
 StatefulSet :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// +optional
 	metadata?: metav1.ObjectMeta @go(ObjectMeta) @protobuf(1,bytes,opt)
@@ -269,7 +269,7 @@
 
 // StatefulSetList is a collection of StatefulSets.
 StatefulSetList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// +optional
 	metadata?: metav1.ListMeta @go(ListMeta) @protobuf(1,bytes,opt)
@@ -280,7 +280,7 @@
 // more information.
 // Deployment enables declarative updates for Pods and ReplicaSets.
 Deployment :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object metadata.
 	// +optional
@@ -348,7 +348,7 @@
 // DEPRECATED.
 // DeploymentRollback stores the information required to rollback a deployment.
 DeploymentRollback :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Required: This must match the Name of a deployment.
 	name: string @go(Name) @protobuf(1,bytes,opt)
@@ -514,7 +514,7 @@
 
 // DeploymentList is a list of Deployments.
 DeploymentList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard list metadata.
 	// +optional
@@ -536,7 +536,7 @@
 // it may be subject to name and representation changes in future releases, and clients should not
 // depend on its stability. It is primarily for internal use by controllers.
 ControllerRevision :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -552,7 +552,7 @@
 
 // ControllerRevisionList is a resource containing a list of ControllerRevision objects.
 ControllerRevisionList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
 	// +optional
diff --git a/doc/tutorial/kubernetes/quick/pkg/k8s.io/api/core/v1/types_go_gen.cue b/doc/tutorial/kubernetes/quick/pkg/k8s.io/api/core/v1/types_go_gen.cue
index 1c66a03..913e44e 100644
--- a/doc/tutorial/kubernetes/quick/pkg/k8s.io/api/core/v1/types_go_gen.cue
+++ b/doc/tutorial/kubernetes/quick/pkg/k8s.io/api/core/v1/types_go_gen.cue
@@ -27,7 +27,7 @@
 	// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
 	name: string @go(Name) @protobuf(1,bytes,opt)
 
-	(VolumeSource)
+	VolumeSource
 
 }
 
@@ -303,7 +303,7 @@
 // It is analogous to a node.
 // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes
 PersistentVolume :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -331,7 +331,7 @@
 	// +optional
 	capacity?: ResourceList @go(Capacity) @protobuf(1,bytes,rep,casttype=ResourceList,castkey=ResourceName)
 
-	(PersistentVolumeSource)
+	PersistentVolumeSource
 
 	// AccessModes contains all ways the volume can be mounted.
 	// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes
@@ -434,7 +434,7 @@
 
 // PersistentVolumeList is a list of PersistentVolume items.
 PersistentVolumeList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
@@ -448,7 +448,7 @@
 
 // PersistentVolumeClaim is a user's request for and claim to a persistent volume
 PersistentVolumeClaim :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -469,7 +469,7 @@
 
 // PersistentVolumeClaimList is a list of PersistentVolumeClaim items.
 PersistentVolumeClaimList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
@@ -1265,7 +1265,7 @@
 // Note that this is identical to a secret volume source without the default
 // mode.
 SecretProjection :: {
-	(LocalObjectReference)
+	LocalObjectReference
 
 	// If unspecified, each key-value pair in the Data field of the referenced
 	// Secret will be projected into the volume as a file whose name is the
@@ -1734,7 +1734,7 @@
 // the items element is populated with specific mappings of keys to paths.
 // ConfigMap volumes support ownership management and SELinux relabeling.
 ConfigMapVolumeSource :: {
-	(LocalObjectReference)
+	LocalObjectReference
 
 	// If unspecified, each key-value pair in the Data field of the referenced
 	// ConfigMap will be projected into the volume as a file whose name is the
@@ -1769,7 +1769,7 @@
 // Note that this is identical to a configmap volume source without the default
 // mode.
 ConfigMapProjection :: {
-	(LocalObjectReference)
+	LocalObjectReference
 
 	// If unspecified, each key-value pair in the Data field of the referenced
 	// ConfigMap will be projected into the volume as a file whose name is the
@@ -2142,7 +2142,7 @@
 
 // Selects a key from a ConfigMap.
 ConfigMapKeySelector :: {
-	(LocalObjectReference)
+	LocalObjectReference
 
 	// The key to select.
 	key: string @go(Key) @protobuf(2,bytes,opt)
@@ -2154,7 +2154,7 @@
 
 // SecretKeySelector selects a key of a Secret.
 SecretKeySelector :: {
-	(LocalObjectReference)
+	LocalObjectReference
 
 	// The key of the secret to select from.  Must be a valid secret key.
 	key: string @go(Key) @protobuf(2,bytes,opt)
@@ -2185,7 +2185,7 @@
 // The contents of the target ConfigMap's Data field will represent the
 // key-value pairs as environment variables.
 ConfigMapEnvSource :: {
-	(LocalObjectReference)
+	LocalObjectReference
 
 	// Specify whether the ConfigMap must be defined
 	// +optional
@@ -2198,7 +2198,7 @@
 // The contents of the target Secret's Data field will represent the
 // key-value pairs as environment variables.
 SecretEnvSource :: {
-	(LocalObjectReference)
+	LocalObjectReference
 
 	// Specify whether the Secret must be defined
 	// +optional
@@ -2279,7 +2279,7 @@
 // Probe describes a health check to be performed against a container to determine whether it is
 // alive or ready to receive traffic.
 Probe :: {
-	(Handler)
+	Handler
 
 	// Number of seconds after the container has started before liveness probes are initiated.
 	// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
@@ -3783,7 +3783,7 @@
 // once added.
 // This is an alpha feature enabled by the EphemeralContainers feature flag.
 EphemeralContainer :: {
-	(EphemeralContainerCommon)
+	EphemeralContainerCommon
 
 	// If set, the name of the container from PodSpec that this ephemeral container targets.
 	// The ephemeral container will be run in the namespaces (IPC, PID, etc) of this container.
@@ -3892,7 +3892,7 @@
 
 // PodStatusResult is a wrapper for PodStatus returned by kubelet that can be encode/decoded
 PodStatusResult :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -3911,7 +3911,7 @@
 // Pod is a collection of containers that can run on a host. This resource is created
 // by clients and scheduled onto hosts.
 Pod :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -3934,7 +3934,7 @@
 
 // PodList is a list of Pods.
 PodList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
@@ -3961,7 +3961,7 @@
 
 // PodTemplate describes a template for creating copies of a predefined pod.
 PodTemplate :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -3976,7 +3976,7 @@
 
 // PodTemplateList is a list of PodTemplates.
 PodTemplateList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
@@ -4080,7 +4080,7 @@
 
 // ReplicationController represents the configuration of a replication controller.
 ReplicationController :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// If the Labels of a ReplicationController are empty, they are defaulted to
 	// be the same as the Pod(s) that the replication controller manages.
@@ -4104,7 +4104,7 @@
 
 // ReplicationControllerList is a collection of replication controllers.
 ReplicationControllerList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
@@ -4401,7 +4401,7 @@
 // (for example 3306) that the proxy listens on, and the selector that determines which pods
 // will answer requests sent through the proxy.
 Service :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -4427,7 +4427,7 @@
 
 // ServiceList holds a list of services.
 ServiceList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
@@ -4443,7 +4443,7 @@
 // * a principal that can be authenticated and authorized
 // * a set of secrets
 ServiceAccount :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -4472,7 +4472,7 @@
 
 // ServiceAccountList is a list of ServiceAccount objects
 ServiceAccountList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
@@ -4497,7 +4497,7 @@
 //     },
 //  ]
 Endpoints :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -4586,7 +4586,7 @@
 
 // EndpointsList is a list of endpoints.
 EndpointsList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
@@ -5027,7 +5027,7 @@
 // Node is a worker node in Kubernetes.
 // Each node will have a unique identifier in the cache (i.e. in etcd).
 Node :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -5049,7 +5049,7 @@
 
 // NodeList is the whole list of all Nodes which have been registered with master.
 NodeList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
@@ -5139,7 +5139,7 @@
 // Namespace provides a scope for Names.
 // Use of multiple namespaces is optional.
 Namespace :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -5159,7 +5159,7 @@
 
 // NamespaceList is a list of Namespaces.
 NamespaceList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
@@ -5174,7 +5174,7 @@
 // Binding ties one object to another; for example, a pod is bound to a node by a scheduler.
 // Deprecated in 1.7, please use the bindings subresource of pods instead.
 Binding :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -5187,7 +5187,7 @@
 
 // A list of ephemeral containers used with the Pod ephemeralcontainers subresource.
 EphemeralContainers :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// +optional
 	metadata?: metav1.ObjectMeta @go(ObjectMeta) @protobuf(1,bytes,opt)
@@ -5210,7 +5210,7 @@
 
 // PodLogOptions is the query options for a Pod's logs REST call.
 PodLogOptions :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// The container for which to stream logs. Defaults to only container if there is one container in the pod.
 	// +optional
@@ -5260,7 +5260,7 @@
 // TODO: merge w/ PodExecOptions below for stdin, stdout, etc
 // and also when we cut V2, we should export a "StreamOptions" or somesuch that contains Stdin, Stdout, Stder and TTY
 PodAttachOptions :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Stdin if true, redirects the standard input stream of the pod for this call.
 	// Defaults to false.
@@ -5295,7 +5295,7 @@
 // TODO: This is largely identical to PodAttachOptions above, make sure they stay in sync and see about merging
 // and also when we cut V2, we should export a "StreamOptions" or somesuch that contains Stdin, Stdout, Stder and TTY
 PodExecOptions :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Redirect the standard input stream of the pod for this call.
 	// Defaults to false.
@@ -5333,7 +5333,7 @@
 // Port forwarding over SPDY does not use these options. It requires the port
 // to be passed in the `port` header as part of request.
 PodPortForwardOptions :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// List of ports to forward
 	// Required when using WebSockets
@@ -5343,7 +5343,7 @@
 
 // PodProxyOptions is the query options to a Pod's proxy call.
 PodProxyOptions :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Path is the URL path to use for the current proxy request to pod.
 	// +optional
@@ -5352,7 +5352,7 @@
 
 // NodeProxyOptions is the query options to a Node's proxy call.
 NodeProxyOptions :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Path is the URL path to use for the current proxy request to node.
 	// +optional
@@ -5361,7 +5361,7 @@
 
 // ServiceProxyOptions is the query options to a Service's proxy call.
 ServiceProxyOptions :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Path is the part of URLs that include service endpoints, suffixes,
 	// and parameters to use for the current proxy request to service.
@@ -5444,7 +5444,7 @@
 
 // SerializedReference is a reference to serialized object.
 SerializedReference :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// The reference to an object in the system.
 	// +optional
@@ -5470,7 +5470,7 @@
 
 // Event is a report of an event somewhere in the cluster.
 Event :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -5562,7 +5562,7 @@
 
 // EventList is a list of events.
 EventList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
@@ -5628,7 +5628,7 @@
 
 // LimitRange sets resource usage limits for each kind of resource in a Namespace.
 LimitRange :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -5643,7 +5643,7 @@
 
 // LimitRangeList is a list of LimitRange items.
 LimitRangeList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
@@ -5809,7 +5809,7 @@
 
 // ResourceQuota sets aggregate quota restrictions enforced per namespace
 ResourceQuota :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -5829,7 +5829,7 @@
 
 // ResourceQuotaList is a list of ResourceQuota items.
 ResourceQuotaList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
@@ -5844,7 +5844,7 @@
 // Secret holds secret data of a certain type. The total bytes of the values in
 // the Data field must be less than MaxSecretSize bytes.
 Secret :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -5977,7 +5977,7 @@
 
 // SecretList is a list of Secret.
 SecretList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
@@ -5991,7 +5991,7 @@
 
 // ConfigMap holds configuration data for pods to consume.
 ConfigMap :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -6019,7 +6019,7 @@
 
 // ConfigMapList is a resource containing a list of ConfigMap objects.
 ConfigMapList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
 	// +optional
@@ -6060,7 +6060,7 @@
 
 // ComponentStatus (and ComponentStatusList) holds the cluster validation info.
 ComponentStatus :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -6076,7 +6076,7 @@
 
 // Status of all the conditions for the component as a list of ComponentStatus objects.
 ComponentStatusList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
@@ -6269,7 +6269,7 @@
 
 // RangeAllocation is not a public type.
 RangeAllocation :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
diff --git a/doc/tutorial/kubernetes/quick/pkg/k8s.io/api/extensions/v1beta1/types_go_gen.cue b/doc/tutorial/kubernetes/quick/pkg/k8s.io/api/extensions/v1beta1/types_go_gen.cue
index ee8b19d..54e2ecd 100644
--- a/doc/tutorial/kubernetes/quick/pkg/k8s.io/api/extensions/v1beta1/types_go_gen.cue
+++ b/doc/tutorial/kubernetes/quick/pkg/k8s.io/api/extensions/v1beta1/types_go_gen.cue
@@ -38,7 +38,7 @@
 
 // represents a scaling request for a resource.
 Scale :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.
 	// +optional
@@ -55,7 +55,7 @@
 
 // Dummy definition
 ReplicationControllerDummy :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 }
 
@@ -63,7 +63,7 @@
 // more information.
 // Deployment enables declarative updates for Pods and ReplicaSets.
 Deployment :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object metadata.
 	// +optional
@@ -134,7 +134,7 @@
 // DEPRECATED.
 // DeploymentRollback stores the information required to rollback a deployment.
 DeploymentRollback :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Required: This must match the Name of a deployment.
 	name: string @go(Name) @protobuf(1,bytes,opt)
@@ -300,7 +300,7 @@
 
 // DeploymentList is a list of Deployments.
 DeploymentList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard list metadata.
 	// +optional
@@ -478,7 +478,7 @@
 // more information.
 // DaemonSet represents the configuration of a daemon set.
 DaemonSet :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -512,7 +512,7 @@
 
 // DaemonSetList is a collection of daemon sets.
 DaemonSetList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -529,7 +529,7 @@
 // based virtual hosting etc.
 // DEPRECATED - This group version of Ingress is deprecated by networking.k8s.io/v1beta1 Ingress. See the release notes for more information.
 Ingress :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -549,7 +549,7 @@
 
 // IngressList is a collection of Ingress.
 IngressList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -627,7 +627,7 @@
 	// +optional
 	host?: string @go(Host) @protobuf(1,bytes,opt)
 
-	(IngressRuleValue)
+	IngressRuleValue
 
 }
 
@@ -681,7 +681,7 @@
 // more information.
 // ReplicaSet ensures that a specified number of pod replicas are running at any given time.
 ReplicaSet :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// If the Labels of a ReplicaSet are empty, they are defaulted to
 	// be the same as the Pod(s) that the ReplicaSet manages.
@@ -705,7 +705,7 @@
 
 // ReplicaSetList is a collection of ReplicaSets.
 ReplicaSetList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
@@ -810,7 +810,7 @@
 // that will be applied to a pod and container.
 // Deprecated: use PodSecurityPolicy from policy API Group instead.
 PodSecurityPolicy :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -1187,7 +1187,7 @@
 // PodSecurityPolicyList is a list of PodSecurityPolicy objects.
 // Deprecated: use PodSecurityPolicyList from policy API Group instead.
 PodSecurityPolicyList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -1201,7 +1201,7 @@
 // DEPRECATED 1.9 - This group version of NetworkPolicy is deprecated by networking/v1/NetworkPolicy.
 // NetworkPolicy describes what network traffic is allowed for a set of Pods
 NetworkPolicy :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -1374,7 +1374,7 @@
 // DEPRECATED 1.9 - This group version of NetworkPolicyList is deprecated by networking/v1/NetworkPolicyList.
 // Network Policy List is a list of NetworkPolicy objects.
 NetworkPolicyList :: {
-	(metav1.TypeMeta)
+	metav1.TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
diff --git a/doc/tutorial/kubernetes/quick/pkg/k8s.io/apimachinery/pkg/apis/meta/v1/types_go_gen.cue b/doc/tutorial/kubernetes/quick/pkg/k8s.io/apimachinery/pkg/apis/meta/v1/types_go_gen.cue
index fe0634c..a3a075a 100644
--- a/doc/tutorial/kubernetes/quick/pkg/k8s.io/apimachinery/pkg/apis/meta/v1/types_go_gen.cue
+++ b/doc/tutorial/kubernetes/quick/pkg/k8s.io/apimachinery/pkg/apis/meta/v1/types_go_gen.cue
@@ -306,7 +306,7 @@
 
 // ListOptions is the query options to a standard REST list call.
 ListOptions :: {
-	(TypeMeta)
+	TypeMeta
 
 	// A selector to restrict the list of returned objects by their labels.
 	// Defaults to everything.
@@ -389,7 +389,7 @@
 // ExportOptions is the query options to the standard REST get call.
 // Deprecated. Planned for removal in 1.18.
 ExportOptions :: {
-	(TypeMeta)
+	TypeMeta
 
 	// Should this value be exported.  Export strips fields that a user can not specify.
 	// Deprecated. Planned for removal in 1.18.
@@ -402,7 +402,7 @@
 
 // GetOptions is the standard query options to the standard REST get call.
 GetOptions :: {
-	(TypeMeta)
+	TypeMeta
 
 	// When specified:
 	// - if unset, then the result is returned from remote storage based on quorum-read flag;
@@ -440,7 +440,7 @@
 
 // DeleteOptions may be provided when deleting an API object.
 DeleteOptions :: {
-	(TypeMeta)
+	TypeMeta
 
 	// The duration in seconds before the object should be deleted. Value must be non-negative integer.
 	// The value zero indicates delete immediately. If this value is nil, the default grace period for the
@@ -483,7 +483,7 @@
 
 // CreateOptions may be provided when creating an API object.
 CreateOptions :: {
-	(TypeMeta)
+	TypeMeta
 
 	// When present, indicates that modifications should not be
 	// persisted. An invalid or unrecognized dryRun directive will
@@ -504,7 +504,7 @@
 // PatchOptions may be provided when patching an API object.
 // PatchOptions is meant to be a superset of UpdateOptions.
 PatchOptions :: {
-	(TypeMeta)
+	TypeMeta
 
 	// When present, indicates that modifications should not be
 	// persisted. An invalid or unrecognized dryRun directive will
@@ -534,7 +534,7 @@
 // UpdateOptions may be provided when updating an API object.
 // All fields in UpdateOptions should also be present in PatchOptions.
 UpdateOptions :: {
-	(TypeMeta)
+	TypeMeta
 
 	// When present, indicates that modifications should not be
 	// persisted. An invalid or unrecognized dryRun directive will
@@ -565,7 +565,7 @@
 
 // Status is a return value for calls that don't return other objects.
 Status :: {
-	(TypeMeta)
+	TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
@@ -886,7 +886,7 @@
 
 // List holds a list of objects, which may not be known by the server.
 List :: {
-	(TypeMeta)
+	TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
@@ -903,7 +903,7 @@
 // +protobuf.options.(gogoproto.goproto_stringer)=false
 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
 APIVersions :: {
-	(TypeMeta)
+	TypeMeta
 
 	// versions are the api versions that are available.
 	versions: [...string] @go(Versions,[]string) @protobuf(1,bytes,rep)
@@ -921,7 +921,7 @@
 // APIGroupList is a list of APIGroup, to allow clients to discover the API at
 // /apis.
 APIGroupList :: {
-	(TypeMeta)
+	TypeMeta
 
 	// groups is a list of APIGroup.
 	groups: [...APIGroup] @go(Groups,[]APIGroup) @protobuf(1,bytes,rep)
@@ -930,7 +930,7 @@
 // APIGroup contains the name, the supported versions, and the preferred version
 // of a group.
 APIGroup :: {
-	(TypeMeta)
+	TypeMeta
 
 	// name is the name of the group.
 	name: string @go(Name) @protobuf(1,bytes,opt)
@@ -1030,7 +1030,7 @@
 // resources supported in a specific group and version, and if the resource
 // is namespaced.
 APIResourceList :: {
-	(TypeMeta)
+	TypeMeta
 
 	// groupVersion is the group and version this APIResourceList is for.
 	groupVersion: string @go(GroupVersion) @protobuf(1,bytes,opt)
@@ -1156,7 +1156,7 @@
 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
 // +protobuf=false
 Table :: {
-	(TypeMeta)
+	TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
@@ -1284,7 +1284,7 @@
 // TableOptions are used when a Table is requested by the caller.
 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
 TableOptions :: {
-	(TypeMeta)
+	TypeMeta
 
 	// includeObject decides whether to include each object along with its columnar information.
 	// Specifying "None" will return no object, specifying "Object" will return the full object contents, and
@@ -1297,7 +1297,7 @@
 // to get access to a particular ObjectMeta schema without knowing the details of the version.
 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
 PartialObjectMetadata :: {
-	(TypeMeta)
+	TypeMeta
 
 	// Standard object's metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
@@ -1308,7 +1308,7 @@
 // PartialObjectMetadataList contains a list of objects containing only their metadata
 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
 PartialObjectMetadataList :: {
-	(TypeMeta)
+	TypeMeta
 
 	// Standard list metadata.
 	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
diff --git a/encoding/gocode/gocodec/codec_test.go b/encoding/gocode/gocodec/codec_test.go
index cb38865..0765c46 100644
--- a/encoding/gocode/gocodec/codec_test.go
+++ b/encoding/gocode/gocodec/codec_test.go
@@ -93,9 +93,6 @@
 					t.Fatal(err)
 				}
 				v = v.Unify(inst.Value())
-				fmt.Println("XXX", v)
-				fmt.Println("XXX", inst.Value())
-				fmt.Println("UUU", v)
 			}
 
 			err = codec.Validate(v, tc.value)