[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:
+1
-1
@@ -347,7 +347,7 @@ object NewCommonSuperTypeCalculator {
|
|||||||
arguments: List<TypeArgumentMarker>,
|
arguments: List<TypeArgumentMarker>,
|
||||||
depth: Int
|
depth: Int
|
||||||
): TypeArgumentMarker {
|
): TypeArgumentMarker {
|
||||||
if (depth > 3) {
|
if (depth >= 0) {
|
||||||
return createStarProjection(parameter)
|
return createStarProjection(parameter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user