When encountering dynamic types, one should cast it recursively. (#83218)
Summary:
Say we have a list as dynamic type, we'd have something like:
D<1>[D<2>] (numbers are made up). Before this change, it will emit as List[D<2>]. I.e. making the first dynamic type legible. But leaves the nested type unchanged.
After this change it would show up as List[str]. (also changing D<2> to whatever it corresponds to).
Fixes backport issue in task.
Test Plan:
thrift fiddle
{F759935604}
Reviewed By: zhxchen17
Differential Revision: D38561471
Pull Request resolved: https://github.com/pytorch/pytorch/pull/83218
Approved by: https://github.com/zhxchen17