[FIR] Consistently use _function_ instead of _functional_ in names of classes and functions
This commit is contained in:
committed by
Space Team
parent
f268ab8858
commit
89c42e20c9
+2
-2
@@ -233,8 +233,8 @@ class FirJvmSerializerExtension(
|
||||
private fun FirFunction.needsInlineParameterNullCheckRequirement(): Boolean =
|
||||
this is FirSimpleFunction && isInline && !isSuspend && !isParamAssertionsDisabled &&
|
||||
!Visibilities.isPrivate(visibility) &&
|
||||
(valueParameters.any { it.returnTypeRef.coneType.isSomeFunctionalType(session) } ||
|
||||
receiverParameter?.typeRef?.coneType?.isSomeFunctionalType(session) == true)
|
||||
(valueParameters.any { it.returnTypeRef.coneType.isSomeFunctionType(session) } ||
|
||||
receiverParameter?.typeRef?.coneType?.isSomeFunctionType(session) == true)
|
||||
|
||||
override fun serializeProperty(
|
||||
property: FirProperty,
|
||||
|
||||
+3
-3
@@ -172,8 +172,8 @@ class FirJvmTypeMapper(val session: FirSession) : FirSessionComponent {
|
||||
val parameters = classifier?.typeParameters.orEmpty().map { it.symbol }
|
||||
val arguments = type.arguments
|
||||
|
||||
if ((defaultType.isSimpleFunctionType(session) && arguments.size > BuiltInFunctionArity.BIG_ARITY)
|
||||
|| defaultType.isReflectFunctionalType(session)
|
||||
if ((defaultType.isBasicFunctionType(session) && arguments.size > BuiltInFunctionArity.BIG_ARITY)
|
||||
|| defaultType.isReflectFunctionType(session)
|
||||
) {
|
||||
writeGenericArguments(sw, listOf(arguments.last()), listOf(parameters.last()), mode)
|
||||
return
|
||||
@@ -264,7 +264,7 @@ class ConeTypeSystemCommonBackendContextForTypeMapping(
|
||||
|
||||
override fun SimpleTypeMarker.isSuspendFunction(): Boolean {
|
||||
require(this is ConeSimpleKotlinType)
|
||||
return isSuspendFunctionType(session)
|
||||
return isSuspendOrKSuspendFunctionType(session)
|
||||
}
|
||||
|
||||
override fun SimpleTypeMarker.isKClass(): Boolean {
|
||||
|
||||
+1
-1
@@ -538,7 +538,7 @@ class Fir2IrDeclarationStorage(
|
||||
?: if (isLambda) SpecialNames.ANONYMOUS else Name.special("<no name provided>")
|
||||
val visibility = simpleFunction?.visibility ?: Visibilities.Local
|
||||
val isSuspend =
|
||||
if (isLambda) ((function as FirAnonymousFunction).typeRef as? FirResolvedTypeRef)?.type?.isSuspendFunctionType(session) == true
|
||||
if (isLambda) ((function as FirAnonymousFunction).typeRef as? FirResolvedTypeRef)?.type?.isSuspendOrKSuspendFunctionType(session) == true
|
||||
else simpleFunction?.isSuspend == true
|
||||
val created = function.convertWithOffsets { startOffset, endOffset ->
|
||||
val result = declareIrSimpleFunction(signature, simpleFunction?.containerSource) { symbol ->
|
||||
|
||||
+6
-6
@@ -134,7 +134,7 @@ internal class AdapterGenerator(
|
||||
}
|
||||
|
||||
internal fun ConeKotlinType.kFunctionTypeToFunctionType(): IrSimpleType =
|
||||
reflectFunctionalTypeToNonReflectFunctionalType(session).toIrType() as IrSimpleType
|
||||
reflectFunctionTypeToNonReflectFunctionType(session).toIrType() as IrSimpleType
|
||||
|
||||
internal fun generateAdaptedCallableReference(
|
||||
callableReferenceAccess: FirCallableReferenceAccess,
|
||||
@@ -479,7 +479,7 @@ internal class AdapterGenerator(
|
||||
}
|
||||
// If the expected type is a built-in functional type, we don't need SAM conversion.
|
||||
val expectedType = argument.getExpectedType(parameter)
|
||||
if (expectedType is ConeTypeParameterType || expectedType.isSomeFunctionalType(session)) {
|
||||
if (expectedType is ConeTypeParameterType || expectedType.isSomeFunctionType(session)) {
|
||||
return false
|
||||
}
|
||||
// On the other hand, the actual type should be either a functional type or a subtype of a class that has a contributed `invoke`.
|
||||
@@ -514,10 +514,10 @@ internal class AdapterGenerator(
|
||||
return this
|
||||
}
|
||||
// Expect the expected type to be a suspend functional type.
|
||||
if (!parameterType.isSuspendFunctionType(session)) {
|
||||
if (!parameterType.isSuspendOrKSuspendFunctionType(session)) {
|
||||
return this
|
||||
}
|
||||
val expectedFunctionalType = parameterType.customFunctionalTypeToSimpleFunctionalType(session)
|
||||
val expectedFunctionalType = parameterType.customFunctionTypeToSimpleFunctionType(session)
|
||||
if (this is IrVararg) {
|
||||
// element-wise conversion if and only if we can build 1-to-1 mapping for elements.
|
||||
return applyConversionOnVararg(argument) { firVarargArgument ->
|
||||
@@ -546,9 +546,9 @@ internal class AdapterGenerator(
|
||||
argument: FirExpression
|
||||
): IrSimpleFunctionSymbol? {
|
||||
val argumentType = argument.typeRef.coneType
|
||||
val argumentTypeWithInvoke = argumentType.findSubtypeOfSimpleFunctionalType(session, expectedFunctionalType) ?: return null
|
||||
val argumentTypeWithInvoke = argumentType.findSubtypeOfBasicFunctionType(session, expectedFunctionalType) ?: return null
|
||||
|
||||
return if (argumentTypeWithInvoke.isSomeFunctionalType(session)) {
|
||||
return if (argumentTypeWithInvoke.isSomeFunctionType(session)) {
|
||||
(argumentTypeWithInvoke as? ConeClassLikeType)?.findBaseInvokeSymbol(session, scopeSession)
|
||||
} else {
|
||||
argumentTypeWithInvoke.findContributedInvokeSymbol(
|
||||
|
||||
+1
-1
@@ -188,7 +188,7 @@ class CallAndReferenceGenerator(
|
||||
// This would cause ClassCastException in case of usual type approximation,
|
||||
// because '{ X1 & ... & Xm }' would be approximated to 'Nothing'.
|
||||
// JVM_OLD just relies on type mapping for generic argument types in such case.
|
||||
if (!kotlinType.isReflectFunctionalType(session))
|
||||
if (!kotlinType.isReflectFunctionType(session))
|
||||
return kotlinType
|
||||
if (kotlinType !is ConeSimpleKotlinType)
|
||||
return kotlinType
|
||||
|
||||
Reference in New Issue
Block a user