582dd1d3c0
This fixes a compiler crash IllegalStateException: Captured type for incorporation shouldn't escape from incorporation The crash occurs when a captured type with status FOR_INCORPORATION is two layers deep inside a captured type with status FROM_EXPRESSION. We first check if approximation is required for the most outer captured type in AbstractTypeApproximator.approximateCapturedType. Then we encounter the second captured type with status FROM_EXPRESSION in AbstractTypeApproximator.approximateParametrizedType. At this point, we stop checking and miss the third captured type with status FOR_INCORPORATION. Unfortunately, we can't check recursively if nested captured types need to be approximated because of types with recursive super types (the original reason why the extra check was introduced). That's why we restrict the second check to types with recursive super types, effectively restoring the previous behavior for all other types. #KT-65050 Fixed