K2: Fix false-negative RETURN_TYPE_MISMATCH

^KT-53987 Fixed
^KT-55932 Fixed
This commit is contained in:
Denis.Zharkov
2022-11-29 12:54:13 +01:00
committed by Space Team
parent d7399ed1cf
commit 9fa0f51a61
28 changed files with 101 additions and 46 deletions
@@ -180,7 +180,7 @@ FILE: returnTypeMismatchOnOverride.kt
}
public open fun kek(): R|Z| {
^kek R|/Z.Z<CS errors: /Z.Z>#|()
^kek R|/Z.Z|()
}
}
@@ -1,5 +1,5 @@
FILE: mutableList.kt
public final fun foo(): R|kotlin/Unit| {
lvar listVar: R|kotlin/collections/MutableList<kotlin/Int>| = R|kotlin/collections/mutableListOf|<R|kotlin/Int|>(vararg(Int(1), Int(2), Int(3)))
R|<local>/listVar| = R|<local>/listVar|.R|kotlin/collections/plus<CS errors: kotlin/collections/plus>#|<R|kotlin/Int|>(Int(4))
R|<local>/listVar| = R|<local>/listVar|.R|kotlin/collections/plus|<R|kotlin/Int|>(Int(4))
}
+1 -2
View File
@@ -2,7 +2,6 @@ fun <T> bar(): T {
return null <!UNCHECKED_CAST!>as T<!>
}
class X() : <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>B<!> by <!ASSIGNMENT_IN_EXPRESSION_CONTEXT!><!VARIABLE_EXPECTED!><!UNRESOLVED_REFERENCE!>get<!>()<!> = bar()<!> {
class X() : <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>B<!> by <!ASSIGNMENT_IN_EXPRESSION_CONTEXT!><!VARIABLE_EXPECTED!><!UNRESOLVED_REFERENCE!>get<!>()<!> = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar<!>()<!> {
val prop = <!ASSIGNMENT_IN_EXPRESSION_CONTEXT!><!VARIABLE_EXPECTED!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar<!>()<!> = 2<!>
}
@@ -20,7 +20,7 @@ FILE: basic.kt
^okOneLineFunction Int(10).R|kotlin/Int.plus|(Int(1))
}
public final fun errorOneLineFunction(): R|kotlin/String| {
^errorOneLineFunction Int(10).R|kotlin/Int.plus<CS errors: kotlin/Int.plus>#|(Int(1))
^errorOneLineFunction Int(10).R|kotlin/Int.plus|(Int(1))
}
public final class A : R|kotlin/Any| {
public constructor(): R|A| {
@@ -1,6 +1,6 @@
// bug: type of the expression in return statement is Char
fun illegalReturnIf(): Char {
return if (1 < 2) 'a' else { 1 }
return <!RETURN_TYPE_MISMATCH!>if (1 < 2) 'a' else { 1 }<!>
}
fun foo(): String {