Take greatest lower bound of types before and after type inference so that we can choose most accurate type from the type hints of inner and outer transforms.
Imported from Jira BEAM-12872. Original Jira may contain additional context.
Reported by: heejong.