Report missed INLINE_FROM_HIGHER_PLATFORM diagnostic for derived class
Inline function descriptor in derived class represented as FAKE_OVERRIDE. So we should find it in base class declaration (not interface cause inline function can't be virtual, but always final) and then check class version. #KT-29402 Fixed
This commit is contained in:
+62
-11
@@ -18,6 +18,8 @@ package org.jetbrains.kotlin.resolve.jvm.checkers
|
|||||||
|
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import org.jetbrains.kotlin.config.JvmTarget
|
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.CallableMemberDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.ClassOrPackageFragmentDescriptor
|
import org.jetbrains.kotlin.descriptors.ClassOrPackageFragmentDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
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.resolve.jvm.diagnostics.ErrorsJvm
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor
|
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()
|
private val doCheck = doCheck()
|
||||||
|
|
||||||
override fun check(resolvedCall: ResolvedCall<*>, reportOn: PsiElement, context: CallCheckerContext) {
|
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 propertyOrFun = DescriptorUtils.getDirectMember(resultingDescriptor)
|
||||||
val inliningBytecodeVersion = getBytecodeVersionIfDeserializedDescriptor(propertyOrFun) ?: return
|
|
||||||
|
|
||||||
val compilingBytecodeVersion = jvmTarget.bytecodeVersion
|
val compilingBytecodeVersion = jvmTarget.bytecodeVersion
|
||||||
if (compilingBytecodeVersion < inliningBytecodeVersion) {
|
if (!properError) {
|
||||||
context.trace.report(
|
val inliningBytecodeVersion = getBytecodeVersionIfDeserializedDescriptor(propertyOrFun, false)
|
||||||
ErrorsJvm.INLINE_FROM_HIGHER_PLATFORM.on(
|
if (inliningBytecodeVersion != null && compilingBytecodeVersion < inliningBytecodeVersion) {
|
||||||
reportOn,
|
context.trace.report(
|
||||||
JvmTarget.getDescription(inliningBytecodeVersion),
|
ErrorsJvm.INLINE_FROM_HIGHER_PLATFORM.on(
|
||||||
JvmTarget.getDescription(compilingBytecodeVersion)
|
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 {
|
companion object {
|
||||||
fun doCheck() = "true" != System.getProperty("kotlin.skip.bytecode.version.check")
|
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
|
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 source = containingDeclaration.source
|
||||||
val binaryClass =
|
val binaryClass =
|
||||||
@@ -88,5 +125,19 @@ class InlinePlatformCompatibilityChecker(val jvmTarget: JvmTarget) : CallChecker
|
|||||||
|
|
||||||
return binaryClass.classVersion
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -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(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, "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_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");
|
MAP.put(JAVA_MODULE_DOES_NOT_READ_UNNAMED_MODULE, "Symbol is declared in unnamed module which is not read by current module");
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ public interface ErrorsJvm {
|
|||||||
DiagnosticFactory0<PsiElement> INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR = DiagnosticFactory0.create(ERROR);
|
DiagnosticFactory0<PsiElement> INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR = DiagnosticFactory0.create(ERROR);
|
||||||
|
|
||||||
DiagnosticFactory2<PsiElement, String, String> INLINE_FROM_HIGHER_PLATFORM = DiagnosticFactory2.create(ERROR);
|
DiagnosticFactory2<PsiElement, String, String> INLINE_FROM_HIGHER_PLATFORM = DiagnosticFactory2.create(ERROR);
|
||||||
|
DiagnosticFactory2<PsiElement, String, String> INLINE_FROM_HIGHER_PLATFORM_WARNING = DiagnosticFactory2.create(WARNING);
|
||||||
|
|
||||||
DiagnosticFactory1<PsiElement, String> JAVA_MODULE_DOES_NOT_DEPEND_ON_MODULE = DiagnosticFactory1.create(ERROR);
|
DiagnosticFactory1<PsiElement, String> JAVA_MODULE_DOES_NOT_DEPEND_ON_MODULE = DiagnosticFactory1.create(ERROR);
|
||||||
DiagnosticFactory0<PsiElement> JAVA_MODULE_DOES_NOT_READ_UNNAMED_MODULE = DiagnosticFactory0.create(ERROR);
|
DiagnosticFactory0<PsiElement> JAVA_MODULE_DOES_NOT_READ_UNNAMED_MODULE = DiagnosticFactory0.create(ERROR);
|
||||||
|
|||||||
+18
-18
@@ -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
|
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
|
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
|
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
|
||||||
a.inlineFun {}
|
base.inlineFunBase {}
|
||||||
^
|
^
|
||||||
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
|
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
|
||||||
a.inlineGetter
|
base.inlineGetterBase
|
||||||
^
|
^
|
||||||
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
|
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
|
||||||
a.inlineGetter = 1
|
base.inlineGetterBase = 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
|
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
|
||||||
a.inlineSetter = 1
|
base.inlineSetterBase = 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
|
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
|
||||||
a.allInline
|
base.allInlineBase
|
||||||
^
|
^
|
||||||
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
|
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
|
||||||
a.allInline = 1
|
base.allInlineBase = 1
|
||||||
^
|
^
|
||||||
COMPILATION_ERROR
|
COMPILATION_ERROR
|
||||||
+5
-6
@@ -19,21 +19,20 @@ var allInline: Int
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class A {
|
open class Base {
|
||||||
inline fun inlineFun(p: () -> Unit) {
|
inline fun inlineFunBase(p: () -> Unit) {
|
||||||
p()
|
p()
|
||||||
}
|
}
|
||||||
|
|
||||||
var inlineGetter: Int
|
var inlineGetterBase: Int
|
||||||
inline get() = 1
|
inline get() = 1
|
||||||
set(varue) { varue.hashCode() }
|
set(varue) { varue.hashCode() }
|
||||||
|
|
||||||
var inlineSetter: Int
|
var inlineSetterBase: Int
|
||||||
get() = 1
|
get() = 1
|
||||||
inline set(varue) { varue.hashCode() }
|
inline set(varue) { varue.hashCode() }
|
||||||
|
|
||||||
var allInline: Int
|
var allInlineBase: Int
|
||||||
inline get() = 1
|
inline get() = 1
|
||||||
inline set(varue) { varue.hashCode() }
|
inline set(varue) { varue.hashCode() }
|
||||||
|
|
||||||
}
|
}
|
||||||
+55
@@ -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
|
||||||
+22
-8
@@ -13,16 +13,30 @@ fun baz() {
|
|||||||
allInline
|
allInline
|
||||||
allInline = 1
|
allInline = 1
|
||||||
|
|
||||||
val a = A()
|
val base = Base()
|
||||||
a.inlineFun {}
|
base.inlineFunBase {}
|
||||||
a.inlineGetter
|
base.inlineGetterBase
|
||||||
a.inlineGetter = 1
|
base.inlineGetterBase = 1
|
||||||
|
|
||||||
a.inlineSetter
|
base.inlineSetterBase
|
||||||
a.inlineSetter = 1
|
base.inlineSetterBase = 1
|
||||||
|
|
||||||
a.allInline
|
base.allInlineBase
|
||||||
a.allInline = 1
|
base.allInlineBase = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class Derived : Base() {
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
inlineFunBase {}
|
||||||
|
inlineGetterBase
|
||||||
|
inlineGetterBase = 1
|
||||||
|
|
||||||
|
inlineSetterBase
|
||||||
|
inlineSetterBase = 1
|
||||||
|
|
||||||
|
allInlineBase
|
||||||
|
allInlineBase = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
package usage
|
||||||
|
|
||||||
|
import a.*
|
||||||
|
|
||||||
|
class Derived : Base() {
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
inlineFunBase {}
|
||||||
|
inlineGetterBase
|
||||||
|
inlineGetterBase = 1
|
||||||
|
|
||||||
|
inlineSetterBase
|
||||||
|
inlineSetterBase = 1
|
||||||
|
|
||||||
|
allInlineBase
|
||||||
|
allInlineBase = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
@@ -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
|
||||||
+16
-1
@@ -449,7 +449,22 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
|
|||||||
|
|
||||||
fun testWrongInlineTarget() {
|
fun testWrongInlineTarget() {
|
||||||
val library = compileLibrary("library", additionalOptions = listOf("-jvm-target", "1.8"))
|
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() {
|
fun testObsoleteInlineSuspend() {
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ enum class LanguageFeature(
|
|||||||
ProhibitTypeParametersForLocalVariables(KOTLIN_1_4, kind = BUG_FIX),
|
ProhibitTypeParametersForLocalVariables(KOTLIN_1_4, kind = BUG_FIX),
|
||||||
ProhibitJvmOverloadsOnConstructorsOfAnnotationClasses(KOTLIN_1_4, kind = BUG_FIX),
|
ProhibitJvmOverloadsOnConstructorsOfAnnotationClasses(KOTLIN_1_4, kind = BUG_FIX),
|
||||||
ProhibitTypeParametersInAnonymousObjects(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),
|
ProperVisibilityForCompanionObjectInstanceField(sinceVersion = null, kind = BUG_FIX),
|
||||||
// Temporarily disabled, see KT-27084/KT-22379
|
// Temporarily disabled, see KT-27084/KT-22379
|
||||||
|
|||||||
Reference in New Issue
Block a user