FIR checker: report VIRTUAL_MEMBER_HIDDEN

This commit is contained in:
Tianyu Geng
2021-05-24 13:29:32 -07:00
committed by Mikhail Glukhikh
parent d3dfb33f89
commit 32f55a2269
30 changed files with 195 additions and 99 deletions
@@ -1,18 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -PLATFORM_CLASS_MAPPED_TO_KOTLIN
abstract class Test1 : Map<String, String> {
fun containsKey(key: String): Boolean = TODO()
fun getOrDefault(key: String, defaultValue: String): String = TODO()
}
abstract class Test2 : MutableMap<String, String> {
fun replace(key: String, value: String): String? = TODO()
}
abstract class Test3 : java.util.AbstractMap<String, String>() {
fun containsKey(key: String): Boolean = TODO()
fun replace(key: String, value: String): String? = TODO()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER -PLATFORM_CLASS_MAPPED_TO_KOTLIN
abstract class Test1 : Map<String, String> {
@@ -1,32 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -PLATFORM_CLASS_MAPPED_TO_KOTLIN
// Default methods from Java interfaces are NOT overridden by delegation.
// So, in the example below 'TestNoDelegationToDefaultMethods#replace' implicitly overrides a method from 'java.util.Map' (which is ok),
// but not a method from 'WithDelegation' (would be an error).
open class WithDelegation(val m: Map<String, String>) : Map<String, String> by m
class TestNoDelegationToDefaultMethods(m: Map<String, String>): WithDelegation(m) {
fun containsKey(key: String): Boolean = TODO()
fun getOrDefault(key: String, defaultValue: String): String = TODO()
fun replace(key: String, value: String): String? = TODO()
}
interface IBaseWithKotlinDeclaration : Map<String, String> {
fun replace(key: String, value: String): String?
}
abstract class WithDelegation2(val m: Map<String, String>) : Map<String, String> by m, IBaseWithKotlinDeclaration
abstract class TestNoDelegationToDefaultMethods2(m: Map<String, String>): WithDelegation2(m) {
fun containsKey(key: String): Boolean = TODO()
fun getOrDefault(key: String, defaultValue: String): String = TODO()
// VIRTUAL_MEMBER_HIDDEN: hides member declaration inherited from a Kotlin interface
fun replace(key: String, value: String): String? = TODO()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER -PLATFORM_CLASS_MAPPED_TO_KOTLIN
@@ -1,15 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -PLATFORM_CLASS_MAPPED_TO_KOTLIN
interface IBaseWithKotlinDeclaration : Map<String, String> {
fun replace(key: String, value: String): String?
}
interface TestDerivedInterfaceHidingWithKotlinDeclaration : IBaseWithKotlinDeclaration {
// VIRTUAL_MEMBER_HIDDEN: hides member declaration inherited from a Kotlin interface
fun replace(key: String, value: String): String?
}
interface TestDerivedInterfaceDefaultWithKotlinDeclaration : IBaseWithKotlinDeclaration {
// VIRTUAL_MEMBER_HIDDEN: hides member declaration inherited from a Kotlin interface
fun replace(key: String, value: String): String? = TODO()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER -PLATFORM_CLASS_MAPPED_TO_KOTLIN
interface IBaseWithKotlinDeclaration : Map<String, String> {