FIR: introduce FunInterfaceDeclarationChecker

This commit is contained in:
Артём
2021-03-05 12:53:23 +03:00
committed by Mikhail Glukhikh
parent 867d7b5bca
commit 393a19db54
20 changed files with 389 additions and 25 deletions
@@ -0,0 +1,55 @@
FILE: funInterfaceDeclaration.kt
public abstract interface Test1 : R|kotlin/Any| {
public abstract fun foo(): R|kotlin/Unit|
public abstract fun boo(): R|kotlin/Unit|
}
public abstract interface Test2 : R|kotlin/Any| {
}
public abstract interface Test3 : R|kotlin/Any| {
public abstract val a: R|kotlin/Int|
public get(): R|kotlin/Int|
public abstract fun foo(): R|kotlin/Unit|
}
public abstract interface Test4 : R|kotlin/Any| {
public abstract fun <T> foo(a: R|T|): R|kotlin/Unit|
}
public abstract interface Test5 : R|kotlin/Any| {
public abstract fun foo(a: R|kotlin/Int| = Int(5)): R|kotlin/Unit|
}
public abstract interface Test6 : R|kotlin/Any| {
public abstract suspend fun foo(): R|kotlin/Unit|
}
public abstract interface Test7 : R|kotlin/Any| {
public abstract fun foo(): R|kotlin/Unit|
}
public abstract interface Test8 : R|Test7| {
public abstract fun boo(): R|kotlin/Unit|
}
public abstract interface Test9 : R|kotlin/Any| {
public open fun num(m: R|kotlin/Int|): R|kotlin/Int| {
^num R|<local>/m|.R|kotlin/Int.times|(R|<local>/m|)
}
}
public abstract interface Test10 : R|Test9| {
public abstract fun test(): R|kotlin/Unit|
}
public abstract interface Test11 : R|kotlin/Any| {
public abstract val a: R|kotlin/Int|
public get(): R|kotlin/Int|
}
public abstract interface Test12 : R|Test11| {
public abstract fun test(): R|kotlin/Unit|
}
@@ -0,0 +1,38 @@
<!FUN_INTERFACE_WRONG_COUNT_OF_ABSTRACT_MEMBERS!>fun<!> interface Test1{
fun foo()
fun boo()
}
<!FUN_INTERFACE_WRONG_COUNT_OF_ABSTRACT_MEMBERS!>fun<!> interface Test2 {}
fun interface Test3 {
<!FUN_INTERFACE_CANNOT_HAVE_ABSTRACT_PROPERTIES!>val<!> a: Int
fun foo()
}
fun interface Test4{
fun <<!FUN_INTERFACE_ABSTRACT_METHOD_WITH_TYPE_PARAMETERS!>T<!>> foo(a: T)
}
fun interface Test5{
fun foo(<!FUN_INTERFACE_ABSTRACT_METHOD_WITH_DEFAULT_VALUE!>a: Int = 5<!>)
}
fun interface Test6{
suspend fun foo()
}
fun interface Test7{
fun foo()
}
<!FUN_INTERFACE_WRONG_COUNT_OF_ABSTRACT_MEMBERS!>fun<!> interface Test8: Test7{
fun boo()
}
interface Test9 {
fun num(m: Int): Int {
return m * m
}
}
fun interface Test10 : Test9 {
fun test()
}
interface Test11 {
val a: Int
}
<!FUN_INTERFACE_CANNOT_HAVE_ABSTRACT_PROPERTIES!>fun<!> interface Test12 : Test11 {
fun test()
}
@@ -2,11 +2,11 @@ fun interface MyRunnable {
fun foo(x: Int): Boolean
}
fun interface WithProperty {
val x: Int
<!FUN_INTERFACE_WRONG_COUNT_OF_ABSTRACT_MEMBERS!>fun<!> interface WithProperty {
<!FUN_INTERFACE_CANNOT_HAVE_ABSTRACT_PROPERTIES!>val<!> x: Int
}
fun interface TwoAbstract : MyRunnable {
<!FUN_INTERFACE_WRONG_COUNT_OF_ABSTRACT_MEMBERS!>fun<!> interface TwoAbstract : MyRunnable {
fun bar()
}