[NI] CST: remove max depth offset from recursion detection

Recursive type with several recursive anscestors can create a number of identical
common supertype calculations, growing exponentially on every step of recursion.
Previously the number of calculations was limited by D + 3, where D is a type depth.
Since the limit is dynamic, it seems that extra +3 offset can be dropped thus
reducing the number of recursions. The proper solution is to detect such a recursion
and fold recursive type preemtively, but for now this may improve performance in some use cases.

^KT-38544 In progress
This commit is contained in:
Pavel Kirpichenkov
2020-04-27 18:27:00 +03:00
parent dfc86dbf63
commit 36a57973b5
2 changed files with 22 additions and 22 deletions
@@ -347,7 +347,7 @@ object NewCommonSuperTypeCalculator {
arguments: List<TypeArgumentMarker>,
depth: Int
): TypeArgumentMarker {
if (depth > 3) {
if (depth >= 0) {
return createStarProjection(parameter)
}
File diff suppressed because one or more lines are too long