[AA] Add expectForActual
#KT-54864 Merge-request: KT-MR-8222 Merged-by: Vladimir Dolzhenko <Vladimir.Dolzhenko@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
3afb93ca31
commit
ca31307941
@@ -54,6 +54,7 @@ public abstract class KtAnalysisSession(final override val token: KtLifetimeToke
|
||||
KtSymbolDeclarationRendererMixIn,
|
||||
KtVisibilityCheckerMixIn,
|
||||
KtMemberSymbolProviderMixin,
|
||||
KtMultiplatformInfoProviderMixin,
|
||||
KtInheritorsProviderMixIn,
|
||||
KtTypeCreatorMixIn,
|
||||
KtAnalysisScopeProviderMixIn,
|
||||
@@ -136,6 +137,9 @@ public abstract class KtAnalysisSession(final override val token: KtLifetimeToke
|
||||
internal val inheritorsProvider: KtInheritorsProvider get() = inheritorsProviderImpl
|
||||
protected abstract val inheritorsProviderImpl: KtInheritorsProvider
|
||||
|
||||
internal val multiplatformInfoProvider: KtMultiplatformInfoProvider get() = multiplatformInfoProviderImpl
|
||||
protected abstract val multiplatformInfoProviderImpl: KtMultiplatformInfoProvider
|
||||
|
||||
internal val symbolInfoProvider: KtSymbolInfoProvider get() = symbolInfoProviderImpl
|
||||
protected abstract val symbolInfoProviderImpl: KtSymbolInfoProvider
|
||||
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.components
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtDeclarationSymbol
|
||||
|
||||
public abstract class KtMultiplatformInfoProvider : KtAnalysisSessionComponent() {
|
||||
public abstract fun getExpectForActual(actual: KtDeclarationSymbol): KtDeclarationSymbol?
|
||||
}
|
||||
|
||||
public interface KtMultiplatformInfoProviderMixin : KtAnalysisSessionMixIn {
|
||||
|
||||
/**
|
||||
* Gives expect symbol for the actual one if it is available.
|
||||
**/
|
||||
public fun KtDeclarationSymbol.getExpectForActual(): KtDeclarationSymbol? =
|
||||
withValidityAssertion { analysisSession.multiplatformInfoProvider.getExpectForActual(this) }
|
||||
|
||||
}
|
||||
+1
-1
@@ -10,6 +10,6 @@ import org.jetbrains.kotlin.analysis.api.symbols.markers.KtSymbolWithTypeParamet
|
||||
|
||||
/**
|
||||
* Represents a symbol of declaration which can be directly expressed in source code.
|
||||
* Eg, classes, type parameters or functions ar [KtDeclarationSymbol], but files and packages are not
|
||||
* Eg, classes, type parameters or functions are [KtDeclarationSymbol], but files and packages are not
|
||||
*/
|
||||
public sealed interface KtDeclarationSymbol : KtSymbol, KtSymbolWithTypeParameters, KtAnnotatedSymbol
|
||||
+1
@@ -0,0 +1 @@
|
||||
expected symbol: null
|
||||
analysis/analysis-api/testData/components/multiplatformInfoProvider/expectForActual/actual_object.kt
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// MODULE: commonMain
|
||||
// FILE: Common.kt
|
||||
|
||||
package sample
|
||||
expect object Platform {
|
||||
val name: String
|
||||
}
|
||||
|
||||
// MODULE: androidMain(commonMain)
|
||||
// FILE: JvmAndroid.kt
|
||||
|
||||
package sample
|
||||
actual object <caret>Platform {
|
||||
actual val name: String = "JVM"
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
expected symbol: Common.kt : object Platform
|
||||
Reference in New Issue
Block a user