[FE] Add ability to configure PublicDeclaration type approximation configuration

This configuration allows to choose what to do with local and anonymous types
This commit is contained in:
Dmitriy Novozhilov
2022-11-09 10:33:18 +02:00
committed by Space Team
parent 82c39187f6
commit 32f6b71525
7 changed files with 14 additions and 11 deletions
@@ -702,9 +702,9 @@ class FirElementSerializer private constructor(
}
is ConeIntersectionType -> {
val approximatedType = if (toSuper) {
typeApproximator.approximateToSuperType(type, TypeApproximatorConfiguration.PublicDeclaration)
typeApproximator.approximateToSuperType(type, TypeApproximatorConfiguration.PublicDeclaration.SaveAnonymousTypes)
} else {
typeApproximator.approximateToSubType(type, TypeApproximatorConfiguration.PublicDeclaration)
typeApproximator.approximateToSubType(type, TypeApproximatorConfiguration.PublicDeclaration.SaveAnonymousTypes)
}
assert(approximatedType != type && approximatedType is ConeKotlinType) {
"Approximation failed: ${type.renderForDebugging()}"