diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b8d2c90..422cdbf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,4 +38,4 @@ jobs: uses: reactivecircus/android-emulator-runner@v2 with: api-level: 29 - script: cd tests && ./gradlew connectedCheck \ No newline at end of file + script: cd tests && ./gradlew connectedCheck --stacktrace \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index bf5ee4f..f4488dd 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -21,6 +21,6 @@ jobs: distribution: temurin cache: gradle - name: Publish to Maven Central - run: ./gradlew deployNexus + run: ./gradlew deployNexus --stacktrace - name: Publish to GitHub Packages - run: ./gradlew deployGithub + run: ./gradlew deployGithub --stacktrace diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 81b0c79..3c7d420 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -21,4 +21,4 @@ jobs: distribution: temurin cache: gradle - name: Publish Nexus Snapshot - run: ./gradlew deployNexusSnapshot \ No newline at end of file + run: ./gradlew deployNexusSnapshot --stacktrace \ No newline at end of file diff --git a/knee-compiler-plugin/src/main/kotlin/DownwardFunctions.kt b/knee-compiler-plugin/src/main/kotlin/DownwardFunctions.kt index 97e39ce..da93c3a 100644 --- a/knee-compiler-plugin/src/main/kotlin/DownwardFunctions.kt +++ b/knee-compiler-plugin/src/main/kotlin/DownwardFunctions.kt @@ -22,7 +22,6 @@ import org.jetbrains.kotlin.backend.common.lower.irCatch import org.jetbrains.kotlin.ir.builders.* import org.jetbrains.kotlin.ir.builders.declarations.addValueParameter import org.jetbrains.kotlin.ir.builders.declarations.buildVariable -import org.jetbrains.kotlin.ir.declarations.IrClass import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction import org.jetbrains.kotlin.ir.expressions.impl.IrConstImpl @@ -59,7 +58,16 @@ private fun KneeDownwardFunction.makeCodegen(codegen: KneeCodegen, signature: Do if (source.isSuspend) { addModifiers(KModifier.SUSPEND) } - if (kind is Kind.InterfaceMember || (source as? IrSimpleFunction)?.overriddenSymbols?.isNotEmpty() == true) { + // Needs override: (source as? IrSimpleFunction)?.overriddenSymbols?.isNotEmpty() == true + // But the JVM hierarchy doesn't match the KN hierarchy, supertypes may be missing, so this needs to be treated differently. + // Could merge this logic with that of DownwardProperties + val isOverride = when { + kind is Kind.InterfaceMember -> true + source !is IrSimpleFunction -> false + source.overriddenSymbols.any { it.owner.parentClassOrNull?.defaultType?.isAny() == true } -> true // toString(), equals() or hashCode() + else -> false + } + if (isOverride) { addModifiers(KModifier.OVERRIDE) } }