[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,16 @@
// FIR_IDENTICAL
// WITH_STDLIB
abstract class Parser {
open fun parseString(x: String): List<Int> = null!!
fun parse(name: String): Int = null!!
fun parse(name: String, content: String): Int = null!!
}
class Some(strings: List<String>) {
val parser = object : Parser() {
override fun parseString(x: String) = listOfInt
}
private val listOfString = strings
private val listOfInt: List<Int> = listOfString.map(parser::parse)
}
@@ -0,0 +1,22 @@
package
public abstract class Parser {
public constructor Parser()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final fun parse(/*0*/ name: kotlin.String): kotlin.Int
public final fun parse(/*0*/ name: kotlin.String, /*1*/ content: kotlin.String): kotlin.Int
public open fun parseString(/*0*/ x: kotlin.String): kotlin.collections.List<kotlin.Int>
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Some {
public constructor Some(/*0*/ strings: kotlin.collections.List<kotlin.String>)
private final val listOfInt: kotlin.collections.List<kotlin.Int>
private final val listOfString: kotlin.collections.List<kotlin.String>
public final val parser: Parser
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -15,7 +15,7 @@ val a10 = <!DIVISION_BY_ZERO!>1 / 0.0f<!>
val a11 = <!DIVISION_BY_ZERO!>1 / 0.0<!>
val a12 = <!DIVISION_BY_ZERO!>1L / 0<!>
val b1: Byte = <!DIVISION_BY_ZERO, INTEGER_OPERATOR_RESOLVE_WILL_CHANGE, TYPE_MISMATCH!>1 / 0<!>
val b1: Byte = <!DIVISION_BY_ZERO, TYPE_MISMATCH!>1 / 0<!>
@Ann(<!ANNOTATION_ARGUMENT_MUST_BE_CONST, DIVISION_BY_ZERO!>1 / 0<!>) val b2 = 1
annotation class Ann(val i : Int)
@@ -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