[FIR] Fix inconsistent RETURN_TYPE_MISMATCH and TYPE_MISMATCH reporting on functions and properties

^KT-51203 Fixed
This commit is contained in:
Ivan Kochurkin
2022-03-17 16:34:19 +03:00
committed by teamcity
parent 4617615fd9
commit c6f52893fb
42 changed files with 82 additions and 77 deletions
@@ -11,14 +11,14 @@ abstract class Buggy {
}
val anotherThree : Int
get() = <!TYPE_MISMATCH!>coll.find{ it > 3 }<!> // does not work here
get() = <!RETURN_TYPE_MISMATCH!>coll.find{ it > 3 }<!> // does not work here
val yetAnotherThree : Int
get() = <!TYPE_MISMATCH!>coll.find({ v:Int -> v > 3 })<!> // neither here
get() = <!RETURN_TYPE_MISMATCH!>coll.find({ v:Int -> v > 3 })<!> // neither here
val extendedGetter : Int
get() {
return <!TYPE_MISMATCH!>coll.find{ it > 3 }<!> // not even here!
return <!RETURN_TYPE_MISMATCH!>coll.find{ it > 3 }<!> // not even here!
}
}
@@ -15,18 +15,18 @@ class SomeClass {
val e = E.VALUE
val withoutType: LambdaWithReceiver
get() = when (e) {
get() = <!RETURN_TYPE_MISMATCH!>when (e) {
E.VALUE -> { param ->
<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>method<!>(param)
}
}
}<!>
val withExplicitType: LambdaWithReceiver
get() = when (e) {
get() = <!RETURN_TYPE_MISMATCH!>when (e) {
E.VALUE -> { param: Parameter ->
<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>method<!>(param)
}
}
}<!>
}
class OtherClass {
@@ -38,8 +38,8 @@ class OtherClass {
val e2 = E.VALUE
val staticWithExplicitType: LambdaWithReceiver
get() = when (e2) {
get() = <!RETURN_TYPE_MISMATCH!>when (e2) {
E.VALUE -> { param: Parameter ->
<!UNRESOLVED_REFERENCE!>method<!>(param)
}
}
}<!>