[FE 1.0] Report INTEGER_OPERATOR_RESOLVE_WILL_CHANGE in missing cases

Covered places:
- local properties
- vars
- return positions of functions and lambdas

^KT-45970 Fixed
^KT-55358 Fixed
This commit is contained in:
Dmitriy Novozhilov
2022-12-08 17:43:54 +02:00
committed by Space Team
parent a979960e63
commit bd3a28d04d
15 changed files with 161 additions and 21 deletions
@@ -0,0 +1,19 @@
// ISSUE: KT-55358
fun test_0() = 1 + 2
fun test_1(): Byte = <!RETURN_TYPE_MISMATCH!>1 + 2<!>
fun test_2(b: Boolean): Byte {
if (b) return <!RETURN_TYPE_MISMATCH!>1 + 2<!>
return <!RETURN_TYPE_MISMATCH!>3 + 4<!>
}
fun test_4(): Byte = run { <!ARGUMENT_TYPE_MISMATCH!>1 + 2<!> }
fun test_5() = run<Byte> { <!ARGUMENT_TYPE_MISMATCH!>1 + 2<!> }
fun test_6() = runWithByte { <!ARGUMENT_TYPE_MISMATCH, TYPE_MISMATCH!>1 + 2<!> }
fun <R> run(block: () -> R): R = block()
fun runWithByte(block: () -> Byte): Byte = block()
@@ -0,0 +1,19 @@
// ISSUE: KT-55358
fun test_0() = 1 + 2
fun test_1(): Byte = <!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>1 + 2<!>
fun test_2(b: Boolean): Byte {
if (b) return <!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>1 + 2<!>
return <!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>3 + 4<!>
}
fun test_4(): Byte = run { <!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>1 + 2<!> }
fun test_5() = run<Byte> { <!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>1 + 2<!> }
fun test_6() = runWithByte { <!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE, TYPE_MISMATCH!>1 + 2<!> }
fun <R> run(block: () -> R): R = block()
fun runWithByte(block: () -> Byte): Byte = block()
@@ -0,0 +1,11 @@
package
public fun </*0*/ R> run(/*0*/ block: () -> R): R
public fun runWithByte(/*0*/ block: () -> kotlin.Byte): kotlin.Byte
public fun test_0(): kotlin.Int
public fun test_1(): kotlin.Byte
public fun test_2(/*0*/ b: kotlin.Boolean): kotlin.Byte
public fun test_4(): kotlin.Byte
public fun test_5(): kotlin.Byte
public fun test_6(): kotlin.Byte
+8 -8
View File
@@ -10,9 +10,9 @@ val d_1: Long = 1
var d_2: Long = 1
val e_1: Byte = <!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>1 + 2<!>
var e_2: Byte = 1 + 2
var e_2: Byte = <!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>1 + 2<!>
val f_1: Short = <!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>1 + 2<!>
var f_2: Short = 1 + 2
var f_2: Short = <!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>1 + 2<!>
val g_1: Int = 1 + 2
var g_2: Int = 1 + 2
val h_1: Long = 1 + 2
@@ -28,10 +28,10 @@ fun local() {
val d_1: Long = 1
var d_2: Long = 1
val e_1: Byte = 1 + 2
var e_2: Byte = 1 + 2
val f_1: Short = 1 + 2
var f_2: Short = 1 + 2
val e_1: Byte = <!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>1 + 2<!>
var e_2: Byte = <!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>1 + 2<!>
val f_1: Short = <!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>1 + 2<!>
var f_2: Short = <!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>1 + 2<!>
val g_1: Int = 1 + 2
var g_2: Int = 1 + 2
val h_1: Long = 1 + 2
@@ -49,9 +49,9 @@ class Member {
var d_2: Long = 1
val e_1: Byte = <!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>1 + 2<!>
var e_2: Byte = 1 + 2
var e_2: Byte = <!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>1 + 2<!>
val f_1: Short = <!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>1 + 2<!>
var f_2: Short = 1 + 2
var f_2: Short = <!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>1 + 2<!>
val g_1: Int = 1 + 2
var g_2: Int = 1 + 2
val h_1: Long = 1 + 2