Shift ReferencesToSyntheticJavaProperties feature release from 1.9 to 2.1

Other related tests:
- testGenericJavaProperty
- testFunInterfaceConstructorReference

Meta issue: KT-8575
Review: https://jetbrains.team/p/kt/reviews/9595

UnsupportedSyntheticCallableReferenceChecker only existed for K1,
because we wanted to release the feature for 1.9 and the feature should
have been working for K2 unconditionally. But since, we're postponing
the release until 2.1, we also need to port the checker from K1 to K2
This commit is contained in:
Nikita Bobko
2023-04-13 14:36:39 +02:00
committed by Space Team
parent 521a272acb
commit 5a96754aec
13 changed files with 63 additions and 44 deletions
@@ -27,12 +27,16 @@ import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
import org.jetbrains.kotlin.resolve.calls.util.extractCallableReferenceExpression
import org.jetbrains.kotlin.synthetic.SyntheticJavaPropertyDescriptor
/**
* This is K1 implementation.
* For K2 implementation see: [org.jetbrains.kotlin.fir.analysis.jvm.checkers.expression.FirUnsupportedSyntheticCallableReferenceChecker]
*/
class UnsupportedSyntheticCallableReferenceChecker : CallChecker {
override fun check(resolvedCall: ResolvedCall<*>, reportOn: PsiElement, context: CallCheckerContext) {
// TODO: support references to synthetic Java extension properties (KT-8575)
val callableReferenceExpression = resolvedCall.call.extractCallableReferenceExpression() ?: return
// We allow resolve of top-level callable reference to synthetic Java extension properties in delegate position
// We allow resolution of top-level callable references to synthetic Java extension properties in the delegate position. See KT-47299
if (callableReferenceExpression.unwrapParenthesesLabelsAndAnnotationsDeeply() is KtPropertyDelegate) return
if (resolvedCall.resultingDescriptor is SyntheticJavaPropertyDescriptor) {