Add feature that allows references to synthetic properties with warning
See KT-35933 for details
This commit is contained in:
+12
-1
@@ -17,6 +17,8 @@
|
||||
package org.jetbrains.kotlin.resolve.jvm.checkers
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.diagnostics.Errors.CALLABLE_REFERENCE_TO_JAVA_SYNTHETIC_PROPERTY
|
||||
import org.jetbrains.kotlin.diagnostics.Errors.UNSUPPORTED
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.isCallableReference
|
||||
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker
|
||||
@@ -28,7 +30,16 @@ class UnsupportedSyntheticCallableReferenceChecker : CallChecker {
|
||||
override fun check(resolvedCall: ResolvedCall<*>, reportOn: PsiElement, context: CallCheckerContext) {
|
||||
// TODO: support references to synthetic Java extension properties (KT-8575)
|
||||
if (resolvedCall.call.isCallableReference() && resolvedCall.resultingDescriptor is SyntheticJavaPropertyDescriptor) {
|
||||
context.trace.report(UNSUPPORTED.on(reportOn, "reference to the synthetic extension property for a Java get/set method"))
|
||||
val diagnostic = if (
|
||||
context.languageVersionSettings.supportsFeature(LanguageFeature.NewInference) &&
|
||||
context.languageVersionSettings.supportsFeature(LanguageFeature.ReferencesToSyntheticJavaProperties)
|
||||
) {
|
||||
CALLABLE_REFERENCE_TO_JAVA_SYNTHETIC_PROPERTY.on(reportOn)
|
||||
} else {
|
||||
UNSUPPORTED.on(reportOn, "reference to the synthetic extension property for a Java get/set method")
|
||||
}
|
||||
|
||||
context.trace.report(diagnostic)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user