diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/InlinePlatformCompatibilityChecker.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/InlinePlatformCompatibilityChecker.kt index 3e272889ad5..90bbc8802b3 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/InlinePlatformCompatibilityChecker.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/InlinePlatformCompatibilityChecker.kt @@ -18,6 +18,8 @@ package org.jetbrains.kotlin.resolve.jvm.checkers import com.intellij.psi.PsiElement import org.jetbrains.kotlin.config.JvmTarget +import org.jetbrains.kotlin.config.LanguageFeature +import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor import org.jetbrains.kotlin.descriptors.ClassOrPackageFragmentDescriptor import org.jetbrains.kotlin.descriptors.DeclarationDescriptor @@ -33,7 +35,10 @@ import org.jetbrains.kotlin.resolve.inline.InlineUtil import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor -class InlinePlatformCompatibilityChecker(val jvmTarget: JvmTarget) : CallChecker { +class InlinePlatformCompatibilityChecker(val jvmTarget: JvmTarget, languageVersionSettings: LanguageVersionSettings) : CallChecker { + + private val properError = languageVersionSettings.supportsFeature(LanguageFeature.ProperInlineFromHigherPlatformDiagnostic) + private val doCheck = doCheck() override fun check(resolvedCall: ResolvedCall<*>, reportOn: PsiElement, context: CallCheckerContext) { @@ -56,27 +61,59 @@ class InlinePlatformCompatibilityChecker(val jvmTarget: JvmTarget) : CallChecker } val propertyOrFun = DescriptorUtils.getDirectMember(resultingDescriptor) - val inliningBytecodeVersion = getBytecodeVersionIfDeserializedDescriptor(propertyOrFun) ?: return val compilingBytecodeVersion = jvmTarget.bytecodeVersion - if (compilingBytecodeVersion < inliningBytecodeVersion) { - context.trace.report( - ErrorsJvm.INLINE_FROM_HIGHER_PLATFORM.on( - reportOn, - JvmTarget.getDescription(inliningBytecodeVersion), - JvmTarget.getDescription(compilingBytecodeVersion) + if (!properError) { + val inliningBytecodeVersion = getBytecodeVersionIfDeserializedDescriptor(propertyOrFun, false) + if (inliningBytecodeVersion != null && compilingBytecodeVersion < inliningBytecodeVersion) { + context.trace.report( + ErrorsJvm.INLINE_FROM_HIGHER_PLATFORM.on( + reportOn, + JvmTarget.getDescription(inliningBytecodeVersion), + JvmTarget.getDescription(compilingBytecodeVersion) + ) ) - ) + return + } } + + val inliningBytecodeVersionProper = getBytecodeVersionIfDeserializedDescriptor(propertyOrFun, true) ?: return + + if (compilingBytecodeVersion < inliningBytecodeVersionProper) { + if (properError) { + context.trace.report( + ErrorsJvm.INLINE_FROM_HIGHER_PLATFORM.on( + reportOn, + JvmTarget.getDescription(inliningBytecodeVersionProper), + JvmTarget.getDescription(compilingBytecodeVersion) + ) + ) + } else { + //INLINE_FROM_HIGHER_PLATFORM was checked in `if (!properError)` + context.trace.report( + ErrorsJvm.INLINE_FROM_HIGHER_PLATFORM_WARNING.on( + reportOn, + JvmTarget.getDescription(inliningBytecodeVersionProper), + JvmTarget.getDescription(compilingBytecodeVersion) + ) + ) + } + } + } companion object { fun doCheck() = "true" != System.getProperty("kotlin.skip.bytecode.version.check") - fun getBytecodeVersionIfDeserializedDescriptor(funOrProperty: DeclarationDescriptor): Int? { + fun getBytecodeVersionIfDeserializedDescriptor( + funOrProperty: DeclarationDescriptor, + useConcreteSuperImplementation: Boolean + ): Int? { if (funOrProperty !is DeserializedCallableMemberDescriptor) return null - val containingDeclaration = funOrProperty.containingDeclaration as ClassOrPackageFragmentDescriptor + val realDeclarationIfFound = + if (useConcreteSuperImplementation) funOrProperty.getConcreteDeclarationForInline() else funOrProperty + val containingDeclaration = realDeclarationIfFound.containingDeclaration as ClassOrPackageFragmentDescriptor val source = containingDeclaration.source val binaryClass = @@ -88,5 +125,19 @@ class InlinePlatformCompatibilityChecker(val jvmTarget: JvmTarget) : CallChecker return binaryClass.classVersion } + + private fun CallableMemberDescriptor.getConcreteDeclarationForInline(): CallableMemberDescriptor { + if (!this.kind.isReal) { + val superImplementation = overriddenDescriptors.firstOrNull { + val containingDeclaration = it.containingDeclaration + !DescriptorUtils.isInterface(containingDeclaration) && !DescriptorUtils.isAnnotationClass(containingDeclaration) + + } + superImplementation?.let { + return it.getConcreteDeclarationForInline() + } + } + return this + } } } diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java index 50d750ea8ec..a1a2a0612bf 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java @@ -122,6 +122,7 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension { MAP.put(INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR, "Calls to static methods in Java interfaces are prohibited in JVM target 1.6. Recompile with '-jvm-target 1.8'"); MAP.put(INLINE_FROM_HIGHER_PLATFORM, "Cannot inline bytecode built with {0} into bytecode that is being built with {1}. Please specify proper ''-jvm-target'' option", STRING, STRING); + MAP.put(INLINE_FROM_HIGHER_PLATFORM_WARNING, "Cannot inline bytecode built with {0} into bytecode that is being built with {1}. Please specify proper ''-jvm-target'' option", STRING, STRING); MAP.put(JAVA_MODULE_DOES_NOT_DEPEND_ON_MODULE, "Symbol is declared in module ''{0}'' which current module does not depend on", STRING); MAP.put(JAVA_MODULE_DOES_NOT_READ_UNNAMED_MODULE, "Symbol is declared in unnamed module which is not read by current module"); diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java index bc65fe6b1d2..7e85338c78c 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java @@ -99,6 +99,7 @@ public interface ErrorsJvm { DiagnosticFactory0 INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR = DiagnosticFactory0.create(ERROR); DiagnosticFactory2 INLINE_FROM_HIGHER_PLATFORM = DiagnosticFactory2.create(ERROR); + DiagnosticFactory2 INLINE_FROM_HIGHER_PLATFORM_WARNING = DiagnosticFactory2.create(WARNING); DiagnosticFactory1 JAVA_MODULE_DOES_NOT_DEPEND_ON_MODULE = DiagnosticFactory1.create(ERROR); DiagnosticFactory0 JAVA_MODULE_DOES_NOT_READ_UNNAMED_MODULE = DiagnosticFactory0.create(ERROR); diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/errorsAndErasedWarnings.txt similarity index 60% rename from compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/output.txt rename to compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/errorsAndErasedWarnings.txt index 0acfc63be5b..a5fdbc1845e 100644 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/output.txt +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/errorsAndErasedWarnings.txt @@ -16,22 +16,22 @@ compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:14:5: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option allInline = 1 ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:17:7: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option - a.inlineFun {} - ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:18:7: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option - a.inlineGetter - ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:19:7: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option - a.inlineGetter = 1 - ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:22:7: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option - a.inlineSetter = 1 - ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:24:7: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option - a.allInline - ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:25:7: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option - a.allInline = 1 - ^ -COMPILATION_ERROR \ No newline at end of file +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:17:10: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + base.inlineFunBase {} + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:18:10: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + base.inlineGetterBase + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:19:10: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + base.inlineGetterBase = 1 + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:22:10: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + base.inlineSetterBase = 1 + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:24:10: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + base.allInlineBase + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:25:10: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + base.allInlineBase = 1 + ^ +COMPILATION_ERROR diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/library/a.kt b/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/library/a.kt index 797d8b50320..0f4671de199 100644 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/library/a.kt +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/library/a.kt @@ -19,21 +19,20 @@ var allInline: Int -class A { - inline fun inlineFun(p: () -> Unit) { +open class Base { + inline fun inlineFunBase(p: () -> Unit) { p() } - var inlineGetter: Int + var inlineGetterBase: Int inline get() = 1 set(varue) { varue.hashCode() } - var inlineSetter: Int + var inlineSetterBase: Int get() = 1 inline set(varue) { varue.hashCode() } - var allInline: Int + var allInlineBase: Int inline get() = 1 inline set(varue) { varue.hashCode() } - } \ No newline at end of file diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/properError.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/properError.txt new file mode 100644 index 00000000000..f1948e7258a --- /dev/null +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/properError.txt @@ -0,0 +1,55 @@ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:6:5: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + inlineFun {} + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:7:5: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + inlineGetter + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:8:5: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + inlineGetter = 1 + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:11:5: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + inlineSetter = 1 + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:13:5: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + allInline + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:14:5: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + allInline = 1 + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:17:10: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + base.inlineFunBase {} + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:18:10: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + base.inlineGetterBase + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:19:10: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + base.inlineGetterBase = 1 + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:22:10: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + base.inlineSetterBase = 1 + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:24:10: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + base.allInlineBase + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:25:10: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + base.allInlineBase = 1 + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:32:9: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + inlineFunBase {} + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:33:9: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + inlineGetterBase + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:34:9: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + inlineGetterBase = 1 + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:37:9: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + inlineSetterBase = 1 + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:39:9: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + allInlineBase + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:40:9: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + allInlineBase = 1 + ^ +COMPILATION_ERROR diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt b/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt index 87ad7074921..e1cbac9798a 100644 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt @@ -13,16 +13,30 @@ fun baz() { allInline allInline = 1 - val a = A() - a.inlineFun {} - a.inlineGetter - a.inlineGetter = 1 + val base = Base() + base.inlineFunBase {} + base.inlineGetterBase + base.inlineGetterBase = 1 - a.inlineSetter - a.inlineSetter = 1 + base.inlineSetterBase + base.inlineSetterBase = 1 - a.allInline - a.allInline = 1 + base.allInlineBase + base.allInlineBase = 1 } +class Derived : Base() { + + fun test() { + inlineFunBase {} + inlineGetterBase + inlineGetterBase = 1 + + inlineSetterBase + inlineSetterBase = 1 + + allInlineBase + allInlineBase = 1 + } +} diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly.kt b/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly.kt new file mode 100644 index 00000000000..9e4210d8bd2 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly.kt @@ -0,0 +1,18 @@ +package usage + +import a.* + +class Derived : Base() { + + fun test() { + inlineFunBase {} + inlineGetterBase + inlineGetterBase = 1 + + inlineSetterBase + inlineSetterBase = 1 + + allInlineBase + allInlineBase = 1 + } +} diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly.txt new file mode 100644 index 00000000000..e82d3408d21 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly.txt @@ -0,0 +1,19 @@ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly.kt:8:9: warning: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + inlineFunBase {} + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly.kt:9:9: warning: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + inlineGetterBase + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly.kt:10:9: warning: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + inlineGetterBase = 1 + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly.kt:13:9: warning: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + inlineSetterBase = 1 + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly.kt:15:9: warning: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + allInlineBase + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly.kt:16:9: warning: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option + allInlineBase = 1 + ^ +OK diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt index 64bf0d73912..81014237158 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt @@ -449,7 +449,22 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration fun testWrongInlineTarget() { val library = compileLibrary("library", additionalOptions = listOf("-jvm-target", "1.8")) - compileKotlin("source.kt", tmpdir, listOf(library)) + compileKotlin( + "source.kt", tmpdir, listOf(library), + /*all warning here are erased by compiler cause or error presence, see next test for warnings*/ + expectedFileName = "errorsAndErasedWarnings.txt" + ) + + compileKotlin( + "warningsOnly.kt", tmpdir, listOf(library), + expectedFileName = "warningsOnly.txt" + ) + + compileKotlin( + "source.kt", tmpdir, listOf(library), + additionalOptions = listOf("-XXLanguage:+ProperInlineFromHigherPlatformDiagnostic"), + expectedFileName = "properError.txt" + ) } fun testObsoleteInlineSuspend() { diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index 5e3c257f264..2dc2a4aa36c 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -97,6 +97,7 @@ enum class LanguageFeature( ProhibitTypeParametersForLocalVariables(KOTLIN_1_4, kind = BUG_FIX), ProhibitJvmOverloadsOnConstructorsOfAnnotationClasses(KOTLIN_1_4, kind = BUG_FIX), ProhibitTypeParametersInAnonymousObjects(KOTLIN_1_4, kind = BUG_FIX), + ProperInlineFromHigherPlatformDiagnostic(KOTLIN_1_4, kind = BUG_FIX), ProperVisibilityForCompanionObjectInstanceField(sinceVersion = null, kind = BUG_FIX), // Temporarily disabled, see KT-27084/KT-22379