K2: add inline JVM target version checker

#KT-60777 Fixed
This commit is contained in:
Alexander Udalov
2024-02-28 15:55:34 +01:00
committed by Space Team
parent d475371394
commit 3bb2ea10b6
19 changed files with 260 additions and 16 deletions
@@ -17,7 +17,9 @@ var allInline: Int
inline get() = 1
inline set(varue) { varue.hashCode() }
inline var inlineProperty: Int
get() = 1
set(varue) { varue.hashCode() }
open class Base {
inline fun inlineFunBase(p: () -> Unit) {
@@ -35,4 +37,8 @@ open class Base {
var allInlineBase: Int
inline get() = 1
inline set(varue) { varue.hashCode() }
}
inline var inlinePropertyBase: Int
get() = 1
set(varue) { varue.hashCode() }
}
@@ -0,0 +1,64 @@
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:6:5: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option.
inlineFun {}
^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:7:5: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option.
inlineGetter
^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:11:5: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option.
inlineSetter = 1
^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:13:5: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option.
allInline
^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:14:5: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option.
allInline = 1
^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:16:5: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option.
inlineProperty
^^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:17:5: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option.
inlineProperty = 1
^^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:20:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option.
base.inlineFunBase {}
^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:21:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option.
base.inlineGetterBase
^^^^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:25:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option.
base.inlineSetterBase = 1
^^^^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:27:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option.
base.allInlineBase
^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:28:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option.
base.allInlineBase = 1
^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:30:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option.
base.inlinePropertyBase
^^^^^^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:31:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option.
base.inlinePropertyBase = 1
^^^^^^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:38:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option.
inlineFunBase {}
^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:39:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option.
inlineGetterBase
^^^^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:43:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option.
inlineSetterBase = 1
^^^^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:45:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option.
allInlineBase
^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:46:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option.
allInlineBase = 1
^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:48:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option.
inlinePropertyBase
^^^^^^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:49:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option.
inlinePropertyBase = 1
^^^^^^^^^^^^^^^^^^
COMPILATION_ERROR
@@ -16,40 +16,58 @@ compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:14:5: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
allInline = 1
^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:17:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:16:5: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
inlineProperty
^^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:17:5: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
inlineProperty = 1
^^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:20:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
base.inlineFunBase {}
^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:18:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:21:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
base.inlineGetterBase
^^^^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:19:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:22:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. 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 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:25:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. 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 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:27:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
base.allInlineBase
^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:25:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:28:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. 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 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:30:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
base.inlinePropertyBase
^^^^^^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:31:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
base.inlinePropertyBase = 1
^^^^^^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:38:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
inlineFunBase {}
^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:33:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:39:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
inlineGetterBase
^^^^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:34:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:40:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
inlineGetterBase = 1
^^^^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:37:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:43:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
inlineSetterBase = 1
^^^^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:39:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:45:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
allInlineBase
^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:40:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:46:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
allInlineBase = 1
^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:48:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
inlinePropertyBase
^^^^^^^^^^^^^^^^^^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:49:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
inlinePropertyBase = 1
^^^^^^^^^^^^^^^^^^
COMPILATION_ERROR
@@ -13,6 +13,9 @@ fun baz() {
allInline
allInline = 1
inlineProperty
inlineProperty = 1
val base = Base()
base.inlineFunBase {}
base.inlineGetterBase
@@ -23,6 +26,9 @@ fun baz() {
base.allInlineBase
base.allInlineBase = 1
base.inlinePropertyBase
base.inlinePropertyBase = 1
}
@@ -38,5 +44,8 @@ class Derived : Base() {
allInlineBase
allInlineBase = 1
inlinePropertyBase
inlinePropertyBase = 1
}
}