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:
Mikhael Bogdanov
2019-01-21 14:00:44 +01:00
parent b03065b2ba
commit a020170a92
11 changed files with 219 additions and 45 deletions
@@ -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
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
@@ -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() }
}
@@ -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
@@ -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
}
}
@@ -0,0 +1,18 @@
package usage
import a.*
class Derived : Base() {
fun test() {
inlineFunBase {}
inlineGetterBase
inlineGetterBase = 1
inlineSetterBase
inlineSetterBase = 1
allInlineBase
allInlineBase = 1
}
}
@@ -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