retainLinked

abstract fun retainLinked(linkedTypes: Set<ProtoType>, linkedFields: Set<Field>): Type?

Returns a copy of this containing only the types in linkedTypes and extensions in linkedFields, or null if that set is empty. This will return an EnclosingType if it is itself not linked, but its nested types are linked.

The returned type is a shadow of its former self. It it useful for linking against, but lacks most of the members of the original type.