diff --git a/build.gradle.kts b/build.gradle.kts index 2a69c281aba..5285ccda281 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - kotlin("jvm") version "1.5.20" apply false + kotlin("jvm") version "1.6.0" apply false id("org.jetbrains.dokka") version "0.10.0" apply false id("com.gradle.plugin-publish") version "0.11.0" apply false id("com.github.gmazzo.buildconfig") version "2.0.2" apply false diff --git a/kotlin-power-assert-plugin-native/build.gradle.kts b/kotlin-power-assert-plugin-native/build.gradle.kts index 8184c3fef1d..3a364ce6e83 100644 --- a/kotlin-power-assert-plugin-native/build.gradle.kts +++ b/kotlin-power-assert-plugin-native/build.gradle.kts @@ -12,8 +12,8 @@ plugins { dependencies { compileOnly("org.jetbrains.kotlin:kotlin-compiler") - kapt("com.google.auto.service:auto-service:1.0-rc6") - compileOnly("com.google.auto.service:auto-service-annotations:1.0-rc6") + kapt("com.google.auto.service:auto-service:1.0.1") + compileOnly("com.google.auto.service:auto-service-annotations:1.0.1") } tasks.named("compileKotlin") { dependsOn("syncSource") } diff --git a/kotlin-power-assert-plugin/build.gradle.kts b/kotlin-power-assert-plugin/build.gradle.kts index 36bc718981f..eedd1cb82d7 100644 --- a/kotlin-power-assert-plugin/build.gradle.kts +++ b/kotlin-power-assert-plugin/build.gradle.kts @@ -12,12 +12,12 @@ plugins { dependencies { compileOnly("org.jetbrains.kotlin:kotlin-compiler-embeddable") - kapt("com.google.auto.service:auto-service:1.0-rc6") - compileOnly("com.google.auto.service:auto-service-annotations:1.0-rc6") + kapt("com.google.auto.service:auto-service:1.0.1") + compileOnly("com.google.auto.service:auto-service-annotations:1.0.1") testImplementation(kotlin("test-junit")) testImplementation("org.jetbrains.kotlin:kotlin-compiler-embeddable") - testImplementation("com.github.tschuchortdev:kotlin-compile-testing:1.2.6") + testImplementation("com.github.tschuchortdev:kotlin-compile-testing:1.4.6") } tasks.withType { diff --git a/kotlin-power-assert-plugin/src/main/kotlin/com/bnorm/power/PowerAssertCallTransformer.kt b/kotlin-power-assert-plugin/src/main/kotlin/com/bnorm/power/PowerAssertCallTransformer.kt index 84fbd03e04a..f3a838fe779 100644 --- a/kotlin-power-assert-plugin/src/main/kotlin/com/bnorm/power/PowerAssertCallTransformer.kt +++ b/kotlin-power-assert-plugin/src/main/kotlin/com/bnorm/power/PowerAssertCallTransformer.kt @@ -52,6 +52,7 @@ import org.jetbrains.kotlin.ir.types.IrSimpleType import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.IrTypeArgument import org.jetbrains.kotlin.ir.types.IrTypeProjection +import org.jetbrains.kotlin.ir.types.IrTypeSystemContextImpl import org.jetbrains.kotlin.ir.types.classifierOrNull import org.jetbrains.kotlin.ir.types.isBoolean import org.jetbrains.kotlin.ir.types.isSubtypeOf @@ -68,6 +69,8 @@ class PowerAssertCallTransformer( private val messageCollector: MessageCollector, private val functions: Set ) : IrElementTransformerVoidWithContext() { + private val irTypeSystemContext = IrTypeSystemContextImpl(context.irBuiltIns) + override fun visitCall(expression: IrCall): IrExpression { val function = expression.symbol.owner val fqName = function.kotlinFqName @@ -200,12 +203,12 @@ class PowerAssertCallTransformer( argument is IrTypeProjection && isStringSupertype(argument.type) private fun isStringSupertype(type: IrType): Boolean = - context.irBuiltIns.stringType.isSubtypeOf(type, context.irBuiltIns) + context.irBuiltIns.stringType.isSubtypeOf(type, irTypeSystemContext) private fun IrType.isAssignableTo(type: IrType): Boolean { - if (isSubtypeOf(type, context.irBuiltIns)) return true + if (isSubtypeOf(type, irTypeSystemContext)) return true val superTypes = (type.classifierOrNull as? IrTypeParameterSymbol)?.owner?.superTypes - return superTypes != null && superTypes.all { isSubtypeOf(it, context.irBuiltIns) } + return superTypes != null && superTypes.all { isSubtypeOf(it, irTypeSystemContext) } } private fun MessageCollector.info(expression: IrElement, message: String) { diff --git a/kotlin-power-assert-plugin/src/main/kotlin/com/bnorm/power/diagram/IrDiagram.kt b/kotlin-power-assert-plugin/src/main/kotlin/com/bnorm/power/diagram/IrDiagram.kt index 4fd29c33c16..87db4016fbf 100644 --- a/kotlin-power-assert-plugin/src/main/kotlin/com/bnorm/power/diagram/IrDiagram.kt +++ b/kotlin-power-assert-plugin/src/main/kotlin/com/bnorm/power/diagram/IrDiagram.kt @@ -17,6 +17,7 @@ package com.bnorm.power.diagram import com.bnorm.power.irString +import org.jetbrains.kotlin.ir.IrBuiltIns import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.SourceRangeInfo import org.jetbrains.kotlin.ir.builders.IrBuilderWithScope @@ -25,7 +26,6 @@ import org.jetbrains.kotlin.ir.builders.irGet import org.jetbrains.kotlin.ir.declarations.IrFile import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction import org.jetbrains.kotlin.ir.declarations.IrVariable -import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns import org.jetbrains.kotlin.ir.expressions.IrConst import org.jetbrains.kotlin.ir.expressions.IrConstKind import org.jetbrains.kotlin.ir.expressions.IrExpression diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts index 14106290daa..a04d188e7df 100644 --- a/sample/build.gradle.kts +++ b/sample/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - kotlin("multiplatform") version "1.5.20" + kotlin("multiplatform") version "1.6.0" id("com.bnorm.power.kotlin-power-assert") version "0.10.0" }