FIR IDE: rename coneType parameter in KtFirType constructors to not accidentally leak it via lambdas

This commit is contained in:
Ilya Kirillov
2021-06-11 13:25:01 +02:00
committed by TeamCityServer
parent 1d1eab6947
commit 6a9c49dd9d
@@ -25,11 +25,11 @@ internal interface KtFirType : ValidityTokenOwner {
} }
internal class KtFirUsualClassType( internal class KtFirUsualClassType(
coneType: ConeClassLikeTypeImpl, _coneType: ConeClassLikeTypeImpl,
override val token: ValidityToken, override val token: ValidityToken,
_builder: KtSymbolByFirBuilder, _builder: KtSymbolByFirBuilder,
) : KtUsualClassType(), KtFirType { ) : KtUsualClassType(), KtFirType {
override val coneType by weakRef(coneType) override val coneType by weakRef(_coneType)
private val builder by weakRef(_builder) private val builder by weakRef(_builder)
override val classId: ClassId get() = withValidityAssertion { coneType.lookupTag.classId } override val classId: ClassId get() = withValidityAssertion { coneType.lookupTag.classId }
@@ -48,11 +48,11 @@ internal class KtFirUsualClassType(
} }
internal class KtFirFunctionalType( internal class KtFirFunctionalType(
coneType: ConeClassLikeTypeImpl, _coneType: ConeClassLikeTypeImpl,
override val token: ValidityToken, override val token: ValidityToken,
_builder: KtSymbolByFirBuilder, _builder: KtSymbolByFirBuilder,
) : KtFunctionalType(), KtFirType { ) : KtFunctionalType(), KtFirType {
override val coneType by weakRef(coneType) override val coneType by weakRef(_coneType)
private val builder by weakRef(_builder) private val builder by weakRef(_builder)
override val classId: ClassId get() = withValidityAssertion { coneType.lookupTag.classId } override val classId: ClassId get() = withValidityAssertion { coneType.lookupTag.classId }
@@ -94,29 +94,29 @@ internal class KtFirFunctionalType(
} }
internal class KtFirClassErrorType( internal class KtFirClassErrorType(
coneType: ConeClassErrorType, _coneType: ConeClassErrorType,
override val token: ValidityToken, override val token: ValidityToken,
) : KtClassErrorType(), KtFirType { ) : KtClassErrorType(), KtFirType {
override val coneType by weakRef(coneType) override val coneType by weakRef(_coneType)
override val error: String get() = withValidityAssertion { coneType.diagnostic.reason } override val error: String get() = withValidityAssertion { coneType.diagnostic.reason }
override fun asStringForDebugging(): String = withValidityAssertion { coneType.render() } override fun asStringForDebugging(): String = withValidityAssertion { coneType.render() }
} }
internal class KtFirCapturedType( internal class KtFirCapturedType(
coneType: ConeCapturedType, _coneType: ConeCapturedType,
override val token: ValidityToken, override val token: ValidityToken,
) : KtCapturedType(), KtFirType { ) : KtCapturedType(), KtFirType {
override val coneType by weakRef(coneType) override val coneType by weakRef(_coneType)
override fun asStringForDebugging(): String = withValidityAssertion { coneType.render() } override fun asStringForDebugging(): String = withValidityAssertion { coneType.render() }
} }
internal class KtFirDefinitelyNotNullType( internal class KtFirDefinitelyNotNullType(
coneType: ConeDefinitelyNotNullType, _coneType: ConeDefinitelyNotNullType,
override val token: ValidityToken, override val token: ValidityToken,
_builder: KtSymbolByFirBuilder, _builder: KtSymbolByFirBuilder,
) : KtDefinitelyNotNullType(), KtFirType { ) : KtDefinitelyNotNullType(), KtFirType {
override val coneType by weakRef(coneType) override val coneType by weakRef(_coneType)
private val builder by weakRef(_builder) private val builder by weakRef(_builder)
override val original: KtType by cached { builder.typeBuilder.buildKtType(this.coneType.original) } override val original: KtType by cached { builder.typeBuilder.buildKtType(this.coneType.original) }
@@ -127,11 +127,11 @@ internal class KtFirDefinitelyNotNullType(
internal class KtFirTypeParameterType( internal class KtFirTypeParameterType(
coneType: ConeTypeParameterType, _coneType: ConeTypeParameterType,
override val token: ValidityToken, override val token: ValidityToken,
_builder: KtSymbolByFirBuilder, _builder: KtSymbolByFirBuilder,
) : KtTypeParameterType(), KtFirType { ) : KtTypeParameterType(), KtFirType {
override val coneType by weakRef(coneType) override val coneType by weakRef(_coneType)
private val builder by weakRef(_builder) private val builder by weakRef(_builder)
override val name: Name get() = withValidityAssertion { coneType.lookupTag.name } override val name: Name get() = withValidityAssertion { coneType.lookupTag.name }
@@ -145,11 +145,11 @@ internal class KtFirTypeParameterType(
} }
internal class KtFirFlexibleType( internal class KtFirFlexibleType(
coneType: ConeFlexibleType, _coneType: ConeFlexibleType,
override val token: ValidityToken, override val token: ValidityToken,
_builder: KtSymbolByFirBuilder, _builder: KtSymbolByFirBuilder,
) : KtFlexibleType(), KtFirType { ) : KtFlexibleType(), KtFirType {
override val coneType by weakRef(coneType) override val coneType by weakRef(_coneType)
private val builder by weakRef(_builder) private val builder by weakRef(_builder)
override val lowerBound: KtType by cached { builder.typeBuilder.buildKtType(coneType.lowerBound) } override val lowerBound: KtType by cached { builder.typeBuilder.buildKtType(coneType.lowerBound) }
@@ -158,11 +158,11 @@ internal class KtFirFlexibleType(
} }
internal class KtFirIntersectionType( internal class KtFirIntersectionType(
coneType: ConeIntersectionType, _coneType: ConeIntersectionType,
override val token: ValidityToken, override val token: ValidityToken,
_builder: KtSymbolByFirBuilder, _builder: KtSymbolByFirBuilder,
) : KtIntersectionType(), KtFirType { ) : KtIntersectionType(), KtFirType {
override val coneType by weakRef(coneType) override val coneType by weakRef(_coneType)
private val builder by weakRef(_builder) private val builder by weakRef(_builder)
override val conjuncts: List<KtType> by cached { override val conjuncts: List<KtType> by cached {