diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt index 22d428755cb..4c65ac50e6c 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt @@ -307,12 +307,7 @@ internal class Context(config: KonanConfig) : KonanBackendContext(config) { fun getValue(member: LazyMember): T = @Suppress("UNCHECKED_CAST") (lazyValues.getOrPut(member, { member.initializer(this) }) as T) - @Deprecated("Use reflectionTypes0 instead.", ReplaceWith("this.reflectionTypes0")) - override val reflectionTypes: org.jetbrains.kotlin.backend.common.ReflectionTypes - get() = throw UnsupportedOperationException("This method will be removed soon") - - // TODO: rename to reflectionTypes after updating the Kotlin compiler - val reflectionTypes0: KonanReflectionTypes by lazy(PUBLICATION) { + val reflectionTypes: KonanReflectionTypes by lazy(PUBLICATION) { KonanReflectionTypes(moduleDescriptor, KonanFqNames.internalPackageName) } diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt index a8b42af4bc1..148a76f2051 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt @@ -93,6 +93,13 @@ internal class KonanLower(val context: Context, val parentPhaser: PhaseManager) phaser.phase(KonanPhase.LOWER_ENUMS) { EnumClassLowering(context).run(irFile) } + + /** + * TODO: this is workaround for issue of unitialized parents in IrDeclaration, + * the last one detected in [EnumClassLowering]. The issue appears in [DefaultArgumentStubGenerator]. + */ + irFile.patchDeclarationParents() + phaser.phase(KonanPhase.LOWER_INITIALIZERS) { InitializersLowering(context).runOnFilePostfix(irFile) } @@ -105,6 +112,12 @@ internal class KonanLower(val context: Context, val parentPhaser: PhaseManager) phaser.phase(KonanPhase.LOWER_CALLABLES) { CallableReferenceLowering(context).lower(irFile) } + + /** + * TODO: this is workaround for issue of unitialized parents in IrDeclaration, + * the last one detected in [CallableReferenceLowering]. The issue appears in [LocalDeclarationsLowering]. + */ + irFile.patchDeclarationParents() phaser.phase(KonanPhase.LOWER_LOCAL_FUNCTIONS) { LocalDeclarationsLowering(context).runOnFilePostfix(irFile) } diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt index 58787263c9f..febd0358e97 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt @@ -36,7 +36,6 @@ import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.resolve.scopes.MemberScope import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.TypeUtils import kotlin.properties.Delegates @@ -426,23 +425,23 @@ internal class KonanSymbols(context: Context, val symbolTable: SymbolTable, val val isInitializedPropertyDescriptor = builtInsPackage("kotlin") .getContributedVariables(Name.identifier("isInitialized"), NoLookupLocation.FROM_BACKEND).single { it.extensionReceiverParameter.let { - it != null && TypeUtils.getClassDescriptor(it.type) == context.reflectionTypes0.kProperty0 + it != null && TypeUtils.getClassDescriptor(it.type) == context.reflectionTypes.kProperty0 } && !it.isExpect } val isInitializedGetterDescriptor = isInitializedPropertyDescriptor.getter!! - val kFunctionImpl = symbolTable.referenceClass(context.reflectionTypes0.kFunctionImpl) + val kFunctionImpl = symbolTable.referenceClass(context.reflectionTypes.kFunctionImpl) - val kProperty0Impl = symbolTable.referenceClass(context.reflectionTypes0.kProperty0Impl) - val kProperty1Impl = symbolTable.referenceClass(context.reflectionTypes0.kProperty1Impl) - val kProperty2Impl = symbolTable.referenceClass(context.reflectionTypes0.kProperty2Impl) - val kMutableProperty0Impl = symbolTable.referenceClass(context.reflectionTypes0.kMutableProperty0Impl) - val kMutableProperty1Impl = symbolTable.referenceClass(context.reflectionTypes0.kMutableProperty1Impl) - val kMutableProperty2Impl = symbolTable.referenceClass(context.reflectionTypes0.kMutableProperty2Impl) + val kProperty0Impl = symbolTable.referenceClass(context.reflectionTypes.kProperty0Impl) + val kProperty1Impl = symbolTable.referenceClass(context.reflectionTypes.kProperty1Impl) + val kProperty2Impl = symbolTable.referenceClass(context.reflectionTypes.kProperty2Impl) + val kMutableProperty0Impl = symbolTable.referenceClass(context.reflectionTypes.kMutableProperty0Impl) + val kMutableProperty1Impl = symbolTable.referenceClass(context.reflectionTypes.kMutableProperty1Impl) + val kMutableProperty2Impl = symbolTable.referenceClass(context.reflectionTypes.kMutableProperty2Impl) - val kLocalDelegatedPropertyImpl = symbolTable.referenceClass(context.reflectionTypes0.kLocalDelegatedPropertyImpl) - val kLocalDelegatedMutablePropertyImpl = symbolTable.referenceClass(context.reflectionTypes0.kLocalDelegatedMutablePropertyImpl) + val kLocalDelegatedPropertyImpl = symbolTable.referenceClass(context.reflectionTypes.kLocalDelegatedPropertyImpl) + val kLocalDelegatedMutablePropertyImpl = symbolTable.referenceClass(context.reflectionTypes.kLocalDelegatedMutablePropertyImpl) val getClassTypeInfo = internalFunction("getClassTypeInfo") val getObjectTypeInfo = internalFunction("getObjectTypeInfo") @@ -483,7 +482,7 @@ internal class KonanSymbols(context: Context, val symbolTable: SymbolTable, val .map { symbolTable.referenceClass(builtIns.getFunction(it)) } val kFunctions = (0 .. KONAN_FUNCTION_INTERFACES_MAX_PARAMETERS) - .map { symbolTable.referenceClass(context.reflectionTypes0.getKFunction(it)) } + .map { symbolTable.referenceClass(context.reflectionTypes.getKFunction(it)) } fun getKFunctionType(returnType: IrType, parameterTypes: List): IrType { val kFunctionClassSymbol = kFunctions[parameterTypes.size] diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DelegationLowering.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DelegationLowering.kt index 492928489b2..a3461d50971 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DelegationLowering.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DelegationLowering.kt @@ -300,9 +300,9 @@ internal class PropertyDelegationLowering(val context: Context) : FileLoweringPa val arguments = type.arguments val expectedClassDescriptor = when (arguments.size) { 0 -> return false - 1 -> context.reflectionTypes0.kMutableProperty0 - 2 -> context.reflectionTypes0.kMutableProperty1 - 3 -> context.reflectionTypes0.kMutableProperty2 + 1 -> context.reflectionTypes.kMutableProperty0 + 2 -> context.reflectionTypes.kMutableProperty1 + 3 -> context.reflectionTypes.kMutableProperty2 else -> throw AssertionError("More than 2 receivers is not allowed") } return type == expectedClassDescriptor.defaultType.replace(arguments) diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 73fb6a9ba6c..1dd5443611f 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -15,6 +15,9 @@ buildscript { maven { url buildKotlinCompilerRepo } + maven { + url kotlinCompilerRepo + } } dependencies { diff --git a/gradle.properties b/gradle.properties index 603809a68dd..c13a53f63b4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,9 +19,9 @@ buildKotlinVersion=1.3.0-rc-116 buildKotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_130_CompilerAllPlugins),number:1.3.0-rc-116,tag:kotlin-native,pinned:true/artifacts/content/maven remoteRoot=konan_tests testDataVersion=1226829:id -kotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_dev_CompilerAllPlugins),number:1.3.20-dev-863,tag:kotlin-native,pinned:true/artifacts/content/maven -kotlinVersion=1.3.20-dev-863 -testKotlinVersion=1.3.20-dev-1002 +kotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_dev_CompilerAllPlugins),number:1.3.20-dev-1048,tag:kotlin-native,pinned:true/artifacts/content/maven +kotlinVersion=1.3.20-dev-1048 +testKotlinVersion=1.3.20-dev-1048 konanVersion=1.1.0 org.gradle.jvmargs='-Dfile.encoding=UTF-8' org.gradle.workers.max=4