[AA] implement isExpect/isActual for KtClassLikeSymbol
KT-54846
This commit is contained in:
committed by
teamcity
parent
20598cf7d7
commit
ca25162574
+3
-1
@@ -33,7 +33,7 @@ public abstract class KtTypeParameterSymbol : KtClassifierSymbol(), KtNamedSymbo
|
||||
public abstract val isReified: Boolean
|
||||
}
|
||||
|
||||
public sealed class KtClassLikeSymbol : KtClassifierSymbol(), KtSymbolWithKind, KtPossibleMemberSymbol {
|
||||
public sealed class KtClassLikeSymbol : KtClassifierSymbol(), KtSymbolWithKind, KtPossibleMemberSymbol, KtPossibleMultiplatformSymbol {
|
||||
public abstract val classIdIfNonLocal: ClassId?
|
||||
|
||||
context(KtAnalysisSession)
|
||||
@@ -68,6 +68,8 @@ public abstract class KtAnonymousObjectSymbol : KtClassOrObjectSymbol() {
|
||||
final override val classIdIfNonLocal: ClassId? get() = withValidityAssertion { null }
|
||||
final override val symbolKind: KtSymbolKind get() = withValidityAssertion { KtSymbolKind.LOCAL }
|
||||
final override val name: Name? get() = withValidityAssertion { null }
|
||||
final override val isActual: Boolean get() = withValidityAssertion { false }
|
||||
final override val isExpect: Boolean get() = withValidityAssertion { false }
|
||||
|
||||
final override val typeParameters: List<KtTypeParameterSymbol>
|
||||
get() = withValidityAssertion { emptyList() }
|
||||
|
||||
+23
@@ -19,4 +19,27 @@ public interface KtNamedSymbol : KtPossiblyNamedSymbol {
|
||||
|
||||
public interface KtSymbolWithTypeParameters : KtSymbol {
|
||||
public val typeParameters: List<KtTypeParameterSymbol>
|
||||
}
|
||||
|
||||
/**
|
||||
* A marker interface for symbols which could potentially be `expect` or `actual`. For more details about `expect` and `actual`
|
||||
* declarations, see [documentation](https://kotlinlang.org/docs/multiplatform-connect-to-apis.html).
|
||||
*/
|
||||
public interface KtPossibleMultiplatformSymbol : KtSymbol {
|
||||
/**
|
||||
* Returns true if the declaration is a platform-specific implementation in a multiplatform project.
|
||||
*/
|
||||
public val isActual: Boolean
|
||||
|
||||
/**
|
||||
* Returns true if the declaration is platform-specific declaration in a multiplatform project. An implementation
|
||||
* in platform modules is expected. Note, that in the following example:
|
||||
* ```
|
||||
* expect class A {
|
||||
* class Nested
|
||||
* }
|
||||
* ```
|
||||
* `isExpect` returns `true` for both `A` and `A.Nested`.
|
||||
*/
|
||||
public val isExpect: Boolean
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// MODULE: commonMain
|
||||
// FILE: Common.kt
|
||||
|
||||
package sample
|
||||
expect object A
|
||||
|
||||
expect class B {
|
||||
class Nested
|
||||
}
|
||||
|
||||
expect class C {
|
||||
class Nested
|
||||
}
|
||||
|
||||
// MODULE: androidMain(commonMain)
|
||||
// FILE: JvmAndroid.kt
|
||||
|
||||
package sample
|
||||
actual object A
|
||||
|
||||
actual class B {
|
||||
actual class Nested
|
||||
}
|
||||
|
||||
actual typealias C = D
|
||||
|
||||
class D {
|
||||
class Nested
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// FILE: Common.kt
|
||||
|
||||
object A
|
||||
|
||||
class B
|
||||
|
||||
class Nested
|
||||
|
||||
class C
|
||||
|
||||
class Nested
|
||||
|
||||
// FILE: JvmAndroid.kt
|
||||
|
||||
object A
|
||||
|
||||
class B
|
||||
|
||||
class Nested
|
||||
|
||||
typealias C = sample.D
|
||||
|
||||
class D
|
||||
|
||||
class Nested
|
||||
|
||||
+278
@@ -0,0 +1,278 @@
|
||||
// FILE: Common.kt
|
||||
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: sample/A
|
||||
classKind: OBJECT
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isActual: false
|
||||
isData: false
|
||||
isExpect: true
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: false
|
||||
modality: FINAL
|
||||
name: A
|
||||
origin: SOURCE
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any
|
||||
]
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: sample/B
|
||||
classKind: CLASS
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isActual: false
|
||||
isData: false
|
||||
isExpect: true
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: false
|
||||
modality: FINAL
|
||||
name: B
|
||||
origin: SOURCE
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any
|
||||
]
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: sample/B.Nested
|
||||
classKind: CLASS
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isActual: false
|
||||
isData: false
|
||||
isExpect: true
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: false
|
||||
modality: FINAL
|
||||
name: Nested
|
||||
origin: SOURCE
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any
|
||||
]
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: sample/C
|
||||
classKind: CLASS
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isActual: false
|
||||
isData: false
|
||||
isExpect: true
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: false
|
||||
modality: FINAL
|
||||
name: C
|
||||
origin: SOURCE
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any
|
||||
]
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: sample/C.Nested
|
||||
classKind: CLASS
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isActual: false
|
||||
isData: false
|
||||
isExpect: true
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: false
|
||||
modality: FINAL
|
||||
name: Nested
|
||||
origin: SOURCE
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any
|
||||
]
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
|
||||
// FILE: JvmAndroid.kt
|
||||
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: sample/A
|
||||
classKind: OBJECT
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isActual: true
|
||||
isData: false
|
||||
isExpect: false
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: false
|
||||
modality: FINAL
|
||||
name: A
|
||||
origin: SOURCE
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any
|
||||
]
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: sample/B
|
||||
classKind: CLASS
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isActual: true
|
||||
isData: false
|
||||
isExpect: false
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: false
|
||||
modality: FINAL
|
||||
name: B
|
||||
origin: SOURCE
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any
|
||||
]
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: sample/B.Nested
|
||||
classKind: CLASS
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isActual: true
|
||||
isData: false
|
||||
isExpect: false
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: false
|
||||
modality: FINAL
|
||||
name: Nested
|
||||
origin: SOURCE
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any
|
||||
]
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
|
||||
KtTypeAliasSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: sample/C
|
||||
expandedType: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: sample/D
|
||||
isActual: true
|
||||
isExpect: false
|
||||
name: C
|
||||
origin: SOURCE
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: sample/D
|
||||
classKind: CLASS
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isActual: false
|
||||
isData: false
|
||||
isExpect: false
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: false
|
||||
modality: FINAL
|
||||
name: D
|
||||
origin: SOURCE
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any
|
||||
]
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
classIdIfNonLocal: sample/D.Nested
|
||||
classKind: CLASS
|
||||
companionObject: null
|
||||
contextReceivers: []
|
||||
isActual: false
|
||||
isData: false
|
||||
isExpect: false
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: false
|
||||
modality: FINAL
|
||||
name: Nested
|
||||
origin: SOURCE
|
||||
superTypes: [
|
||||
KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/Any
|
||||
]
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
Reference in New Issue
Block a user