Determine underlying property of inline class by its name
Previous way to distinguish "primary constructor properties" from other properties wasn't correct for deserialized properties, because currently we don't have special information about this in metadata
This commit is contained in:
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.resolve
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
@@ -39,3 +40,10 @@ fun KotlinType.isNullableUnderlyingType(): Boolean {
|
||||
|
||||
return TypeUtils.isNullableType(underlyingType)
|
||||
}
|
||||
|
||||
fun PropertyDescriptor.isUnderlyingPropertyOfInlineClass(): Boolean {
|
||||
val containingDeclaration = this.containingDeclaration
|
||||
if (!containingDeclaration.isInlineClass()) return false
|
||||
|
||||
return (containingDeclaration as ClassDescriptor).underlyingRepresentation()?.name == this.name
|
||||
}
|
||||
Reference in New Issue
Block a user