psi2ir: no unbound field symbols in delegated property references
#KT-30323 Fixed
This commit is contained in:
+1
-1
@@ -199,7 +199,7 @@ class DelegatedPropertyGenerator(declarationGenerator: DeclarationGenerator) : D
|
||||
private fun createCallableReference(
|
||||
ktElement: KtElement,
|
||||
type: KotlinType,
|
||||
referencedDescriptor: CallableDescriptor,
|
||||
referencedDescriptor: VariableDescriptorWithAccessors,
|
||||
scopeOwner: IrSymbol
|
||||
): IrCallableReference =
|
||||
createCallableReference(
|
||||
|
||||
+10
-2
@@ -142,9 +142,9 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St
|
||||
|
||||
return IrPropertyReferenceImpl(
|
||||
startOffset, endOffset, type.toIrType(),
|
||||
context.symbolTable.referenceProperty(propertyDescriptor.original),
|
||||
context.symbolTable.referenceProperty(originalProperty),
|
||||
propertyDescriptor.typeParametersCount,
|
||||
originalGetter?.run { context.symbolTable.referenceField(originalProperty) },
|
||||
getFieldForPropertyReference(originalProperty),
|
||||
originalGetter?.let { context.symbolTable.referenceSimpleFunction(it) },
|
||||
originalSetter?.let { context.symbolTable.referenceSimpleFunction(it) },
|
||||
origin
|
||||
@@ -153,6 +153,14 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St
|
||||
}
|
||||
}
|
||||
|
||||
private fun getFieldForPropertyReference(originalProperty: PropertyDescriptor) =
|
||||
// NB this is a hack, we really don't know if an arbitrary property has a backing field or not
|
||||
when {
|
||||
originalProperty.isDelegated -> null
|
||||
originalProperty.getter != null -> null
|
||||
else -> context.symbolTable.referenceField(originalProperty)
|
||||
}
|
||||
|
||||
private fun generateFunctionReference(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
|
||||
Reference in New Issue
Block a user