[FIR] Forbid @JvmInline with inline modifier
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com> #KT-1179
This commit is contained in:
committed by
Space Team
parent
3b5ad0681f
commit
888bf801e2
+6
@@ -34376,6 +34376,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/valueClasses/inefficientEqualsOverridingInMfvc.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineKeywordForMfvc.kt")
|
||||
public void testInlineKeywordForMfvc() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/valueClasses/inlineKeywordForMfvc.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("jvmInlineApplicability.kt")
|
||||
public void testJvmInlineApplicability() throws Exception {
|
||||
|
||||
+6
@@ -34472,6 +34472,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/valueClasses/inefficientEqualsOverridingInMfvc.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineKeywordForMfvc.kt")
|
||||
public void testInlineKeywordForMfvc() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/valueClasses/inlineKeywordForMfvc.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("jvmInlineApplicability.kt")
|
||||
public void testJvmInlineApplicability() throws Exception {
|
||||
|
||||
+2
-1
@@ -21,7 +21,8 @@ import org.jetbrains.kotlin.resolve.JVM_INLINE_ANNOTATION_CLASS_ID
|
||||
object FirJvmInlineApplicabilityChecker : FirRegularClassChecker() {
|
||||
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
val annotation = declaration.getAnnotationByClassId(JVM_INLINE_ANNOTATION_CLASS_ID, context.session)
|
||||
if (annotation != null && !declaration.isInline) {
|
||||
if (annotation != null && !(declaration.isInline && declaration.getModifier(KtTokens.VALUE_KEYWORD) != null)) {
|
||||
// only report if value keyword does not exist, this includes the deprecated inline class syntax
|
||||
reporter.reportOn(annotation.source, FirJvmErrors.JVM_INLINE_WITHOUT_VALUE_CLASS, context)
|
||||
} else if (annotation == null && declaration.isInline && !declaration.isExpect) {
|
||||
// only report if value keyword exists, this ignores the deprecated inline class syntax
|
||||
|
||||
Reference in New Issue
Block a user