Use actual implementation instead of inherited one in -Xjvm-default diagnostics
This commit is contained in:
+4
-3
@@ -117,7 +117,7 @@ class JvmDefaultChecker(private val jvmTarget: JvmTarget, private val project: P
|
||||
performSpecializationCheck
|
||||
)
|
||||
) {
|
||||
checkPossibleClashMember(inheritedMember, jvmDefaultMode, context, declaration)
|
||||
checkPossibleClashMember(inheritedMember, actualImplementation, jvmDefaultMode, context, declaration)
|
||||
}
|
||||
} else if (actualImplementation is PropertyDescriptor && inheritedMember is PropertyDescriptor) {
|
||||
val getterImpl = actualImplementation.getter
|
||||
@@ -146,7 +146,7 @@ class JvmDefaultChecker(private val jvmTarget: JvmTarget, private val project: P
|
||||
}
|
||||
}
|
||||
|
||||
checkPossibleClashMember(inheritedMember, jvmDefaultMode, context, declaration)
|
||||
checkPossibleClashMember(inheritedMember, actualImplementation, jvmDefaultMode, context, declaration)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -179,6 +179,7 @@ class JvmDefaultChecker(private val jvmTarget: JvmTarget, private val project: P
|
||||
|
||||
private fun checkPossibleClashMember(
|
||||
inheritedFun: CallableMemberDescriptor,
|
||||
actualImplementation: CallableMemberDescriptor,
|
||||
jvmDefaultMode: JvmDefaultMode,
|
||||
context: DeclarationCheckerContext,
|
||||
declaration: KtDeclaration
|
||||
@@ -188,7 +189,7 @@ class JvmDefaultChecker(private val jvmTarget: JvmTarget, private val project: P
|
||||
context.trace.report(
|
||||
ErrorsJvm.EXPLICIT_OVERRIDE_REQUIRED_IN_MIXED_MODE.on(
|
||||
declaration,
|
||||
getDirectMember(inheritedFun),
|
||||
getDirectMember(actualImplementation),
|
||||
getDirectMember(clashMember),
|
||||
jvmDefaultMode.description
|
||||
)
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultClashWithNoCompatibility/source.kt:12:7: error: explicit override is required for 'public open fun evaluate(): Any? defined in KotlinUBinaryExpressionWithType' in the '-Xjvm-default=all-compatibility' mode. Otherwise, implicit class override 'public open fun evaluate(): Any? defined in KotlinAbstractUExpression' (compiled in the old -Xjvm-default mode) is not fully overridden and might be incorrectly called at runtime
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultClashWithNoCompatibility/source.kt:12:7: error: explicit override is required for 'public open fun evaluate(): Any? defined in KotlinEvaluatableUElement' in the '-Xjvm-default=all-compatibility' mode. Otherwise, implicit class override 'public open fun evaluate(): Any? defined in KotlinAbstractUExpression' (compiled in the old -Xjvm-default mode) is not fully overridden and might be incorrectly called at runtime
|
||||
class KotlinUBinaryExpressionWithType : KotlinAbstractUExpression(), KotlinEvaluatableUElement {}
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultClashWithOld/source.kt:15:7: error: explicit override is required for 'public open var test: String defined in SubCheckClass' in the '-Xjvm-default=all' mode. Otherwise, implicit class override 'public open var test: String defined in base.CheckClass' (compiled in the old -Xjvm-default mode) is not fully overridden and might be incorrectly called at runtime
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultClashWithOld/source.kt:15:7: error: explicit override is required for 'public open var test: String defined in SubCheck' in the '-Xjvm-default=all' mode. Otherwise, implicit class override 'public open var test: String defined in base.CheckClass' (compiled in the old -Xjvm-default mode) is not fully overridden and might be incorrectly called at runtime
|
||||
class SubCheckClass : CheckClass(), SubCheck
|
||||
^
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultClashWithOld/source.kt:15:7: error: explicit override is required for 'public open fun test(): String defined in SubCheckClass' in the '-Xjvm-default=all' mode. Otherwise, implicit class override 'public open fun test(): String defined in base.CheckClass' (compiled in the old -Xjvm-default mode) is not fully overridden and might be incorrectly called at runtime
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultClashWithOld/source.kt:15:7: error: explicit override is required for 'public open fun test(): String defined in SubCheck' in the '-Xjvm-default=all' mode. Otherwise, implicit class override 'public open fun test(): String defined in base.CheckClass' (compiled in the old -Xjvm-default mode) is not fully overridden and might be incorrectly called at runtime
|
||||
class SubCheckClass : CheckClass(), SubCheck
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
|
||||
Reference in New Issue
Block a user