Move static constants with builtin names to :core:descriptors.common module

This commit is contained in:
Dmitriy Novozhilov
2020-08-16 22:57:12 +03:00
parent 2e92fe9be9
commit 7a7fe77b8e
180 changed files with 1085 additions and 1025 deletions
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.backend.common.ir
import org.jetbrains.kotlin.backend.common.CommonBackendContext
import org.jetbrains.kotlin.backend.common.lower.LocalDeclarationsLowering
import org.jetbrains.kotlin.builtins.*
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames.KOTLIN_REFLECT_FQ_NAME
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor
import org.jetbrains.kotlin.descriptors.findClassAcrossModuleDependencies
@@ -317,7 +318,7 @@ abstract class Symbols<out T : CommonBackendContext>(val context: T, irBuiltIns:
function.getPackageFragment()!!.fqName.asString() == "kotlin" &&
function.valueParameters.isEmpty() &&
symbol.owner.extensionReceiverParameter?.type?.classOrNull?.owner.let { receiverClass ->
receiverClass?.fqNameWhenAvailable?.toUnsafe() == KotlinBuiltIns.FQ_NAMES.kProperty0
receiverClass?.fqNameWhenAvailable?.toUnsafe() == KotlinBuiltInsNames.FqNames.kProperty0
}
}
@@ -8,7 +8,7 @@ package org.jetbrains.kotlin.backend.common.lower
import org.jetbrains.kotlin.backend.common.CommonBackendContext
import org.jetbrains.kotlin.backend.common.FileLoweringPass
import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.declarations.IrFile
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
@@ -72,8 +72,8 @@ class FlattenStringConcatenationLowering(val context: CommonBackendContext) : Fi
// The version for nullable strings has FqName kotlin.plus, the version for non-nullable strings
// is a member function of kotlin.String (with FqName kotlin.String.plus)
private val PARENT_NAMES = setOf(
KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME,
KotlinBuiltIns.FQ_NAMES.string.toSafe()
KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME,
KotlinBuiltInsNames.FqNames.string.toSafe()
)
/** @return true if the given expression is a call to [String.plus] */
@@ -108,7 +108,7 @@ class FlattenStringConcatenationLowering(val context: CommonBackendContext) : Fi
return dispatchReceiverParameter == null
&& extensionReceiverParameter?.type?.isNullableAny() == true
&& fqNameWhenAvailable?.parent() == KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME
&& fqNameWhenAvailable?.parent() == KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME
}
/** @return true if the given expression is a call to [toString] */
@@ -7,7 +7,7 @@ package org.jetbrains.kotlin.backend.common.lower
import org.jetbrains.kotlin.backend.common.CommonBackendContext
import org.jetbrains.kotlin.backend.common.ir.allOverridden
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
@@ -63,46 +63,46 @@ class SpecialBridgeMethods(val context: CommonBackendContext) {
IrGetValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, bridge.valueParameters[1].symbol)
private val specialMethodsWithDefaults = mapOf(
makeDescription(KotlinBuiltIns.FQ_NAMES.collection, "contains", 1) to
makeDescription(KotlinBuiltInsNames.FqNames.collection, "contains", 1) to
SpecialMethodWithDefaultInfo(::constFalse, 1),
makeDescription(KotlinBuiltIns.FQ_NAMES.mutableCollection, "remove", 1) to
makeDescription(KotlinBuiltInsNames.FqNames.mutableCollection, "remove", 1) to
SpecialMethodWithDefaultInfo(::constFalse, 1, needsArgumentBoxing = true),
makeDescription(KotlinBuiltIns.FQ_NAMES.map, "containsKey", 1) to
makeDescription(KotlinBuiltInsNames.FqNames.map, "containsKey", 1) to
SpecialMethodWithDefaultInfo(::constFalse, 1),
makeDescription(KotlinBuiltIns.FQ_NAMES.map, "containsValue", 1) to
makeDescription(KotlinBuiltInsNames.FqNames.map, "containsValue", 1) to
SpecialMethodWithDefaultInfo(::constFalse, 1),
makeDescription(KotlinBuiltIns.FQ_NAMES.mutableMap, "remove", 2) to
makeDescription(KotlinBuiltInsNames.FqNames.mutableMap, "remove", 2) to
SpecialMethodWithDefaultInfo(::constFalse, 2),
makeDescription(KotlinBuiltIns.FQ_NAMES.list, "indexOf", 1) to
makeDescription(KotlinBuiltInsNames.FqNames.list, "indexOf", 1) to
SpecialMethodWithDefaultInfo(::constMinusOne, 1),
makeDescription(KotlinBuiltIns.FQ_NAMES.list, "lastIndexOf", 1) to
makeDescription(KotlinBuiltInsNames.FqNames.list, "lastIndexOf", 1) to
SpecialMethodWithDefaultInfo(::constMinusOne, 1),
makeDescription(KotlinBuiltIns.FQ_NAMES.map, "getOrDefault", 2) to
makeDescription(KotlinBuiltInsNames.FqNames.map, "getOrDefault", 2) to
SpecialMethodWithDefaultInfo(::getSecondArg, 1, needsGenericSignature = true),
makeDescription(KotlinBuiltIns.FQ_NAMES.map, "get", 1) to
makeDescription(KotlinBuiltInsNames.FqNames.map, "get", 1) to
SpecialMethodWithDefaultInfo(::constNull, 1, needsGenericSignature = true),
makeDescription(KotlinBuiltIns.FQ_NAMES.mutableMap, "remove", 1) to
makeDescription(KotlinBuiltInsNames.FqNames.mutableMap, "remove", 1) to
SpecialMethodWithDefaultInfo(::constNull, 1, needsGenericSignature = true)
)
private val specialProperties = mapOf(
makeDescription(KotlinBuiltIns.FQ_NAMES.collection, "size") to BuiltInWithDifferentJvmName(),
makeDescription(KotlinBuiltIns.FQ_NAMES.map, "size") to BuiltInWithDifferentJvmName(),
makeDescription(KotlinBuiltIns.FQ_NAMES.charSequence.toSafe(), "length") to BuiltInWithDifferentJvmName(),
makeDescription(KotlinBuiltIns.FQ_NAMES.map, "keys") to BuiltInWithDifferentJvmName(needsGenericSignature = true),
makeDescription(KotlinBuiltIns.FQ_NAMES.map, "values") to BuiltInWithDifferentJvmName(needsGenericSignature = true),
makeDescription(KotlinBuiltIns.FQ_NAMES.map, "entries") to BuiltInWithDifferentJvmName(needsGenericSignature = true)
makeDescription(KotlinBuiltInsNames.FqNames.collection, "size") to BuiltInWithDifferentJvmName(),
makeDescription(KotlinBuiltInsNames.FqNames.map, "size") to BuiltInWithDifferentJvmName(),
makeDescription(KotlinBuiltInsNames.FqNames.charSequence.toSafe(), "length") to BuiltInWithDifferentJvmName(),
makeDescription(KotlinBuiltInsNames.FqNames.map, "keys") to BuiltInWithDifferentJvmName(needsGenericSignature = true),
makeDescription(KotlinBuiltInsNames.FqNames.map, "values") to BuiltInWithDifferentJvmName(needsGenericSignature = true),
makeDescription(KotlinBuiltInsNames.FqNames.map, "entries") to BuiltInWithDifferentJvmName(needsGenericSignature = true)
)
private val specialMethods = mapOf(
makeDescription(KotlinBuiltIns.FQ_NAMES.number.toSafe(), "toByte") to BuiltInWithDifferentJvmName(),
makeDescription(KotlinBuiltIns.FQ_NAMES.number.toSafe(), "toShort") to BuiltInWithDifferentJvmName(),
makeDescription(KotlinBuiltIns.FQ_NAMES.number.toSafe(), "toInt") to BuiltInWithDifferentJvmName(),
makeDescription(KotlinBuiltIns.FQ_NAMES.number.toSafe(), "toLong") to BuiltInWithDifferentJvmName(),
makeDescription(KotlinBuiltIns.FQ_NAMES.number.toSafe(), "toFloat") to BuiltInWithDifferentJvmName(),
makeDescription(KotlinBuiltIns.FQ_NAMES.number.toSafe(), "toDouble") to BuiltInWithDifferentJvmName(),
makeDescription(KotlinBuiltIns.FQ_NAMES.charSequence.toSafe(), "get", 1) to BuiltInWithDifferentJvmName(),
makeDescription(KotlinBuiltIns.FQ_NAMES.mutableList, "removeAt", 1) to BuiltInWithDifferentJvmName(needsGenericSignature = true)
makeDescription(KotlinBuiltInsNames.FqNames.number.toSafe(), "toByte") to BuiltInWithDifferentJvmName(),
makeDescription(KotlinBuiltInsNames.FqNames.number.toSafe(), "toShort") to BuiltInWithDifferentJvmName(),
makeDescription(KotlinBuiltInsNames.FqNames.number.toSafe(), "toInt") to BuiltInWithDifferentJvmName(),
makeDescription(KotlinBuiltInsNames.FqNames.number.toSafe(), "toLong") to BuiltInWithDifferentJvmName(),
makeDescription(KotlinBuiltInsNames.FqNames.number.toSafe(), "toFloat") to BuiltInWithDifferentJvmName(),
makeDescription(KotlinBuiltInsNames.FqNames.number.toSafe(), "toDouble") to BuiltInWithDifferentJvmName(),
makeDescription(KotlinBuiltInsNames.FqNames.charSequence.toSafe(), "get", 1) to BuiltInWithDifferentJvmName(),
makeDescription(KotlinBuiltInsNames.FqNames.mutableList, "removeAt", 1) to BuiltInWithDifferentJvmName(needsGenericSignature = true)
)
val specialMethodNames = (specialMethodsWithDefaults + specialMethods).map { (description) -> description.name }.toHashSet()
@@ -5,7 +5,7 @@
package org.jetbrains.kotlin.ir.util
import org.jetbrains.kotlin.builtins.KotlinBuiltIns.FQ_NAMES
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames.FqNames
import org.jetbrains.kotlin.builtins.UnsignedTypes
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.ir.declarations.IrClass
@@ -70,10 +70,10 @@ private inline fun IrType.isTypeFromKotlinPackage(namePredicate: (Name) -> Boole
} else return false
}
fun IrType.isPrimitiveArray() = isTypeFromKotlinPackage { it in FQ_NAMES.primitiveArrayTypeShortNames }
fun IrType.isPrimitiveArray() = isTypeFromKotlinPackage { it in FqNames.primitiveArrayTypeShortNames }
fun IrType.getPrimitiveArrayElementType() = (this as? IrSimpleType)?.let {
(it.classifier.owner as? IrClass)?.fqNameWhenAvailable?.toUnsafe()?.let { fqn -> FQ_NAMES.arrayClassFqNameToPrimitiveType[fqn] }
(it.classifier.owner as? IrClass)?.fqNameWhenAvailable?.toUnsafe()?.let { fqn -> FqNames.arrayClassFqNameToPrimitiveType[fqn] }
}
fun IrType.substitute(params: List<IrTypeParameter>, arguments: List<IrType>): IrType =
@@ -7,7 +7,7 @@ package org.jetbrains.kotlin.backend.jvm
import org.jetbrains.kotlin.backend.common.ir.createImplicitParameterDeclarationWithWrappedDescriptor
import org.jetbrains.kotlin.backend.common.ir.createParameterDeclarations
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
import org.jetbrains.kotlin.codegen.SamType
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.annotations.FilteredAnnotations
@@ -106,7 +106,7 @@ class JvmGeneratorExtensions(private val generateFacades: Boolean = true) : Gene
descriptor.getParentJavaStaticClassScope()
private val annotationPackage =
IrExternalPackageFragmentImpl(DescriptorlessExternalPackageFragmentSymbol(), KotlinBuiltIns.ANNOTATION_PACKAGE_FQ_NAME)
IrExternalPackageFragmentImpl(DescriptorlessExternalPackageFragmentSymbol(), KotlinBuiltInsNames.ANNOTATION_PACKAGE_FQ_NAME)
private val flexibleNullabilityAnnotationClass = IrFactoryImpl.buildClass {
kind = ClassKind.ANNOTATION_CLASS
@@ -123,6 +123,6 @@ class JvmGeneratorExtensions(private val generateFacades: Boolean = true) : Gene
companion object {
val FLEXIBLE_NULLABILITY_ANNOTATION_FQ_NAME =
KotlinBuiltIns.ANNOTATION_PACKAGE_FQ_NAME.child(Name.identifier("FlexibleNullability"))
KotlinBuiltInsNames.ANNOTATION_PACKAGE_FQ_NAME.child(Name.identifier("FlexibleNullability"))
}
}
@@ -10,7 +10,7 @@ package org.jetbrains.kotlin.backend.jvm
import org.jetbrains.kotlin.backend.common.ir.Symbols
import org.jetbrains.kotlin.backend.common.ir.createImplicitParameterDeclarationWithWrappedDescriptor
import org.jetbrains.kotlin.backend.jvm.intrinsics.IrIntrinsicMethods
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
import org.jetbrains.kotlin.codegen.coroutines.INVOKE_SUSPEND_METHOD_NAME
import org.jetbrains.kotlin.codegen.coroutines.SUSPEND_CALL_RESULT_NAME
import org.jetbrains.kotlin.codegen.coroutines.SUSPEND_FUNCTION_COMPLETION_PARAMETER_NAME
@@ -29,7 +29,6 @@ import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import org.jetbrains.kotlin.storage.LockBasedStorageManager
import org.jetbrains.kotlin.types.Variance
@@ -201,7 +200,7 @@ class JvmSymbols(
get() = TODO("not implemented")
private val kDeclarationContainer: IrClassSymbol =
createClass(KotlinBuiltIns.FQ_NAMES.kDeclarationContainer.toSafe(), ClassKind.INTERFACE, Modality.ABSTRACT)
createClass(KotlinBuiltInsNames.FqNames.kDeclarationContainer.toSafe(), ClassKind.INTERFACE, Modality.ABSTRACT)
val javaLangClass: IrClassSymbol =
createClass(FqName("java.lang.Class")) { klass ->
@@ -226,12 +225,12 @@ class JvmSymbols(
val assertionErrorConstructor = javaLangAssertionError.constructors.single()
val continuationClass: IrClassSymbol =
createClass(DescriptorUtils.CONTINUATION_INTERFACE_FQ_NAME_RELEASE, ClassKind.INTERFACE) { klass ->
createClass(KotlinBuiltInsNames.CONTINUATION_INTERFACE_FQ_NAME_RELEASE, ClassKind.INTERFACE) { klass ->
klass.addTypeParameter("T", irBuiltIns.anyNType, Variance.IN_VARIANCE)
}
private val resultClassStub: IrClassSymbol =
createClass(DescriptorUtils.RESULT_FQ_NAME, classIsInline = true) { klass ->
createClass(KotlinBuiltInsNames.RESULT_FQ_NAME, classIsInline = true) { klass ->
klass.addTypeParameter("T", irBuiltIns.anyNType, Variance.OUT_VARIANCE)
klass.addConstructor { isPrimary = true }.apply {
addValueParameter("value", irBuiltIns.anyNType)
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.backend.common.ir.ir2string
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
import org.jetbrains.kotlin.backend.jvm.JvmGeneratorExtensions
import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
import org.jetbrains.kotlin.codegen.AsmUtil
import org.jetbrains.kotlin.codegen.TypeAnnotationCollector
import org.jetbrains.kotlin.codegen.TypePathInfo
@@ -373,7 +373,7 @@ private val RETENTION_PARAMETER_NAME = Name.identifier("value")
private fun IrClass.getAnnotationRetention(): KotlinRetention? {
val retentionArgument =
getAnnotation(KotlinBuiltIns.FQ_NAMES.retention)?.getValueArgument(RETENTION_PARAMETER_NAME)
getAnnotation(KotlinBuiltInsNames.FqNames.retention)?.getValueArgument(RETENTION_PARAMETER_NAME)
as? IrGetEnumValue?: return null
val retentionArgumentValue = retentionArgument.symbol.owner
return KotlinRetention.valueOf(retentionArgumentValue.name.asString())
@@ -393,7 +393,7 @@ private fun IrConstructorCall.getValueArgument(name: Name): IrExpression? {
private val TARGET_ALLOWED_TARGETS = Name.identifier("allowedTargets")
private fun IrClass.applicableTargetSet(): Set<KotlinTarget>? {
val targetEntry = getAnnotation(KotlinBuiltIns.FQ_NAMES.target) ?: return null
val targetEntry = getAnnotation(KotlinBuiltInsNames.FqNames.target) ?: return null
return loadAnnotationTargets(targetEntry)
}
@@ -16,7 +16,7 @@ import org.jetbrains.kotlin.backend.jvm.ir.isCompiledToJvmDefault
import org.jetbrains.kotlin.backend.jvm.ir.isStaticInlineClassReplacement
import org.jetbrains.kotlin.backend.jvm.ir.propertyIfAccessor
import org.jetbrains.kotlin.backend.jvm.lower.suspendFunctionOriginal
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap
import org.jetbrains.kotlin.codegen.JvmCodegenUtil
import org.jetbrains.kotlin.codegen.replaceValueParametersIn
@@ -130,7 +130,7 @@ class MethodSignatureMapper(private val context: JvmBackendContext) {
else null) ?: context.state.moduleName
private fun IrFunction.isPublishedApi(): Boolean =
propertyIfAccessor.annotations.hasAnnotation(KotlinBuiltIns.FQ_NAMES.publishedApi)
propertyIfAccessor.annotations.hasAnnotation(KotlinBuiltInsNames.FqNames.publishedApi)
fun mapReturnType(declaration: IrDeclaration, sw: JvmSignatureWriter? = null): Type {
if (declaration !is IrFunction) {
@@ -369,7 +369,7 @@ class MethodSignatureMapper(private val context: JvmBackendContext) {
}
private val IrSimpleFunction.isBuiltIn: Boolean
get() = getPackageFragment()?.fqName == KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME ||
get() = getPackageFragment()?.fqName == KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME ||
parent.safeAs<IrClass>()?.fqNameWhenAvailable?.toUnsafe()?.let(JavaToKotlinClassMap::mapKotlinToJava) != null
// From BuiltinMethodsWithDifferentJvmName.isBuiltinFunctionWithDifferentNameInJvm, BuiltinMethodsWithDifferentJvmName.getJvmName
@@ -424,4 +424,4 @@ class MethodSignatureMapper(private val context: JvmBackendContext) {
}
return null
}
}
}
@@ -11,7 +11,7 @@ import org.jetbrains.kotlin.backend.common.ir.ir2string
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
import org.jetbrains.kotlin.backend.jvm.lower.MultifileFacadeFileEntry
import org.jetbrains.kotlin.builtins.KotlinBuiltIns.FQ_NAMES
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames.FqNames
import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap
import org.jetbrains.kotlin.codegen.*
import org.jetbrains.kotlin.codegen.inline.SourceMapper
@@ -105,7 +105,7 @@ fun JvmBackendContext.getSourceMapper(declaration: IrClass): SourceMapper {
}
val IrType.isExtensionFunctionType: Boolean
get() = isFunctionTypeOrSubtype() && hasAnnotation(FQ_NAMES.extensionFunctionType)
get() = isFunctionTypeOrSubtype() && hasAnnotation(FqNames.extensionFunctionType)
/* Borrowed with modifications from MemberCodegen.java */
@@ -409,7 +409,7 @@ fun IrClass.isOptionalAnnotationClass(): Boolean =
val IrAnnotationContainer.deprecationFlags: Int
get() {
val annotation = annotations.findAnnotation(FQ_NAMES.deprecated)
val annotation = annotations.findAnnotation(FqNames.deprecated)
?: return if ((this as? IrDeclaration)?.origin?.let {
it == JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY
} == true
@@ -17,9 +17,12 @@
package org.jetbrains.kotlin.backend.jvm.intrinsics
import org.jetbrains.kotlin.backend.jvm.JvmSymbols
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
import org.jetbrains.kotlin.builtins.PrimitiveType
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrPackageFragment
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
@@ -43,11 +46,11 @@ class IrIntrinsicMethods(val irBuiltIns: IrBuiltIns, val symbols: JvmSymbols) {
private val intrinsicsMap = (
listOf(
Key(kotlinJvm, FqName("T"), "<get-javaClass>", emptyList()) to JavaClassProperty,
Key(kotlinJvm, KotlinBuiltIns.FQ_NAMES.kClass.toSafe(), "<get-javaObjectType>", emptyList()) to GetJavaObjectType,
Key(kotlinJvm, KotlinBuiltIns.FQ_NAMES.kClass.toSafe(), "<get-javaPrimitiveType>", emptyList()) to GetJavaPrimitiveType,
Key(kotlinJvm, KotlinBuiltInsNames.FqNames.kClass.toSafe(), "<get-javaObjectType>", emptyList()) to GetJavaObjectType,
Key(kotlinJvm, KotlinBuiltInsNames.FqNames.kClass.toSafe(), "<get-javaPrimitiveType>", emptyList()) to GetJavaPrimitiveType,
Key(
kotlinJvm,
KotlinBuiltIns.FQ_NAMES.kClass.toSafe(),
KotlinBuiltInsNames.FqNames.kClass.toSafe(),
"<get-java>",
emptyList()
) to KClassJavaProperty,
@@ -55,49 +58,49 @@ class IrIntrinsicMethods(val irBuiltIns: IrBuiltIns, val symbols: JvmSymbols) {
kotlinJvmInternalUnsafe,
null,
"access\$monitorEnter",
listOf(KotlinBuiltIns.FQ_NAMES.any.toSafe())
listOf(KotlinBuiltInsNames.FqNames.any.toSafe())
) to MonitorInstruction.MONITOR_ENTER,
Key(
kotlinJvmInternalUnsafe,
null,
"access\$monitorExit",
listOf(KotlinBuiltIns.FQ_NAMES.any.toSafe())
listOf(KotlinBuiltInsNames.FqNames.any.toSafe())
) to MonitorInstruction.MONITOR_EXIT,
Key(
kotlinJvm,
KotlinBuiltIns.FQ_NAMES.array.toSafe(),
KotlinBuiltInsNames.FqNames.array.toSafe(),
"isArrayOf",
emptyList()
) to IsArrayOf,
Key(
KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME,
KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME,
null,
"arrayOfNulls",
listOf(KotlinBuiltIns.FQ_NAMES._int.toSafe())
listOf(KotlinBuiltInsNames.FqNames._int.toSafe())
) to NewArray,
Key(
KotlinBuiltIns.FQ_NAMES.cloneable.toSafe(),
KotlinBuiltInsNames.FqNames.cloneable.toSafe(),
null,
"clone",
emptyList()
) to Clone,
Key(
KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME,
KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME,
null,
"enumValues",
listOf()
) to EnumValues,
Key(
KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME,
KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME,
null,
"enumValueOf",
listOf(KotlinBuiltIns.FQ_NAMES.string.toSafe())
listOf(KotlinBuiltInsNames.FqNames.string.toSafe())
) to EnumValueOf,
Key(
KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME,
KotlinBuiltIns.FQ_NAMES.string.toSafe(),
KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME,
KotlinBuiltInsNames.FqNames.string.toSafe(),
"plus",
listOf(KotlinBuiltIns.FQ_NAMES.any.toSafe())
listOf(KotlinBuiltInsNames.FqNames.any.toSafe())
) to StringPlus,
irBuiltIns.eqeqSymbol.toKey()!! to Equals(KtTokens.EQEQ),
irBuiltIns.eqeqeqSymbol.toKey()!! to Equals(KtTokens.EQEQEQ),
@@ -17,12 +17,10 @@
package org.jetbrains.kotlin.backend.jvm.intrinsics
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
import org.jetbrains.kotlin.builtins.KotlinBuiltIns.COLLECTIONS_PACKAGE_FQ_NAME
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames.COLLECTIONS_PACKAGE_FQ_NAME
import org.jetbrains.kotlin.codegen.AsmUtil
import org.jetbrains.kotlin.fileClasses.internalNameWithoutInnerClasses
import org.jetbrains.kotlin.ir.expressions.IrFunctionAccessExpression
import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression
import org.jetbrains.kotlin.ir.types.isPrimitiveType
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType
@@ -9,7 +9,7 @@ import org.jetbrains.kotlin.backend.common.ClassLoweringPass
import org.jetbrains.kotlin.backend.common.ir.addChild
import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
import org.jetbrains.kotlin.config.JvmTarget
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.descriptors.annotations.KotlinRetention
@@ -127,7 +127,7 @@ private class AdditionalClassAnnotationLowering(private val context: JvmBackendC
}
private fun generateDocumentedAnnotation(irClass: IrClass) {
if (!irClass.hasAnnotation(KotlinBuiltIns.FQ_NAMES.mustBeDocumented) ||
if (!irClass.hasAnnotation(KotlinBuiltInsNames.FqNames.mustBeDocumented) ||
irClass.hasAnnotation(FqName("java.lang.annotation.Documented"))
) return
@@ -228,7 +228,7 @@ private fun IrConstructorCall.getValueArgument(name: Name): IrExpression? {
private val TARGET_ALLOWED_TARGETS = Name.identifier("allowedTargets")
private fun IrClass.applicableTargetSet(): Set<KotlinTarget>? {
val targetEntry = getAnnotation(KotlinBuiltIns.FQ_NAMES.target) ?: return null
val targetEntry = getAnnotation(KotlinBuiltInsNames.FqNames.target) ?: return null
return loadAnnotationTargets(targetEntry)
}
@@ -238,4 +238,4 @@ private fun loadAnnotationTargets(targetEntry: IrConstructorCall): Set<KotlinTar
return valueArgument.elements.filterIsInstance<IrGetEnumValue>().mapNotNull {
KotlinTarget.valueOrNull(it.symbol.owner.name.asString())
}.toSet()
}
}
@@ -12,7 +12,7 @@ import org.jetbrains.kotlin.backend.common.lower.*
import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
import org.jetbrains.kotlin.codegen.ASSERTIONS_DISABLED_FIELD_NAME
import org.jetbrains.kotlin.config.JVMAssertionsMode
import org.jetbrains.kotlin.ir.IrElement
@@ -129,7 +129,7 @@ private class AssertionLowering(private val context: JvmBackendContext) :
}
private val IrFunction.isAssert: Boolean
get() = name.asString() == "assert" && getPackageFragment()?.fqName == KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME
get() = name.asString() == "assert" && getPackageFragment()?.fqName == KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME
}
private fun IrBuilderWithScope.getJavaClass(backendContext: JvmBackendContext, irClass: IrClass) =
@@ -15,7 +15,7 @@ import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
import org.jetbrains.kotlin.backend.jvm.ir.createJvmIrBuilder
import org.jetbrains.kotlin.backend.jvm.ir.irArray
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
import org.jetbrains.kotlin.builtins.functions.FunctionInvokeDescriptor
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.Visibilities
@@ -150,7 +150,7 @@ private class FunctionNVarargBridgeLowering(val context: JvmBackendContext) :
val fqName = clazz.parent.safeAs<IrPackageFragment>()?.fqName ?: return false
return when {
name.startsWith("Function") ->
fqName == KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME || fqName == FUNCTIONS_PACKAGE_FQ_NAME
fqName == KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME || fqName == FUNCTIONS_PACKAGE_FQ_NAME
name.startsWith("KFunction") ->
fqName == REFLECT_PACKAGE_FQ_NAME
else -> false
@@ -169,11 +169,11 @@ private class FunctionNVarargBridgeLowering(val context: JvmBackendContext) :
}
private val FUNCTIONS_PACKAGE_FQ_NAME =
KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME
KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME
.child(Name.identifier("jvm"))
.child(Name.identifier("functions"))
private val REFLECT_PACKAGE_FQ_NAME =
KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME
KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME
.child(Name.identifier("reflect"))
}
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
import org.jetbrains.kotlin.backend.jvm.lower.inlineclasses.*
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
import org.jetbrains.kotlin.config.ApiVersion
import org.jetbrains.kotlin.descriptors.Visibilities
import org.jetbrains.kotlin.ir.IrStatement
@@ -40,7 +41,6 @@ import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
import org.jetbrains.kotlin.load.java.JvmAbi
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
val jvmInlineClassPhase = makeIrFilePhase(
@@ -398,7 +398,7 @@ private class JvmInlineClassLowering(private val context: JvmBackendContext) : F
?: return false
// Before version 1.4, we cannot rely on the Result.equals-impl0 method
return (leftClass.fqNameWhenAvailable != DescriptorUtils.RESULT_FQ_NAME) ||
return (leftClass.fqNameWhenAvailable != KotlinBuiltInsNames.RESULT_FQ_NAME) ||
context.state.languageVersionSettings.apiVersion >= ApiVersion.KOTLIN_1_4
}
@@ -13,7 +13,7 @@ import org.jetbrains.kotlin.backend.jvm.ir.IrArrayBuilder
import org.jetbrains.kotlin.backend.jvm.ir.createJvmIrBuilder
import org.jetbrains.kotlin.backend.jvm.ir.irArray
import org.jetbrains.kotlin.backend.jvm.ir.irArrayOf
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
import org.jetbrains.kotlin.builtins.PrimitiveType
import org.jetbrains.kotlin.builtins.UnsignedType
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
@@ -106,7 +106,7 @@ private class VarargLowering(val context: JvmBackendContext) : FileLoweringPass,
private val IrFunctionSymbol.isEmptyArray: Boolean
get() = owner.name.asString() == "emptyArray" &&
(owner.parent as? IrPackageFragment)?.fqName == KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME
(owner.parent as? IrPackageFragment)?.fqName == KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME
companion object {
private val PRIMITIVE_ARRAY_OF_NAMES: Set<String> =
@@ -122,7 +122,7 @@ private class VarargLowering(val context: JvmBackendContext) : FileLoweringPass,
is IrPackageFragment -> directParent
else -> return false
}
return parent.fqName == KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME &&
return parent.fqName == KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME &&
name.asString().let { it in PRIMITIVE_ARRAY_OF_NAMES || it == ARRAY_OF_NAME } &&
extensionReceiverParameter == null &&
dispatchReceiverParameter == null &&
@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.backend.jvm.lower.inlineclasses
import org.jetbrains.kotlin.backend.jvm.ir.erasedUpperBound
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
import org.jetbrains.kotlin.codegen.state.md5base64
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.IrStatementOriginImpl
@@ -13,7 +14,6 @@ import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.load.java.JvmAbi
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.DescriptorUtils
/**
* Replace inline classes by their underlying types.
@@ -114,7 +114,7 @@ object InlineClassAbi {
internal val IrType.requiresMangling: Boolean
get() {
val irClass = erasedUpperBound
return irClass.isInline && irClass.fqNameWhenAvailable != DescriptorUtils.RESULT_FQ_NAME
return irClass.isInline && irClass.fqNameWhenAvailable != KotlinBuiltInsNames.RESULT_FQ_NAME
}
internal val IrFunction.fullValueParameterList: List<IrValueParameter>
@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.psi2ir.transformations
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
import org.jetbrains.kotlin.builtins.isFunctionType
import org.jetbrains.kotlin.builtins.isSuspendFunctionType
import org.jetbrains.kotlin.descriptors.*
@@ -451,7 +452,7 @@ internal class InsertImplicitCasts(
// There are several such functions (one for each built-in integer type: Byte, Short, Int, Long),
// we need one that takes Int.
val coercionFunction = targetType.constructor.declarationDescriptor!!.module
.getPackage(KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME)
.getPackage(KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME)
.memberScope.getContributedFunctions(Name.identifier(coercionFunName), NoLookupLocation.FROM_BACKEND)
.find {
val extensionReceiver = it.extensionReceiverParameter
@@ -5,7 +5,7 @@
package org.jetbrains.kotlin.ir.descriptors
import org.jetbrains.kotlin.builtins.KOTLIN_REFLECT_FQ_NAME
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames.KOTLIN_REFLECT_FQ_NAME
import org.jetbrains.kotlin.builtins.functions.FunctionClassDescriptor
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
@@ -5,7 +5,7 @@
package org.jetbrains.kotlin.ir.types
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
import org.jetbrains.kotlin.builtins.PrimitiveType
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.descriptors.Modality
@@ -202,10 +202,10 @@ interface IrTypeSystemContext : TypeSystemContext, TypeSystemCommonSuperTypesCon
override fun SimpleTypeMarker.asArgumentList() = this as IrSimpleType
override fun TypeConstructorMarker.isAnyConstructor(): Boolean =
this is IrClassSymbol && isClassWithFqName(KotlinBuiltIns.FQ_NAMES.any)
this is IrClassSymbol && isClassWithFqName(KotlinBuiltInsNames.FqNames.any)
override fun TypeConstructorMarker.isNothingConstructor(): Boolean =
this is IrClassSymbol && isClassWithFqName(KotlinBuiltIns.FQ_NAMES.nothing)
this is IrClassSymbol && isClassWithFqName(KotlinBuiltInsNames.FqNames.nothing)
override fun SimpleTypeMarker.isSingleClassifierType() = true
@@ -246,7 +246,7 @@ interface IrTypeSystemContext : TypeSystemContext, TypeSystemCommonSuperTypesCon
override fun SimpleTypeMarker.isExtensionFunction(): Boolean {
require(this is IrSimpleType)
return this.hasAnnotation(KotlinBuiltIns.FQ_NAMES.extensionFunctionType)
return this.hasAnnotation(KotlinBuiltInsNames.FqNames.extensionFunctionType)
}
override fun SimpleTypeMarker.typeDepth(): Int {
@@ -364,7 +364,7 @@ interface IrTypeSystemContext : TypeSystemContext, TypeSystemCommonSuperTypesCon
while (true) {
val parent = declaration.parent
if (parent is IrPackageFragment) {
return parent.fqName.startsWith(KotlinBuiltIns.BUILT_INS_PACKAGE_NAME)
return parent.fqName.startsWith(KotlinBuiltInsNames.BUILT_INS_PACKAGE_NAME)
}
declaration = parent as? IrDeclaration ?: return false
}
@@ -5,7 +5,7 @@
package org.jetbrains.kotlin.ir.types
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
import org.jetbrains.kotlin.ir.symbols.FqNameEqualityChecker
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
@@ -47,7 +47,7 @@ fun IrType.isNullable(): Boolean =
}
val IrType.isBoxedArray: Boolean
get() = classOrNull?.owner?.fqNameWhenAvailable == KotlinBuiltIns.FQ_NAMES.array.toSafe()
get() = classOrNull?.owner?.fqNameWhenAvailable == KotlinBuiltInsNames.FqNames.array.toSafe()
fun IrType.getArrayElementType(irBuiltIns: IrBuiltIns): IrType =
if (isBoxedArray)
@@ -5,13 +5,12 @@
package org.jetbrains.kotlin.ir.types
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable
import org.jetbrains.kotlin.name.FqNameUnsafe
import org.jetbrains.kotlin.resolve.DescriptorUtils
private fun IrType.isNotNullClassType(fqName: FqNameUnsafe) = isClassType(fqName, hasQuestionMark = false)
private fun IrType.isNullableClassType(fqName: FqNameUnsafe) = isClassType(fqName, hasQuestionMark = true)
@@ -33,42 +32,42 @@ private fun classFqNameEquals(symbol: IrClassSymbol, fqName: FqNameUnsafe): Bool
private fun classFqNameEquals(declaration: IrClass, fqName: FqNameUnsafe): Boolean =
declaration.name == fqName.shortName() && fqName == declaration.fqNameWhenAvailable?.toUnsafe()
fun IrType.isAny(): Boolean = isNotNullClassType(KotlinBuiltIns.FQ_NAMES.any)
fun IrType.isNullableAny(): Boolean = isNullableClassType(KotlinBuiltIns.FQ_NAMES.any)
fun IrType.isAny(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.any)
fun IrType.isNullableAny(): Boolean = isNullableClassType(KotlinBuiltInsNames.FqNames.any)
fun IrType.isString(): Boolean = isNotNullClassType(KotlinBuiltIns.FQ_NAMES.string)
fun IrType.isNullableString(): Boolean = isNullableClassType(KotlinBuiltIns.FQ_NAMES.string)
fun IrType.isStringClassType(): Boolean = isClassType(KotlinBuiltIns.FQ_NAMES.string)
fun IrType.isArray(): Boolean = isNotNullClassType(KotlinBuiltIns.FQ_NAMES.array)
fun IrType.isNullableArray(): Boolean = isNullableClassType(KotlinBuiltIns.FQ_NAMES.array)
fun IrType.isCollection(): Boolean = isNotNullClassType(KotlinBuiltIns.FQ_NAMES.collection.toUnsafe())
fun IrType.isNothing(): Boolean = isNotNullClassType(KotlinBuiltIns.FQ_NAMES.nothing)
fun IrType.isKClass(): Boolean = isNotNullClassType(KotlinBuiltIns.FQ_NAMES.kClass)
fun IrType.isString(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.string)
fun IrType.isNullableString(): Boolean = isNullableClassType(KotlinBuiltInsNames.FqNames.string)
fun IrType.isStringClassType(): Boolean = isClassType(KotlinBuiltInsNames.FqNames.string)
fun IrType.isArray(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.array)
fun IrType.isNullableArray(): Boolean = isNullableClassType(KotlinBuiltInsNames.FqNames.array)
fun IrType.isCollection(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.collection.toUnsafe())
fun IrType.isNothing(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.nothing)
fun IrType.isKClass(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.kClass)
fun IrType.isPrimitiveType(): Boolean = KotlinBuiltIns.FQ_NAMES.fqNameToPrimitiveType.keys.any { isNotNullClassType(it) }
fun IrType.isNullablePrimitiveType(): Boolean = KotlinBuiltIns.FQ_NAMES.fqNameToPrimitiveType.keys.any { isNullableClassType(it) }
fun IrType.isPrimitiveType(): Boolean = KotlinBuiltInsNames.FqNames.fqNameToPrimitiveType.keys.any { isNotNullClassType(it) }
fun IrType.isNullablePrimitiveType(): Boolean = KotlinBuiltInsNames.FqNames.fqNameToPrimitiveType.keys.any { isNullableClassType(it) }
fun IrType.isMarkedNullable() = (this as? IrSimpleType)?.hasQuestionMark ?: false
fun IrType.isUnit() = isNotNullClassType(KotlinBuiltIns.FQ_NAMES.unit)
fun IrType.isUnit() = isNotNullClassType(KotlinBuiltInsNames.FqNames.unit)
fun IrType.isBoolean(): Boolean = isNotNullClassType(KotlinBuiltIns.FQ_NAMES._boolean)
fun IrType.isChar(): Boolean = isNotNullClassType(KotlinBuiltIns.FQ_NAMES._char)
fun IrType.isByte(): Boolean = isNotNullClassType(KotlinBuiltIns.FQ_NAMES._byte)
fun IrType.isShort(): Boolean = isNotNullClassType(KotlinBuiltIns.FQ_NAMES._short)
fun IrType.isInt(): Boolean = isNotNullClassType(KotlinBuiltIns.FQ_NAMES._int)
fun IrType.isLong(): Boolean = isNotNullClassType(KotlinBuiltIns.FQ_NAMES._long)
fun IrType.isUByte(): Boolean = isNotNullClassType(KotlinBuiltIns.FQ_NAMES.uByteFqName.toUnsafe())
fun IrType.isUShort(): Boolean = isNotNullClassType(KotlinBuiltIns.FQ_NAMES.uShortFqName.toUnsafe())
fun IrType.isUInt(): Boolean = isNotNullClassType(KotlinBuiltIns.FQ_NAMES.uIntFqName.toUnsafe())
fun IrType.isULong(): Boolean = isNotNullClassType(KotlinBuiltIns.FQ_NAMES.uLongFqName.toUnsafe())
fun IrType.isFloat(): Boolean = isNotNullClassType(KotlinBuiltIns.FQ_NAMES._float)
fun IrType.isDouble(): Boolean = isNotNullClassType(KotlinBuiltIns.FQ_NAMES._double)
fun IrType.isNumber(): Boolean = isNotNullClassType(KotlinBuiltIns.FQ_NAMES.number)
fun IrType.isBoolean(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames._boolean)
fun IrType.isChar(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames._char)
fun IrType.isByte(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames._byte)
fun IrType.isShort(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames._short)
fun IrType.isInt(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames._int)
fun IrType.isLong(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames._long)
fun IrType.isUByte(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.uByteFqName.toUnsafe())
fun IrType.isUShort(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.uShortFqName.toUnsafe())
fun IrType.isUInt(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.uIntFqName.toUnsafe())
fun IrType.isULong(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.uLongFqName.toUnsafe())
fun IrType.isFloat(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames._float)
fun IrType.isDouble(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames._double)
fun IrType.isNumber(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.number)
fun IrType.isComparable(): Boolean = isNotNullClassType(KotlinBuiltIns.FQ_NAMES.comparable.toUnsafe())
fun IrType.isCharSequence(): Boolean = isNotNullClassType(KotlinBuiltIns.FQ_NAMES.charSequence)
fun IrType.isIterable(): Boolean = isNotNullClassType(KotlinBuiltIns.FQ_NAMES.iterable.toUnsafe())
fun IrType.isComparable(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.comparable.toUnsafe())
fun IrType.isCharSequence(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.charSequence)
fun IrType.isIterable(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.iterable.toUnsafe())
fun IrType.isSequence(): Boolean = isNotNullClassType(FqNameUnsafe("kotlin.sequences.Sequence"))
fun IrType.isBooleanArray(): Boolean = isNotNullClassType(FqNameUnsafe("kotlin.BooleanArray"))
@@ -80,5 +79,5 @@ fun IrType.isLongArray(): Boolean = isNotNullClassType(FqNameUnsafe("kotlin.Long
fun IrType.isFloatArray(): Boolean = isNotNullClassType(FqNameUnsafe("kotlin.FloatArray"))
fun IrType.isDoubleArray(): Boolean = isNotNullClassType(FqNameUnsafe("kotlin.DoubleArray"))
fun IrType.isKotlinResult(): Boolean = isNotNullClassType(DescriptorUtils.RESULT_FQ_NAME.toUnsafe())
fun IrType.isNullableContinuation(): Boolean = isNullableClassType(DescriptorUtils.CONTINUATION_INTERFACE_FQ_NAME_RELEASE.toUnsafe())
fun IrType.isKotlinResult(): Boolean = isNotNullClassType(KotlinBuiltInsNames.RESULT_FQ_NAME.toUnsafe())
fun IrType.isNullableContinuation(): Boolean = isNullableClassType(KotlinBuiltInsNames.CONTINUATION_INTERFACE_FQ_NAME_RELEASE.toUnsafe())