FIR checker: fix positions of type mismatch on overrides
To handle implicit return types, those should be reported on declarations with return type positioning strategy, instead of return type itself.
This commit is contained in:
committed by
Dmitriy Novozhilov
parent
571c4ce398
commit
b48835f3ce
@@ -1,26 +0,0 @@
|
||||
interface A<H> {
|
||||
fun foo() : Int = 1
|
||||
fun foo2() : Int = 1
|
||||
fun foo1() : Int = 1
|
||||
val a : Int
|
||||
val a1 : Int
|
||||
val g : Iterator<H>
|
||||
|
||||
fun <T> g() : T
|
||||
fun <T> g1() : T
|
||||
}
|
||||
|
||||
abstract class B<H>() : A<H> {
|
||||
override fun foo() {
|
||||
}
|
||||
override fun foo2() : <!RETURN_TYPE_MISMATCH_ON_OVERRIDE!>Unit<!> {
|
||||
}
|
||||
|
||||
override val a : <!PROPERTY_TYPE_MISMATCH_ON_OVERRIDE!>Double<!> = 1.toDouble()
|
||||
override val a1 = 1.toDouble()
|
||||
|
||||
abstract override fun <X> g() : <!RETURN_TYPE_MISMATCH_ON_OVERRIDE!>Int<!>
|
||||
abstract override fun <X> g1() : <!RETURN_TYPE_MISMATCH_ON_OVERRIDE!>List<X><!>
|
||||
|
||||
abstract override val g : <!PROPERTY_TYPE_MISMATCH_ON_OVERRIDE!>Iterator<Int><!>
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
interface A<H> {
|
||||
fun foo() : Int = 1
|
||||
fun foo2() : Int = 1
|
||||
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
interface A {
|
||||
val prop: Int
|
||||
}
|
||||
|
||||
class AImpl: A {
|
||||
override val prop by Delegate()
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
AImpl().prop
|
||||
}
|
||||
|
||||
class Delegate {
|
||||
operator fun getValue(t: Any?, p: KProperty<*>): <!PROPERTY_TYPE_MISMATCH_ON_OVERRIDE!>String<!> {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
interface Foo {
|
||||
val foo: suspend () -> Unit
|
||||
}
|
||||
|
||||
interface Bar<T> {
|
||||
val bar: T
|
||||
}
|
||||
|
||||
class Test1 : Foo {
|
||||
override val foo = <!PROPERTY_TYPE_MISMATCH_ON_OVERRIDE!>{}<!>
|
||||
}
|
||||
|
||||
class Test2 : Foo {
|
||||
override val foo: suspend () -> Unit = {}
|
||||
}
|
||||
|
||||
class Test3 : Bar<suspend () -> Unit> {
|
||||
override val bar = <!PROPERTY_TYPE_MISMATCH_ON_OVERRIDE!>{}<!>
|
||||
}
|
||||
|
||||
class Test4 : Bar<suspend () -> Unit> {
|
||||
override val bar: suspend () -> Unit = {}
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
interface Foo {
|
||||
val foo: suspend () -> Unit
|
||||
}
|
||||
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
data class A(val x: Int) {
|
||||
fun toArray(): IntArray =
|
||||
intArrayOf(x)
|
||||
|
||||
override fun toString() =
|
||||
toArray().takeWhile { it != -1 } // .joinToString()
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
data class A(val x: Int) {
|
||||
fun toArray(): IntArray =
|
||||
intArrayOf(x)
|
||||
|
||||
Reference in New Issue
Block a user