Skip to content

Commit

Permalink
FIR: split isInline & isValue properties in status
Browse files Browse the repository at this point in the history
#KT-73785 Fixed
  • Loading branch information
mglukhikh authored and qodana-bot committed Dec 12, 2024
1 parent d13194a commit faaae3e
Show file tree
Hide file tree
Showing 76 changed files with 360 additions and 332 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ internal class KaFirNamedClassSymbol private constructor(
if (backingPsi != null) {
backingPsi.hasModifier(KtTokens.VALUE_KEYWORD) || backingPsi.hasModifier(KtTokens.INLINE_KEYWORD)
} else {
firSymbol.isInline
firSymbol.isInline || firSymbol.isValue
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ import org.jetbrains.kotlin.fir.declarations.builder.buildRegularClass
import org.jetbrains.kotlin.fir.declarations.builder.buildSimpleFunction
import org.jetbrains.kotlin.fir.declarations.comparators.FirMemberDeclarationComparator
import org.jetbrains.kotlin.fir.declarations.impl.FirResolvedDeclarationStatusImpl
import org.jetbrains.kotlin.fir.declarations.utils.addDeclaration
import org.jetbrains.kotlin.fir.declarations.utils.isCompanion
import org.jetbrains.kotlin.fir.declarations.utils.isInline
import org.jetbrains.kotlin.fir.declarations.utils.sourceElement
import org.jetbrains.kotlin.fir.declarations.utils.*
import org.jetbrains.kotlin.fir.deserialization.addCloneForArrayIfNeeded
import org.jetbrains.kotlin.fir.deserialization.deserializationExtension
import org.jetbrains.kotlin.fir.resolve.transformers.setLazyPublishedVisibility
Expand Down Expand Up @@ -134,7 +131,8 @@ internal fun deserializeClassToSymbol(
isInner = classOrObject.hasModifier(KtTokens.INNER_KEYWORD)
isCompanion = (classOrObject as? KtObjectDeclaration)?.isCompanion() == true
isData = classOrObject.hasModifier(KtTokens.DATA_KEYWORD)
isInline = classOrObject.hasModifier(KtTokens.INLINE_KEYWORD) || classOrObject.hasModifier(KtTokens.VALUE_KEYWORD)
isInline = classOrObject.hasModifier(KtTokens.INLINE_KEYWORD)
isValue = classOrObject.hasModifier(KtTokens.VALUE_KEYWORD)
isFun = classOrObject.hasModifier(KtTokens.FUN_KEYWORD)
isExternal = classOrObject.hasModifier(KtTokens.EXTERNAL_KEYWORD)
}
Expand Down Expand Up @@ -248,7 +246,7 @@ internal fun deserializeClassToSymbol(

contextParameters.addAll(memberDeserializer.createContextReceiversForClass(classOrObject, symbol))
}.apply {
if (classOrObject is KtClass && isInline) {
if (classOrObject is KtClass && isInlineOrValue) {
val stub = classOrObject.stub as? KotlinClassStubImpl ?: loadStubByElement(classOrObject)
valueClassRepresentation = stub?.deserializeValueClassRepresentation(this)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ FIR element: FirRegularClassImpl
FIR source kind: KtRealSourceElementKind

FIR element rendered:
@R|kotlin/jvm/JvmInline|() public final inline [ResolvedTo(BODY_RESOLVE)] [FirValueClassRepresentationKey=MultiFieldValueClassRepresentation(underlyingPropertyNamesToTypes=[(a, T), (b, T)]), IsNewPlaceForBodyGeneration=false] class Foo<[ResolvedTo(BODY_RESOLVE)] T> : R|kotlin/Any| {
@R|kotlin/jvm/JvmInline|() public final value [ResolvedTo(BODY_RESOLVE)] [FirValueClassRepresentationKey=MultiFieldValueClassRepresentation(underlyingPropertyNamesToTypes=[(a, T), (b, T)]), IsNewPlaceForBodyGeneration=false] class Foo<[ResolvedTo(BODY_RESOLVE)] T> : R|kotlin/Any| {
public open operator [ResolvedTo(BODY_RESOLVE)] fun equals([ResolvedTo(BODY_RESOLVE)] other: R|kotlin/Any?|): R|kotlin/Boolean|

public open [ResolvedTo(BODY_RESOLVE)] fun hashCode(): R|kotlin/Int|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ FIR element: FirRegularClassImpl
FIR source kind: KtRealSourceElementKind

FIR element rendered:
@R|kotlin/jvm/JvmInline|() public final inline [ResolvedTo(BODY_RESOLVE)] [FirValueClassRepresentationKey=MultiFieldValueClassRepresentation(underlyingPropertyNamesToTypes=[(alias, {pack/MyAlias<T>=} kotlin/collections/List<T>), (b, kotlin/String)]), IsNewPlaceForBodyGeneration=false] class Foo<[ResolvedTo(BODY_RESOLVE)] T> : R|kotlin/Any| {
@R|kotlin/jvm/JvmInline|() public final value [ResolvedTo(BODY_RESOLVE)] [FirValueClassRepresentationKey=MultiFieldValueClassRepresentation(underlyingPropertyNamesToTypes=[(alias, {pack/MyAlias<T>=} kotlin/collections/List<T>), (b, kotlin/String)]), IsNewPlaceForBodyGeneration=false] class Foo<[ResolvedTo(BODY_RESOLVE)] T> : R|kotlin/Any| {
public open operator [ResolvedTo(BODY_RESOLVE)] fun equals([ResolvedTo(BODY_RESOLVE)] other: R|kotlin/Any?|): R|kotlin/Boolean|

public open [ResolvedTo(BODY_RESOLVE)] fun hashCode(): R|kotlin/Int|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ FIR source kind: KtRealSourceElementKind

FIR element rendered:
public final [ResolvedTo(BODY_RESOLVE)] [IsNewPlaceForBodyGeneration=false] class LibraryClass : R|kotlin/Any| {
@R|kotlin/jvm/JvmInline|() public final inline [ResolvedTo(BODY_RESOLVE)] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=value, underlyingType=pack/LibraryClass), IsNewPlaceForBodyGeneration=false] class LibraryNestedValueClass : R|kotlin/Any| {
@R|kotlin/jvm/JvmInline|() public final value [ResolvedTo(BODY_RESOLVE)] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=value, underlyingType=pack/LibraryClass), IsNewPlaceForBodyGeneration=false] class LibraryNestedValueClass : R|kotlin/Any| {
public open operator [ResolvedTo(BODY_RESOLVE)] fun equals([ResolvedTo(BODY_RESOLVE)] other: R|kotlin/Any?|): R|kotlin/Boolean|

public open [ResolvedTo(BODY_RESOLVE)] fun hashCode(): R|kotlin/Int|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ FIR element: FirRegularClassImpl
FIR source kind: KtRealSourceElementKind

FIR element rendered:
@R|kotlin/jvm/JvmInline|() public final inline [ResolvedTo(BODY_RESOLVE)] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=value, underlyingType=pack/AnotherValueClass), IsNewPlaceForBodyGeneration=false] class ValueClass : R|kotlin/Any| {
@R|kotlin/jvm/JvmInline|() public final value [ResolvedTo(BODY_RESOLVE)] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=value, underlyingType=pack/AnotherValueClass), IsNewPlaceForBodyGeneration=false] class ValueClass : R|kotlin/Any| {
public open operator [ResolvedTo(BODY_RESOLVE)] fun equals([ResolvedTo(BODY_RESOLVE)] other: R|kotlin/Any?|): R|kotlin/Boolean|

public open [ResolvedTo(BODY_RESOLVE)] fun hashCode(): R|kotlin/Int|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ FIR element: FirRegularClassImpl
FIR source kind: KtRealSourceElementKind

FIR element rendered:
@R|kotlin/jvm/JvmInline|() public final inline [ResolvedTo(BODY_RESOLVE)] [FirValueClassRepresentationKey=MultiFieldValueClassRepresentation(underlyingPropertyNamesToTypes=[(foo, pack/Foo<kotlin/Int>)]), IsNewPlaceForBodyGeneration=false] class MyValueClass : R|kotlin/Any| {
@R|kotlin/jvm/JvmInline|() public final value [ResolvedTo(BODY_RESOLVE)] [FirValueClassRepresentationKey=MultiFieldValueClassRepresentation(underlyingPropertyNamesToTypes=[(foo, pack/Foo<kotlin/Int>)]), IsNewPlaceForBodyGeneration=false] class MyValueClass : R|kotlin/Any| {
public open operator [ResolvedTo(BODY_RESOLVE)] fun equals([ResolvedTo(BODY_RESOLVE)] other: R|kotlin/Any?|): R|kotlin/Boolean|

public open [ResolvedTo(BODY_RESOLVE)] fun hashCode(): R|kotlin/Int|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ FIR element: FirRegularClassImpl
FIR source kind: KtRealSourceElementKind

FIR element rendered:
@R|kotlin/jvm/JvmInline|() public final inline [ResolvedTo(BODY_RESOLVE)] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=value, underlyingType=pack/LibraryValueClass.NestedClass), IsNewPlaceForBodyGeneration=false] class LibraryValueClass : R|kotlin/Any| {
@R|kotlin/jvm/JvmInline|() public final value [ResolvedTo(BODY_RESOLVE)] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=value, underlyingType=pack/LibraryValueClass.NestedClass), IsNewPlaceForBodyGeneration=false] class LibraryValueClass : R|kotlin/Any| {
public final [ResolvedTo(BODY_RESOLVE)] [IsNewPlaceForBodyGeneration=false] class NestedClass : R|kotlin/Any| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=NestedClass] constructor(): R|pack/LibraryValueClass.NestedClass|

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ FIR element: FirRegularClassImpl
FIR source kind: KtRealSourceElementKind

FIR element rendered:
@R|kotlin/jvm/JvmInline|() public final inline [ResolvedTo(BODY_RESOLVE)] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=foo, underlyingType=pack/Foo<kotlin/Int>?), IsNewPlaceForBodyGeneration=false] class MyValueClass : R|kotlin/Any| {
@R|kotlin/jvm/JvmInline|() public final value [ResolvedTo(BODY_RESOLVE)] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=foo, underlyingType=pack/Foo<kotlin/Int>?), IsNewPlaceForBodyGeneration=false] class MyValueClass : R|kotlin/Any| {
public open operator [ResolvedTo(BODY_RESOLVE)] fun equals([ResolvedTo(BODY_RESOLVE)] other: R|kotlin/Any?|): R|kotlin/Boolean|

public open [ResolvedTo(BODY_RESOLVE)] fun hashCode(): R|kotlin/Int|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ FIR element: FirRegularClassImpl
FIR source kind: KtRealSourceElementKind

FIR element rendered:
@R|kotlin/jvm/JvmInline|() public final inline [ResolvedTo(BODY_RESOLVE)] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=value, underlyingType={pack/MyTypeAlias<T>=} kotlin/collections/List<T>), IsNewPlaceForBodyGeneration=false] class ValueClass<[ResolvedTo(BODY_RESOLVE)] T> : R|kotlin/Any| {
@R|kotlin/jvm/JvmInline|() public final value [ResolvedTo(BODY_RESOLVE)] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=value, underlyingType={pack/MyTypeAlias<T>=} kotlin/collections/List<T>), IsNewPlaceForBodyGeneration=false] class ValueClass<[ResolvedTo(BODY_RESOLVE)] T> : R|kotlin/Any| {
public open operator [ResolvedTo(BODY_RESOLVE)] fun equals([ResolvedTo(BODY_RESOLVE)] other: R|kotlin/Any?|): R|kotlin/Boolean|

public open [ResolvedTo(BODY_RESOLVE)] fun hashCode(): R|kotlin/Int|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ FIR element: FirRegularClassImpl
FIR source kind: KtRealSourceElementKind

FIR element rendered:
@R|kotlin/jvm/JvmInline|() public final inline [ResolvedTo(BODY_RESOLVE)] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=value, underlyingType={pack/MyTypeAlias=} pack/AnotherValueClass), IsNewPlaceForBodyGeneration=false] class ValueClass : R|kotlin/Any| {
@R|kotlin/jvm/JvmInline|() public final value [ResolvedTo(BODY_RESOLVE)] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=value, underlyingType={pack/MyTypeAlias=} pack/AnotherValueClass), IsNewPlaceForBodyGeneration=false] class ValueClass : R|kotlin/Any| {
public open operator [ResolvedTo(BODY_RESOLVE)] fun equals([ResolvedTo(BODY_RESOLVE)] other: R|kotlin/Any?|): R|kotlin/Boolean|

public open [ResolvedTo(BODY_RESOLVE)] fun hashCode(): R|kotlin/Int|
Expand Down
Loading

0 comments on commit faaae3e

Please sign in to comment.