There are clone overloads that take a shape as a parameter. These overloads are guaranteed to return a ranked shaped type.
TensorType::clone/BaseMemRefType::clone used to always return a TensorType/BaseMemRefType. The variants that take a shape parameter now return a RankedTensorType/MemRefType. Better static type information can make extra casts at the call site obsolete.
E.g.:
{TensorType/RankedTensorType} t; t.clone({1, 2}) // now returns RankedTensorType instead of TensorType
Also improve documentation for clone.