[FIR] Add smartcasts from == if equals is from Any
^KT-49127 Fixed
This commit is contained in:
committed by
teamcityserver
parent
ac718cd1c4
commit
1f0b62b25f
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.LookupTagInternals
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
|
||||
fun FirClassLikeDeclaration.getContainingDeclaration(session: FirSession): FirClassLikeDeclaration? {
|
||||
if (isLocal) {
|
||||
@@ -86,3 +87,10 @@ var FirConstructor.originalConstructorIfTypeAlias: FirConstructor? by FirDeclara
|
||||
|
||||
val FirConstructorSymbol.isTypeAliasedConstructor: Boolean
|
||||
get() = fir.originalConstructorIfTypeAlias != null
|
||||
|
||||
fun FirSimpleFunction.isEquals(): Boolean {
|
||||
if (name != OperatorNameConventions.EQUALS) return false
|
||||
if (valueParameters.size != 1) return false
|
||||
val parameter = valueParameters.first()
|
||||
return parameter.returnTypeRef.isNullableAny
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user