[FIR] Don't generate Any.{toString, equals, hashCode} for expect value classes in metadata

^KT-64121 Fixed
Review: https://jetbrains.team/p/kt/reviews/13495/timeline

If we generate these declarations then the compiler sees Any.{toString,
equals, hashCode} non-synthetic declarations of common metadata and
reports false positive ACTUAL_MISSING during intermediate (HMPP)
metadata compilation.

See the review for more details
This commit is contained in:
Nikita Bobko
2023-12-07 18:01:56 +01:00
committed by teamcity
parent 9da29d46aa
commit 843ded892d
7 changed files with 78 additions and 1 deletions
@@ -113,6 +113,13 @@ class MppDiagnosticsIt : KGPBaseTest() {
}
}
@GradleTest
fun testKt64121(gradleVersion: GradleVersion) {
project("kt64121", gradleVersion) {
build("assemble")
}
}
@GradleTest
fun testSuppressGradlePluginWarnings(gradleVersion: GradleVersion) {
project("suppressGradlePluginWarnings", gradleVersion) {
@@ -0,0 +1,47 @@
plugins {
kotlin("multiplatform")
`maven-publish`
}
repositories {
mavenLocal()
maven("../repo")
mavenCentral()
}
group = "com.example.bar"
version = "1.0"
kotlin {
js()
linuxX64()
sourceSets {
val commonMain by getting {
dependencies {
implementation(kotlin("stdlib-common"))
}
}
val linuxAndJsMain by creating {
dependsOn(commonMain)
}
js().compilations["main"].defaultSourceSet {
dependsOn(linuxAndJsMain)
dependencies {
implementation(kotlin("stdlib-js"))
}
}
linuxX64().compilations["main"].defaultSourceSet {
dependsOn(linuxAndJsMain)
}
}
}
publishing {
repositories {
maven("../repo")
}
}
@@ -0,0 +1,7 @@
package com.example.bar
expect value class Bar(val value: String)
expect value class Foo(val value: String) {
override fun toString(): String
}
@@ -0,0 +1,13 @@
package com.example.bar
actual value class Bar actual constructor(actual val value: String){
override fun toString(): String {
return value
}
}
actual value class Foo actual constructor(actual val value: String){
actual override fun toString(): String {
return value
}
}