func (id *TypeId) MarshalText() ([]byte, error) {
	if id.ArrayDim == 0 && id.MapDim == 0 {
		return []byte(id.Tname), nil
	}
	var buf bytes.Buffer
	buf.Grow(id.strlen())
	err := id.encodeText(&buf)
	return buf.Bytes(), err
}
MarshalText encodes the type name as UTF-8-encoded text and returns the
result.
package syntax
import (
	"bytes"
	"encoding/json"
	"fmt"
	"strings"
)
type (
	FileKind int
	Type interface {
		fmt.Stringer
		TypeId() TypeId
		IsFile() FileKind
		ElementType() Type
		IsAssignableFrom(other Type, lookup *TypeLookup) error
		IsValidExpression(exp Exp, pipeline *Pipeline, ast *Ast) error
		CheckEqual(other Type) error
		CanFilter() bool
		IsValidJson(json.RawMessage, *strings.Builder, *TypeLookup) error
		FilterJson(json.RawMessage, *TypeLookup) (json.RawMessage, bool, error)
	}
	TypeId struct {
		Tname string
		ArrayDim int16
		MapDim int16
	}
	nullType struct{}
	IncompatibleTypeError struct {
		Message string
		Reason  error
	}
)
const (
	KindIsNotFile FileKind = iota
	KindMayContainPaths FileKind = iota
	KindIsFile FileKind = iota
	KindIsDirectory FileKind = iota
)
func (id TypeId) str() string {
	return id.String()
}
func (id *TypeId) writeTo(w stringWriter) {
	if id.MapDim > 0 {
		mustWriteString(w, `map<`)
	}
	mustWriteString(w, id.Tname)
	if id.MapDim > 0 {
		for i := int16(1); i < id.MapDim; i++ {
			mustWriteString(w, `[]`)
		}
		mustWriteRune(w, '>')
	}
	for i := int16(0); i < id.ArrayDim; i++ {
		mustWriteString(w, `[]`)
	}
}