[K2] Disappeared UNSUPPORTED_FEATURE (3)
Added a check for the enabled context receivers feature flag for @ContextFunctionTypeParams. ^KT-59913
This commit is contained in:
committed by
Space Team
parent
c04767f1f4
commit
fb0461f422
+18
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir.analysis.checkers.expression
|
||||
import org.jetbrains.kotlin.KtSourceElement
|
||||
import org.jetbrains.kotlin.config.AnalysisFlags
|
||||
import org.jetbrains.kotlin.config.ApiVersion
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
|
||||
import org.jetbrains.kotlin.diagnostics.KtDiagnosticFactory0
|
||||
import org.jetbrains.kotlin.diagnostics.reportOn
|
||||
@@ -58,6 +59,7 @@ object FirAnnotationExpressionChecker : FirAnnotationCallChecker() {
|
||||
checkAnnotationUsedAsAnnotationArgument(expression, context, reporter)
|
||||
checkNotAClass(expression, context, reporter)
|
||||
checkErrorSuppression(annotationClassId, argumentMapping, reporter, context)
|
||||
checkContextFunctionTypeParams(expression.source, annotationClassId, reporter, context)
|
||||
}
|
||||
|
||||
private fun checkAnnotationArgumentWithSubElements(
|
||||
@@ -248,4 +250,20 @@ object FirAnnotationExpressionChecker : FirAnnotationCallChecker() {
|
||||
reporter.reportOn(nameExpression.source, FirErrors.ERROR_SUPPRESSION, parameter, context)
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkContextFunctionTypeParams(
|
||||
source: KtSourceElement?,
|
||||
annotationClassId: ClassId?,
|
||||
reporter: DiagnosticReporter,
|
||||
context: CheckerContext,
|
||||
) {
|
||||
if (context.languageVersionSettings.supportsFeature(LanguageFeature.ContextReceivers)) return
|
||||
if (annotationClassId != StandardClassIds.Annotations.ContextFunctionTypeParams) return
|
||||
reporter.reportOn(
|
||||
source,
|
||||
FirErrors.UNSUPPORTED_FEATURE,
|
||||
LanguageFeature.ContextReceivers to context.languageVersionSettings,
|
||||
context
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
fun <T> f(t: @ContextFunctionTypeParams(42) T, tt: @ContextFunctionTypeParams(1) Int) {}
|
||||
|
||||
fun test() {
|
||||
val f: @ContextFunctionTypeParams(1) @ExtensionFunctionType (Int, String) -> Unit = {}
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
fun <T> f(t: <!UNSUPPORTED_FEATURE!>@ContextFunctionTypeParams(42)<!> T, tt: <!UNSUPPORTED_FEATURE!>@ContextFunctionTypeParams(1)<!> Int) {}
|
||||
|
||||
fun test() {
|
||||
|
||||
Reference in New Issue
Block a user