K2: add reproducer of KT-54212
This commit is contained in:
+6
@@ -6002,6 +6002,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
|||||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems")
|
@TestMetadata("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
public class Problems {
|
public class Problems {
|
||||||
|
@Test
|
||||||
|
@TestMetadata("AbstractToolConfig.kt")
|
||||||
|
public void testAbstractToolConfig() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/AbstractToolConfig.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAllFilesPresentInProblems() throws Exception {
|
public void testAllFilesPresentInProblems() throws Exception {
|
||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||||
|
|||||||
+118
@@ -0,0 +1,118 @@
|
|||||||
|
FILE: AbstractToolConfig.kt
|
||||||
|
public abstract class AbstractToolConfig : R|kotlin/Any| {
|
||||||
|
public constructor(): R|AbstractToolConfig| {
|
||||||
|
super<R|kotlin/Any|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
private final val platformManager: R|PlatformManager| = this@R|/AbstractToolConfig|.R|/AbstractToolConfig.platformManager|()
|
||||||
|
private get(): R|PlatformManager|
|
||||||
|
|
||||||
|
private final val targetManager: R|TargetManager| = this@R|/AbstractToolConfig|.R|/AbstractToolConfig.platformManager|.R|/PlatformManager.targetManager|()
|
||||||
|
private get(): R|TargetManager|
|
||||||
|
|
||||||
|
public final val target: R|KonanTarget| = this@R|/AbstractToolConfig|.R|/AbstractToolConfig.targetManager|.R|/TargetManager.target|
|
||||||
|
public get(): R|KonanTarget|
|
||||||
|
|
||||||
|
protected final val platform: R|Platform| = this@R|/AbstractToolConfig|.R|/AbstractToolConfig.platformManager|.R|/PlatformManager.platform|(this@R|/AbstractToolConfig|.R|/AbstractToolConfig.target|)
|
||||||
|
protected get(): R|Platform|
|
||||||
|
|
||||||
|
public final val llvmHome: R|ERROR CLASS: Cannot calculate return type (local class/object?)| = this@R|/AbstractToolConfig|.R|/AbstractToolConfig.platform|.R|/Configurables.absoluteLlvmHome|
|
||||||
|
public get(): R|ERROR CLASS: Cannot calculate return type (local class/object?)|
|
||||||
|
|
||||||
|
public abstract fun platformManager(): R|PlatformManager|
|
||||||
|
|
||||||
|
}
|
||||||
|
FILE: Platform.kt
|
||||||
|
public final class Platform : R|Configurables| {
|
||||||
|
public constructor(configurables: R|Configurables|): R|Platform| {
|
||||||
|
super<R|kotlin/Any|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
local final field <$$delegate_0>: R|Configurables| = R|<local>/configurables|
|
||||||
|
|
||||||
|
public final val configurables: R|Configurables| = R|<local>/configurables|
|
||||||
|
public get(): R|Configurables|
|
||||||
|
|
||||||
|
}
|
||||||
|
public abstract class PlatformManager : R|HostManager| {
|
||||||
|
public constructor(): R|PlatformManager| {
|
||||||
|
super<R|HostManager|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
private final val loaders: R|kotlin/collections/Map<KonanTarget, Configurables>| = this@R|/PlatformManager|.R|/HostManager.enabled|.R|kotlin/collections/map|<R|KonanTarget|, R|kotlin/Pair<KonanTarget, Configurables>|>(<L> = map@fun <anonymous>(it: R|KonanTarget|): R|kotlin/Pair<KonanTarget, Configurables>| <inline=Inline, kind=UNKNOWN> {
|
||||||
|
^ R|<local>/it|.R|kotlin/to|<R|KonanTarget|, R|Configurables|>(this@R|/PlatformManager|.R|/PlatformManager.loadConfigurables|(R|<local>/it|))
|
||||||
|
}
|
||||||
|
).R|kotlin/collections/toMap|<R|KonanTarget|, R|Configurables|>()
|
||||||
|
private get(): R|kotlin/collections/Map<KonanTarget, Configurables>|
|
||||||
|
|
||||||
|
private final val platforms: R|kotlin/collections/Map<KonanTarget, Platform>| = this@R|/PlatformManager|.R|/PlatformManager.loaders|.R|kotlin/collections/map|<R|KonanTarget|, R|Configurables|, R|kotlin/Pair<KonanTarget, Platform>|>(<L> = map@fun <anonymous>(it: R|kotlin/collections/Map.Entry<KonanTarget, Configurables>|): R|kotlin/Pair<KonanTarget, Platform>| <inline=Inline, kind=UNKNOWN> {
|
||||||
|
^ R|<local>/it|.R|SubstitutionOverride<kotlin/collections/Map.Entry.key: R|KonanTarget|>|.R|kotlin/to|<R|KonanTarget|, R|Platform|>(R|/Platform.Platform|(R|<local>/it|.R|SubstitutionOverride<kotlin/collections/Map.Entry.value: R|Configurables|>|))
|
||||||
|
}
|
||||||
|
).R|kotlin/collections/toMap|<R|KonanTarget|, R|Platform|>()
|
||||||
|
private get(): R|kotlin/collections/Map<KonanTarget, Platform>|
|
||||||
|
|
||||||
|
public abstract fun targetManager(userRequest: R|kotlin/String?| = Null(null)): R|TargetManager|
|
||||||
|
|
||||||
|
public final fun platform(target: R|KonanTarget|): R|Platform| {
|
||||||
|
^platform this@R|/PlatformManager|.R|/PlatformManager.platforms|.R|kotlin/collections/getValue|<R|KonanTarget|, R|Platform|>(R|<local>/target|)
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract fun loadConfigurables(target: R|KonanTarget|): R|Configurables|
|
||||||
|
|
||||||
|
}
|
||||||
|
FILE: HostManager.kt
|
||||||
|
public open class HostManager : R|kotlin/Any| {
|
||||||
|
public constructor(): R|HostManager| {
|
||||||
|
super<R|kotlin/Any|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final val enabled: R|kotlin/collections/List<KonanTarget>|
|
||||||
|
public get(): R|kotlin/collections/List<KonanTarget>| {
|
||||||
|
^ R|kotlin/collections/emptyList|<R|KonanTarget|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
FILE: Configurables.kt
|
||||||
|
public abstract interface Configurables : R|kotlin/Any| {
|
||||||
|
public open val llvmHome: R|kotlin/String?|
|
||||||
|
public get(): R|kotlin/String?| {
|
||||||
|
^ this@R|/Configurables|.R|/Configurables.hostString|(String(llvmHome))
|
||||||
|
}
|
||||||
|
|
||||||
|
public open val absoluteLlvmHome: R|kotlin/String|
|
||||||
|
public get(): R|kotlin/String| {
|
||||||
|
^ this@R|/Configurables|.R|/Configurables.absolute|(this@R|/Configurables|.R|/Configurables.llvmHome|)
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract fun absolute(value: R|kotlin/String?|): R|kotlin/String|
|
||||||
|
|
||||||
|
public abstract fun hostString(key: R|kotlin/String|): R|kotlin/String?|
|
||||||
|
|
||||||
|
}
|
||||||
|
FILE: KonanTarget.kt
|
||||||
|
public sealed class KonanTarget : R|kotlin/Any| {
|
||||||
|
protected constructor(): R|KonanTarget| {
|
||||||
|
super<R|kotlin/Any|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final object ANDROID : R|KonanTarget| {
|
||||||
|
private constructor(): R|KonanTarget.ANDROID| {
|
||||||
|
super<R|KonanTarget|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public final object IOS : R|KonanTarget| {
|
||||||
|
private constructor(): R|KonanTarget.IOS| {
|
||||||
|
super<R|KonanTarget|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
FILE: TargetManager.kt
|
||||||
|
public abstract interface TargetManager : R|kotlin/Any| {
|
||||||
|
public abstract val target: R|KonanTarget|
|
||||||
|
public get(): R|KonanTarget|
|
||||||
|
|
||||||
|
}
|
||||||
+68
@@ -0,0 +1,68 @@
|
|||||||
|
// FILE: AbstractToolConfig.kt
|
||||||
|
|
||||||
|
abstract class AbstractToolConfig {
|
||||||
|
private val platformManager = platformManager()
|
||||||
|
private val targetManager = platformManager.targetManager()
|
||||||
|
val target = targetManager.target
|
||||||
|
|
||||||
|
protected val platform = platformManager.platform(target)
|
||||||
|
|
||||||
|
val llvmHome = platform.absoluteLlvmHome
|
||||||
|
|
||||||
|
abstract fun platformManager(): PlatformManager
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: Platform.kt
|
||||||
|
|
||||||
|
class Platform(val configurables: Configurables) : Configurables by configurables
|
||||||
|
|
||||||
|
abstract class PlatformManager : HostManager() {
|
||||||
|
private val loaders = enabled.map {
|
||||||
|
it to loadConfigurables(it)
|
||||||
|
}.toMap()
|
||||||
|
|
||||||
|
private val platforms = loaders.map {
|
||||||
|
it.key to Platform(it.value)
|
||||||
|
}.toMap()
|
||||||
|
|
||||||
|
abstract fun targetManager(userRequest: String? = null): TargetManager
|
||||||
|
fun platform(target: KonanTarget) = platforms.getValue(target)
|
||||||
|
|
||||||
|
abstract fun loadConfigurables(target: KonanTarget): Configurables
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: HostManager.kt
|
||||||
|
|
||||||
|
open class HostManager {
|
||||||
|
val enabled: List<KonanTarget>
|
||||||
|
get() = emptyList()
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: Configurables.kt
|
||||||
|
|
||||||
|
interface Configurables {
|
||||||
|
|
||||||
|
val llvmHome get() = hostString("llvmHome")
|
||||||
|
|
||||||
|
val absoluteLlvmHome get() = absolute(llvmHome)
|
||||||
|
|
||||||
|
fun absolute(value: String?): String
|
||||||
|
|
||||||
|
fun hostString(key: String): String?
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: KonanTarget.kt
|
||||||
|
|
||||||
|
sealed class KonanTarget {
|
||||||
|
object ANDROID : KonanTarget()
|
||||||
|
|
||||||
|
object IOS : KonanTarget()
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: TargetManager.kt
|
||||||
|
|
||||||
|
interface TargetManager {
|
||||||
|
val target: KonanTarget
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
+6
@@ -6002,6 +6002,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
|
|||||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems")
|
@TestMetadata("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
public class Problems {
|
public class Problems {
|
||||||
|
@Test
|
||||||
|
@TestMetadata("AbstractToolConfig.kt")
|
||||||
|
public void testAbstractToolConfig() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/AbstractToolConfig.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAllFilesPresentInProblems() throws Exception {
|
public void testAllFilesPresentInProblems() throws Exception {
|
||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||||
|
|||||||
+6
@@ -6002,6 +6002,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
|||||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems")
|
@TestMetadata("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
public class Problems {
|
public class Problems {
|
||||||
|
@Test
|
||||||
|
@TestMetadata("AbstractToolConfig.kt")
|
||||||
|
public void testAbstractToolConfig() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/AbstractToolConfig.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAllFilesPresentInProblems() throws Exception {
|
public void testAllFilesPresentInProblems() throws Exception {
|
||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user