[Test] Migrate AbstractExtendedFirDiagnosticsTest to new infrastructure

This commit is contained in:
Dmitriy Novozhilov
2020-12-18 14:23:48 +03:00
committed by TeamCityServer
parent a276d05917
commit 298e27bdac
164 changed files with 1729 additions and 1281 deletions
@@ -0,0 +1,18 @@
FILE: ArrayEqualityCanBeReplacedWithEquals.kt
public final fun foo(p: R|kotlin/Int|): R|kotlin/Unit| {
lval a: R|kotlin/Array<kotlin/Int>| = R|kotlin/arrayOf|<R|kotlin/Int|>(vararg(Int(1), Int(2), Int(3)))
lval b: R|kotlin/Array<kotlin/Int>| = R|kotlin/arrayOf|<R|kotlin/Int|>(vararg(Int(3), Int(2), Int(1)))
when () {
==(R|<local>/a|, R|<local>/b|) -> {
}
}
}
public final fun testsFromIdea(): R|kotlin/Unit| {
lval a: R|kotlin/Array<kotlin/String>| = R|kotlin/arrayOf|<R|kotlin/String|>(vararg(String(a)))
lval b: R|kotlin/Array<kotlin/String>| = R|<local>/a|
lval c: R|kotlin/Any?| = Null(null)
==(R|<local>/a|, R|<local>/b|)
==(R|<local>/a|, R|<local>/c|)
!=(R|<local>/a|, R|<local>/b|)
}
@@ -0,0 +1,17 @@
// WITH_RUNTIME
fun foo(p: Int) {
val a = arrayOf(1, 2, 3)
val b = arrayOf(3, 2, 1)
if (<!ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS{LT}!>a <!ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS{PSI}!>==<!> b<!>) { }
}
fun testsFromIdea() {
val a = arrayOf("a")
val b = a
val c: Any? = null
<!ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS{LT}!>a <!ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS{PSI}!>==<!> b<!>
a == c
<!ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS{LT}!>a <!ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS{PSI}!>!=<!> b<!>
}
@@ -0,0 +1,235 @@
FILE: CanBeValChecker.kt
public final fun testDelegator(): R|kotlin/Unit| {
lvar x: R|kotlin/Boolean|by R|/LocalFreezableVar.LocalFreezableVar|<R|kotlin/Boolean|>(Boolean(true))
lvar y: R|kotlin/String|by R|/LocalFreezableVar.LocalFreezableVar|<R|kotlin/String|>(String())
}
public final class LocalFreezableVar<T> : R|kotlin/Any| {
public constructor<T>(value: R|T|): R|LocalFreezableVar<T>| {
super<R|kotlin/Any|>()
}
private final var value: R|T| = R|<local>/value|
private get(): R|T|
private set(value: R|T|): R|kotlin/Unit|
public final operator fun getValue(thisRef: R|kotlin/Nothing?|, property: R|kotlin/reflect/KProperty<*>|): R|T| {
^getValue this@R|/LocalFreezableVar|.R|/LocalFreezableVar.value|
}
public final operator fun setValue(thisRef: R|kotlin/Nothing?|, property: R|kotlin/reflect/KProperty<*>|, value: R|T|): R|kotlin/Unit| {
this@R|/LocalFreezableVar|.R|/LocalFreezableVar.value| = R|<local>/value|
}
}
public final operator fun R|C|.plus(a: R|kotlin/Any|): R|C| {
^plus this@R|/plus|
}
public final operator fun R|C|.plusAssign(a: R|kotlin/Any|): R|kotlin/Unit| {
}
public final fun testOperatorAssignment(): R|kotlin/Unit| {
lval c: R|C| = R|/C.C|()
R|<local>/c|.R|/plusAssign|(String())
lvar c1: R|C| = R|/C.C|()
ERROR_EXPR(Operator overload ambiguity. Compatible candidates: [/plus, /plusAssign])
lvar a: R|kotlin/Int| = Int(1)
R|<local>/a| = R|<local>/a|.R|kotlin/Int.plus|(Int(12))
R|<local>/a| = R|<local>/a|.R|kotlin/Int.minus|(Int(10))
}
public final fun destructuringDeclaration(): R|kotlin/Unit| {
lval <destruct>: R|kotlin/Pair<kotlin/Int, kotlin/String>| = R|/getPair|()
lvar v1: R|kotlin/Int| = R|<local>/<destruct>|.R|SubstitutionOverride<kotlin/Pair.component1: R|kotlin/Int|>|()
lvar v2: R|kotlin/String| = R|<local>/<destruct>|.R|SubstitutionOverride<kotlin/Pair.component2: R|kotlin/String|>|()
R|kotlin/io/print|(R|<local>/v1|)
lval <destruct>: R|kotlin/Pair<kotlin/Int, kotlin/String>| = R|/getPair|()
lvar v3: R|kotlin/Int| = R|<local>/<destruct>|.R|SubstitutionOverride<kotlin/Pair.component1: R|kotlin/Int|>|()
lvar v4: R|kotlin/String| = R|<local>/<destruct>|.R|SubstitutionOverride<kotlin/Pair.component2: R|kotlin/String|>|()
R|kotlin/io/print|(R|<local>/v3|)
R|<local>/v4| = String()
lval <destruct>: R|kotlin/Pair<kotlin/Int, kotlin/String>| = R|/getPair|()
lvar v5: R|kotlin/Int| = R|<local>/<destruct>|.R|SubstitutionOverride<kotlin/Pair.component1: R|kotlin/Int|>|()
lvar v6: R|kotlin/String| = R|<local>/<destruct>|.R|SubstitutionOverride<kotlin/Pair.component2: R|kotlin/String|>|()
R|<local>/v5| = Int(1)
lval <destruct>: R|kotlin/Pair<kotlin/Int, kotlin/String>| = R|/getPair|()
lvar v7: R|kotlin/Int| = R|<local>/<destruct>|.R|SubstitutionOverride<kotlin/Pair.component1: R|kotlin/Int|>|()
lvar v8: R|kotlin/String| = R|<local>/<destruct>|.R|SubstitutionOverride<kotlin/Pair.component2: R|kotlin/String|>|()
R|<local>/v7| = Int(2)
R|<local>/v8| = String(42)
lval <destruct>: R|kotlin/Triple<kotlin/Int, kotlin/Int, kotlin/Int>| = R|kotlin/Triple.Triple|<R|kotlin/Int|, R|kotlin/Int|, R|kotlin/Int|>(Int(1), Int(1), Int(1))
lval a: R|kotlin/Int| = R|<local>/<destruct>|.R|SubstitutionOverride<kotlin/Triple.component1: R|kotlin/Int|>|()
lval b: R|kotlin/Int| = R|<local>/<destruct>|.R|SubstitutionOverride<kotlin/Triple.component2: R|kotlin/Int|>|()
lval c: R|kotlin/Int| = R|<local>/<destruct>|.R|SubstitutionOverride<kotlin/Triple.component3: R|kotlin/Int|>|()
lval <destruct>: R|kotlin/Triple<kotlin/Int, kotlin/Int, kotlin/Int>| = R|kotlin/Triple.Triple|<R|kotlin/Int|, R|kotlin/Int|, R|kotlin/Int|>(Int(1), Int(1), Int(1))
lvar x: R|kotlin/Int| = R|<local>/<destruct>|.R|SubstitutionOverride<kotlin/Triple.component1: R|kotlin/Int|>|()
lvar y: R|kotlin/Int| = R|<local>/<destruct>|.R|SubstitutionOverride<kotlin/Triple.component2: R|kotlin/Int|>|()
lvar z: R|kotlin/Int| = R|<local>/<destruct>|.R|SubstitutionOverride<kotlin/Triple.component3: R|kotlin/Int|>|()
}
public final fun stackOverflowBug(): R|kotlin/Unit| {
lvar a: R|kotlin/Int|
R|<local>/a| = Int(1)
lval <iterator>: R|kotlin/collections/IntIterator| = Int(1).R|kotlin/Int.rangeTo|(Int(10)).R|kotlin/ranges/IntProgression.iterator|()
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
R|kotlin/io/print|(R|<local>/i|)
}
}
public final fun smth(flag: R|kotlin/Boolean|): R|kotlin/Unit| {
lvar a: R|kotlin/Int| = Int(1)
when () {
R|<local>/flag| -> {
while(CMP(>, R|<local>/a|.R|kotlin/Int.compareTo|(Int(0)))) {
lval <unary>: R|kotlin/Int| = R|<local>/a|
R|<local>/a| = R|<local>/<unary>|.R|kotlin/Int.dec|()
R|<local>/<unary>|
}
}
}
}
public final fun withAnnotation(p: R|kotlin/collections/List<kotlin/Any>|): R|kotlin/Unit| {
@R|kotlin/Suppress|(vararg(String(UNCHECKED_CAST))) lvar v: R|kotlin/collections/List<kotlin/String>| = (R|<local>/p| as R|kotlin/collections/List<kotlin/String>|)
R|kotlin/io/print|(R|<local>/v|)
}
public final fun withReadonlyDeligate(): R|kotlin/Unit| {
lval s: R|kotlin/String|by R|kotlin/lazy|<R|kotlin/String|>(<L> = lazy@fun <anonymous>(): R|kotlin/String| {
^ String(Hello!)
}
)
R|<local>/s|.R|kotlin/Any.hashCode|()
}
public final fun getPair(): R|kotlin/Pair<kotlin/Int, kotlin/String>| {
^getPair R|kotlin/Pair.Pair|<R|kotlin/Int|, R|kotlin/String|>(Int(1), String(1))
}
public final fun listReceiver(p: R|kotlin/collections/List<kotlin/String>|): R|kotlin/Unit| {
}
public final fun withInitializer(): R|kotlin/Unit| {
lvar v1: R|kotlin/Int| = Int(1)
lvar v2: R|kotlin/Int| = Int(2)
lvar v3: R|kotlin/Int| = Int(3)
R|<local>/v1| = Int(1)
lval <unary>: R|kotlin/Int| = R|<local>/v2|
R|<local>/v2| = R|<local>/<unary>|.R|kotlin/Int.inc|()
R|<local>/<unary>|
R|kotlin/io/print|(R|<local>/v3|)
}
public final fun test(): R|kotlin/Unit| {
lvar a: R|kotlin/Int| = Int(0)
while(CMP(>, R|<local>/a|.R|kotlin/Int.compareTo|(Int(0)))) {
lval <unary>: R|kotlin/Int| = R|<local>/a|
R|<local>/a| = R|<local>/<unary>|.R|kotlin/Int.inc|()
R|<local>/<unary>|
}
}
public final fun foo(): R|kotlin/Unit| {
lvar a: R|kotlin/Int|
lval bool: R|kotlin/Boolean| = Boolean(true)
when () {
R|<local>/bool| -> {
R|<local>/a| = Int(4)
}
else -> {
R|<local>/a| = Int(42)
}
}
lval b: R|kotlin/String|
R|<local>/bool| = Boolean(false)
}
public final fun cycles(): R|kotlin/Unit| {
lvar a: R|kotlin/Int| = Int(10)
while(CMP(>, R|<local>/a|.R|kotlin/Int.compareTo|(Int(0)))) {
lval <unary>: R|kotlin/Int| = R|<local>/a|
R|<local>/a| = R|<local>/<unary>|.R|kotlin/Int.dec|()
R|<local>/<unary>|
}
lvar b: R|kotlin/Int|
while(CMP(<, R|<local>/a|.R|kotlin/Int.compareTo|(Int(10)))) {
lval <unary>: R|kotlin/Int| = R|<local>/a|
R|<local>/a| = R|<local>/<unary>|.R|kotlin/Int.inc|()
R|<local>/<unary>|
R|<local>/b| = R|<local>/a|
}
}
public final fun assignedTwice(p: R|kotlin/Int|): R|kotlin/Unit| {
lvar v: R|kotlin/Int|
R|<local>/v| = Int(0)
when () {
CMP(>, R|<local>/p|.R|kotlin/Int.compareTo|(Int(0))) -> {
R|<local>/v| = Int(1)
}
}
}
public final fun main(args: R|kotlin/Array<kotlin/String?>|): R|kotlin/Unit| {
lvar a: R|kotlin/String?|
lval unused: R|kotlin/Int| = Int(0)
when () {
==(R|<local>/args|.R|kotlin/Array.size|, Int(1)) -> {
R|<local>/a| = R|<local>/args|.R|SubstitutionOverride<kotlin/Array.get: R|kotlin/String?|>|(Int(0))
}
else -> {
R|<local>/a| = R|<local>/args|.R|kotlin/Any.toString|()
when () {
!=(R|<local>/a|, Null(null)) && R|<local>/a|.R|kotlin/Any.equals|(String(cde)) -> {
^main Unit
}
}
}
}
}
public final fun run(f: R|() -> kotlin/Unit|): R|kotlin/Unit| {
^run R|<local>/f|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
}
public final fun lambda(): R|kotlin/Unit| {
lvar a: R|kotlin/Int|
R|<local>/a| = Int(10)
R|/run|(<L> = run@fun <anonymous>(): R|kotlin/Unit| {
R|<local>/a| = Int(20)
}
)
}
public final fun lambdaInitialization(): R|kotlin/Unit| {
lvar a: R|kotlin/Int|
R|/run|(<L> = run@fun <anonymous>(): R|kotlin/Unit| {
R|<local>/a| = Int(20)
}
)
}
public final fun notAssignedWhenNotUsed(p: R|kotlin/Int|): R|kotlin/Unit| {
lvar v: R|kotlin/Int|
when () {
CMP(>, R|<local>/p|.R|kotlin/Int.compareTo|(Int(0))) -> {
R|<local>/v| = Int(1)
R|kotlin/io/print|(R|<local>/v|)
}
}
}
public final var global: R|kotlin/Int| = Int(1)
public get(): R|kotlin/Int|
public set(value: R|kotlin/Int|): R|kotlin/Unit|
public final class C : R|kotlin/Any| {
public constructor(): R|C| {
super<R|kotlin/Any|>()
}
public final var field: R|kotlin/Int| = Int(2)
public get(): R|kotlin/Int|
public set(value: R|kotlin/Int|): R|kotlin/Unit|
public final fun foo(): R|kotlin/Unit| {
R|kotlin/io/print|(this@R|/C|.R|/C.field|)
R|kotlin/io/print|(R|/global|)
}
}
public final fun withDelegate(): R|kotlin/Unit| {
lvar s: R|kotlin/String|by Q|kotlin/properties/Delegates|.R|kotlin/properties/Delegates.notNull|<R|kotlin/String|>()
R|<local>/s| = String()
}
@@ -0,0 +1,185 @@
// WITH_RUNTIME
import kotlin.reflect.KProperty
import kotlin.properties.Delegates
fun testDelegator() {
<!UNUSED_VARIABLE{LT}!>var <!UNUSED_VARIABLE{PSI}!>x<!>: Boolean by LocalFreezableVar(true)<!>
<!UNUSED_VARIABLE{LT}!>var <!UNUSED_VARIABLE{PSI}!>y<!> by LocalFreezableVar("")<!>
}
class LocalFreezableVar<T>(private var value: T) {
operator fun getValue(thisRef: Nothing?, property: KProperty<*>): T = value
operator fun setValue(thisRef: Nothing?, property: KProperty<*>, value: T) {
this.value = value
}
}
operator fun C.plus(a: Any): C = this
operator fun C.plusAssign(a: Any) {}
fun testOperatorAssignment() {
val c = C()
c += ""
<!CAN_BE_VAL{LT}!><!CAN_BE_VAL{PSI}!>var<!> c1 = C()<!>
<!ASSIGN_OPERATOR_AMBIGUITY!>c1 += ""<!>
var a = 1
a += 12
<!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> -= 10
}
fun destructuringDeclaration() {
<!CAN_BE_VAL{LT}!><!CAN_BE_VAL{PSI}!>var<!> (v1, <!UNUSED_VARIABLE!>v2<!>) = getPair()<!>
print(v1)
var (v3, <!VARIABLE_NEVER_READ!>v4<!>) = getPair()
print(v3)
<!ASSIGNED_VALUE_IS_NEVER_READ!>v4<!> = ""
var (<!VARIABLE_NEVER_READ!>v5<!>, <!UNUSED_VARIABLE!>v6<!>) = getPair()
<!ASSIGNED_VALUE_IS_NEVER_READ!>v5<!> = 1
var (<!VARIABLE_NEVER_READ!>v7<!>, <!VARIABLE_NEVER_READ!>v8<!>) = getPair()
<!ASSIGNED_VALUE_IS_NEVER_READ!>v7<!> = 2
<!ASSIGNED_VALUE_IS_NEVER_READ!>v8<!> = "42"
val (<!UNUSED_VARIABLE!>a<!>, <!UNUSED_VARIABLE!>b<!>, <!UNUSED_VARIABLE!>c<!>) = Triple(1, 1, 1)
<!CAN_BE_VAL{LT}!><!CAN_BE_VAL{PSI}!>var<!> (<!UNUSED_VARIABLE!>x<!>, <!UNUSED_VARIABLE!>y<!>, <!UNUSED_VARIABLE!>z<!>) = Triple(1, 1, 1)<!>
}
fun stackOverflowBug() {
<!CAN_BE_VAL{LT}, VARIABLE_NEVER_READ{LT}!><!CAN_BE_VAL{PSI}!>var<!> <!VARIABLE_NEVER_READ{PSI}!>a<!>: Int<!>
<!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> = 1
for (i in 1..10)
print(i)
}
fun smth(flag: Boolean) {
var a = 1
if (flag) {
while (a > 0) {
a--
}
}
}
fun withAnnotation(p: List<Any>) {
<!CAN_BE_VAL{LT}!>@Suppress("UNCHECKED_CAST")
<!CAN_BE_VAL{PSI}!>var<!> v = p as List<String><!>
print(v)
}
fun withReadonlyDeligate() {
val s: String by lazy { "Hello!" }
s.hashCode()
}
fun getPair(): Pair<Int, String> = Pair(1, "1")
fun listReceiver(p: List<String>) {}
fun withInitializer() {
<!VARIABLE_NEVER_READ{LT}!>var <!VARIABLE_NEVER_READ{PSI}!>v1<!> = 1<!>
var v2 = 2
<!CAN_BE_VAL{LT}!><!CAN_BE_VAL{PSI}!>var<!> v3 = 3<!>
<!ASSIGNED_VALUE_IS_NEVER_READ!>v1<!> = 1
<!ASSIGNED_VALUE_IS_NEVER_READ!>v2<!>++ // todo mark this UNUSED_CHANGED_VALUES
print(v3)
}
fun test() {
var a = 0
while (a>0) {
a++
}
}
fun foo() {
<!CAN_BE_VAL{LT}, VARIABLE_NEVER_READ{LT}!><!CAN_BE_VAL{PSI}!>var<!> <!VARIABLE_NEVER_READ{PSI}!>a<!>: Int<!>
val bool = true
if (bool) <!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> = 4 else <!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> = 42
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>b<!>: String<!>
<!ASSIGNED_VALUE_IS_NEVER_READ!>bool<!> = false
}
fun cycles() {
var a = 10
while (a > 0) {
a--
}
<!VARIABLE_NEVER_READ{LT}!>var <!VARIABLE_NEVER_READ{PSI}!>b<!>: Int<!>
while (a < 10) {
a++
<!ASSIGNED_VALUE_IS_NEVER_READ!>b<!> = a
}
}
fun assignedTwice(p: Int) {
<!VARIABLE_NEVER_READ{LT}!>var <!VARIABLE_NEVER_READ{PSI}!>v<!>: Int<!>
<!ASSIGNED_VALUE_IS_NEVER_READ!>v<!> = 0
if (p > 0) <!ASSIGNED_VALUE_IS_NEVER_READ!>v<!> = 1
}
fun main(args: Array<String?>) {
<!CAN_BE_VAL{LT}!><!CAN_BE_VAL{PSI}!>var<!> a: String?<!>
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>unused<!> = 0<!>
if (args.size == 1) {
<!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> = args[0]
} else {
a = args.toString()
if (a != null && a.equals("cde")) return
}
}
fun run(f: () -> Unit) = f()
fun lambda() {
<!VARIABLE_NEVER_READ{LT}!>var <!VARIABLE_NEVER_READ{PSI}!>a<!>: Int<!>
<!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> = 10
run {
<!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> = 20
}
}
fun lambdaInitialization() {
<!CAN_BE_VAL{LT}, VARIABLE_NEVER_READ{LT}!><!CAN_BE_VAL{PSI}!>var<!> <!VARIABLE_NEVER_READ{PSI}!>a<!>: Int<!>
run {
<!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> = 20
}
}
fun notAssignedWhenNotUsed(p: Int) {
<!CAN_BE_VAL{LT}!><!CAN_BE_VAL{PSI}!>var<!> v: Int<!>
if (p > 0) {
v = 1
print(v)
}
}
var global = 1
class C {
var field = 2
fun foo() {
print(field)
print(global)
}
}
fun withDelegate() {
<!VARIABLE_NEVER_READ{LT}!>var <!VARIABLE_NEVER_READ{PSI}!>s<!>: String by Delegates.notNull()<!>
<!ASSIGNED_VALUE_IS_NEVER_READ!>s<!> = ""
}
@@ -0,0 +1,7 @@
FILE: StringTemplate.kt
public abstract interface IC : R|kotlin/Any| {
public open fun toString(x: R|kotlin/String|): R|kotlin/String| {
^toString <strcat>(String(IC), R|<local>/x|.R|kotlin/Any.toString|())
}
}
@@ -0,0 +1,3 @@
interface IC {
fun toString(x: String): String = "IC$x"
}
@@ -0,0 +1,15 @@
FILE: booleanToInt.kt
public final fun R|kotlin/Boolean|.toInt(): R|kotlin/Int| {
^toInt when () {
this@R|/toInt| -> {
Int(1)
}
else -> {
Int(0)
}
}
}
public final fun test(x: R|kotlin/Int|, y: R|kotlin/Int|): R|kotlin/Int| {
^test CMP(>, R|<local>/x|.R|kotlin/Int.compareTo|(R|<local>/y|)).R|/toInt|()
}
@@ -0,0 +1,7 @@
// IS_APPLICABLE: false
fun Boolean.toInt() = if (this) 1 else 0
fun test(x: Int, y: Int): Int {
return (x > y).toInt()
}
@@ -0,0 +1,3 @@
FILE: byte.kt
public final val foo: R|kotlin/Byte| = Q|kotlin/Byte|.R|kotlin/Byte.Companion.MAX_VALUE|.R|kotlin/Byte.toByte|()
public get(): R|kotlin/Byte|
@@ -0,0 +1,2 @@
// WITH_RUNTIME
val foo = Byte.MAX_VALUE.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toByte()<!>
@@ -0,0 +1,3 @@
FILE: char.kt
public final val foo: R|kotlin/Char| = Char(a).R|kotlin/Char.toChar|()
public get(): R|kotlin/Char|
@@ -0,0 +1,2 @@
// WITH_RUNTIME
val foo = 'a'.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toChar()<!>
@@ -0,0 +1,3 @@
FILE: double.kt
public final val foo: R|kotlin/Double| = Double(1.1).R|kotlin/Double.toDouble|()
public get(): R|kotlin/Double|
@@ -0,0 +1,2 @@
// WITH_RUNTIME
val foo = 1.1.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toDouble()<!>
@@ -0,0 +1,3 @@
FILE: float.kt
public final val foo: R|kotlin/Float| = Float(1.1).R|kotlin/Float.toFloat|()
public get(): R|kotlin/Float|
@@ -0,0 +1,2 @@
// WITH_RUNTIME
val foo = 1.1f.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toFloat()<!>
@@ -0,0 +1,3 @@
FILE: int.kt
public final val foo: R|kotlin/Int| = Int(1).R|kotlin/Int.toInt|()
public get(): R|kotlin/Int|
@@ -0,0 +1,2 @@
// WITH_RUNTIME
val foo = 1.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toInt()<!>
@@ -0,0 +1,3 @@
FILE: long.kt
public final val foo: R|kotlin/Long| = Q|kotlin/Long|.R|kotlin/Long.Companion.MAX_VALUE|.R|kotlin/Long.toLong|()
public get(): R|kotlin/Long|
@@ -0,0 +1,2 @@
// WITH_RUNTIME
val foo = Long.MAX_VALUE.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toLong()<!>
@@ -0,0 +1,4 @@
FILE: nullable.kt
public final fun foo(s: R|kotlin/String?|): R|kotlin/Unit| {
lval t: R|kotlin/String| = R|<local>/s|.R|kotlin/toString|()
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
fun foo(s: String?) {
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>t<!>: String = s.toString()<!>
}
@@ -0,0 +1,17 @@
FILE: nullable2.kt
public final data class Foo : R|kotlin/Any| {
public constructor(name: R|kotlin/String|): R|Foo| {
super<R|kotlin/Any|>()
}
public final val name: R|kotlin/String| = R|<local>/name|
public get(): R|kotlin/String|
public final fun component1(): R|kotlin/String|
public final fun copy(name: R|kotlin/String| = this@R|/Foo|.R|/Foo.name|): R|Foo|
}
public final fun nullable2(foo: R|Foo?|): R|kotlin/Unit| {
lval s: R|kotlin/String| = R|<local>/foo|?.{ $subj$.R|/Foo.name| }.R|kotlin/toString|()
}
@@ -0,0 +1,7 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
data class Foo(val name: String)
fun nullable2(foo: Foo?) {
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>s<!>: String = foo?.name.toString()<!>
}
@@ -0,0 +1,5 @@
FILE: safeString.kt
public final fun test(): R|kotlin/Unit| {
lval foo: R|kotlin/String?| = Null(null)
R|<local>/foo|?.{ $subj$.R|kotlin/Any.toString|() }
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun test() {
val foo: String? = null
foo?.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toString()<!>
}
@@ -0,0 +1,17 @@
FILE: safeString2.kt
public final data class Foo : R|kotlin/Any| {
public constructor(name: R|kotlin/String|): R|Foo| {
super<R|kotlin/Any|>()
}
public final val name: R|kotlin/String| = R|<local>/name|
public get(): R|kotlin/String|
public final fun component1(): R|kotlin/String|
public final fun copy(name: R|kotlin/String| = this@R|/Foo|.R|/Foo.name|): R|Foo|
}
public final fun test(foo: R|Foo?|): R|kotlin/Unit| {
lval s: R|kotlin/String?| = R|<local>/foo|?.{ $subj$.R|/Foo.name| }?.{ $subj$.R|kotlin/Any.toString|() }
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
data class Foo(val name: String)
fun test(foo: Foo?) {
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>s<!>: String? = foo?.name?.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toString()<!><!>
}
@@ -0,0 +1,3 @@
FILE: short.kt
public final val foo: R|kotlin/Short| = Q|kotlin/Short|.R|kotlin/Short.Companion.MAX_VALUE|.R|kotlin/Short.toShort|()
public get(): R|kotlin/Short|
@@ -0,0 +1,2 @@
// WITH_RUNTIME
val foo = Short.MAX_VALUE.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toShort()<!>
@@ -0,0 +1,3 @@
FILE: string.kt
public final val foo: R|kotlin/String| = String().R|kotlin/Any.toString|()
public get(): R|kotlin/String|
@@ -0,0 +1,2 @@
// WITH_RUNTIME
val foo = "".<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toString()<!>
@@ -0,0 +1,3 @@
FILE: toOtherType.kt
public final val foo: R|kotlin/Long| = Int(1).R|kotlin/Int.toLong|()
public get(): R|kotlin/Long|
@@ -0,0 +1,3 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
val foo = 1.toLong()
@@ -0,0 +1,4 @@
FILE: uByte.kt
public final fun test(i: R|kotlin/UByte|): R|kotlin/Unit| {
lval foo: R|kotlin/UByte| = R|<local>/i|.R|kotlin/UByte.toUByte|()
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test(i: UByte) {
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>foo<!> = i.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toUByte()<!><!>
}
@@ -0,0 +1,4 @@
FILE: uInt.kt
public final fun test(i: R|kotlin/UInt|): R|kotlin/Unit| {
lval foo: R|kotlin/UInt| = R|<local>/i|.R|kotlin/UInt.toUInt|()
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test(i: UInt) {
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>foo<!> = i.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toUInt()<!><!>
}
@@ -0,0 +1,4 @@
FILE: uLong.kt
public final fun test(i: R|kotlin/ULong|): R|kotlin/Unit| {
lval foo: R|kotlin/ULong| = R|<local>/i|.R|kotlin/ULong.toULong|()
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test(i: ULong) {
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>foo<!> = i.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toULong()<!><!>
}
@@ -0,0 +1,4 @@
FILE: uShort.kt
public final fun test(i: R|kotlin/UShort|): R|kotlin/Unit| {
lval foo: R|kotlin/UShort| = R|<local>/i|.R|kotlin/UShort.toUShort|()
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test(i: UShort) {
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>foo<!> = i.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toUShort()<!><!>
}
@@ -0,0 +1,5 @@
FILE: variable.kt
public final val foo: R|kotlin/String| = String()
public get(): R|kotlin/String|
public final val bar: R|kotlin/String| = R|/foo|.R|kotlin/Any.toString|()
public get(): R|kotlin/String|
@@ -0,0 +1,3 @@
// WITH_RUNTIME
val foo = ""
val bar = foo.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toString()<!>
@@ -0,0 +1,100 @@
FILE: RedundantExplicitTypeChecker.kt
@R|kotlin/annotation/Target|(vararg(Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.TYPE|)) public final annotation class A : R|kotlin/Annotation| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
}
public final fun annotated(): R|kotlin/Unit| {
lval x: @R|A|() R|kotlin/Int| = Int(1)
}
public final object SomeObj : R|kotlin/Any| {
private constructor(): R|SomeObj| {
super<R|kotlin/Any|>()
}
}
public final fun fer(): R|kotlin/Unit| {
lval x: R|kotlin/Any| = Q|SomeObj|
}
public final fun f2(y: R|kotlin/String?|): R|kotlin/String| {
lval f: R|kotlin/reflect/KClass<*>| = <getClass>(R|<local>/y| ?: ^f2 String())
^f2 String()
}
public final object Obj : R|kotlin/Any| {
private constructor(): R|Obj| {
super<R|kotlin/Any|>()
}
}
public abstract interface IA : R|kotlin/Any| {
}
public abstract interface IB : R|IA| {
}
public final fun R|IA|.extFun(x: R|IB|): R|kotlin/Unit| {
}
public final fun testWithExpectedType(): R|kotlin/Unit| {
lval extFun_AB_A: R|IA.(IB) -> kotlin/Unit| = Q|IA|::R|/extFun|
}
public abstract interface Point : R|kotlin/Any| {
public abstract val x: R|kotlin/Int|
public get(): R|kotlin/Int|
public abstract val y: R|kotlin/Int|
public get(): R|kotlin/Int|
}
public final class PointImpl : R|Point| {
public constructor(x: R|kotlin/Int|, y: R|kotlin/Int|): R|PointImpl| {
super<R|kotlin/Any|>()
}
public final override val x: R|kotlin/Int| = R|<local>/x|
public get(): R|kotlin/Int|
public final override val y: R|kotlin/Int| = R|<local>/y|
public get(): R|kotlin/Int|
}
public final fun foo(): R|kotlin/Unit| {
lval s: R|kotlin/String| = <strcat>(String(Hello ), Int(10).R|kotlin/Int.plus|(Int(1)).R|kotlin/Any.toString|())
lval str: R|kotlin/String?| = String()
lval o: R|Obj| = Q|Obj|
lval p: R|Point| = R|/PointImpl.PointImpl|(Int(1), Int(2))
lval a: R|kotlin/Boolean| = Boolean(true)
lval i: R|kotlin/Int| = Int(2).R|kotlin/Int.times|(Int(2))
lval l: R|kotlin/Long| = Long(1234567890123)
lval s: R|kotlin/String?| = Null(null)
lval sh: R|kotlin/Short| = Short(42)
lval integer: R|kotlin/Int| = Int(42)
lval piFloat: R|kotlin/Float| = Float(3.14)
lval piDouble: R|kotlin/Double| = Double(3.14)
lval charZ: R|kotlin/Char| = Char(z)
lvar alpha: R|kotlin/Int| = Int(0)
}
public final fun test(boolean: R|kotlin/Boolean|): R|kotlin/Unit| {
lval expectedLong: R|kotlin/Long| = when () {
R|<local>/boolean| -> {
Int(42)
}
else -> {
^test Unit
}
}
}
public final class My : R|kotlin/Any| {
public constructor(): R|My| {
super<R|kotlin/Any|>()
}
public final val x: R|kotlin/Int| = Int(1)
public get(): R|kotlin/Int|
}
public final val ZERO: R|kotlin/Int| = Int(0)
public get(): R|kotlin/Int|
public final fun main(): R|kotlin/Unit| {
lval id: R|Id| = Int(11)
}
public final typealias Id = R|kotlin/Int|
@@ -0,0 +1,76 @@
import kotlin.reflect.KClass
@Target(AnnotationTarget.TYPE)
annotation class A
fun annotated() {
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>x<!>: @A Int /* NOT redundant */ = 1<!>
}
object SomeObj
fun fer() {
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>x<!>: Any /* NOT redundant */ = SomeObj<!>
}
fun f2(y: String?): String {
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>f<!>: KClass<*> = (y ?: return "")::class<!>
return ""
}
object Obj {}
interface IA
interface IB : IA
fun IA.extFun(x: IB) {}
fun testWithExpectedType() {
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>extFun_AB_A<!>: IA.(IB) -> Unit = IA::extFun<!>
}
interface Point {
val x: Int
val y: Int
}
class PointImpl(override val x: Int, override val y: Int) : Point
fun foo() {
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>s<!>: <!REDUNDANT_EXPLICIT_TYPE!>String<!> = "Hello ${10+1}"<!>
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>str<!>: String? = ""<!>
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>o<!>: <!REDUNDANT_EXPLICIT_TYPE!>Obj<!> = Obj<!>
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>p<!>: Point = PointImpl(1, 2)<!>
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>a<!>: <!REDUNDANT_EXPLICIT_TYPE!>Boolean<!> = true<!>
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>i<!>: Int = 2 * 2<!>
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>l<!>: <!REDUNDANT_EXPLICIT_TYPE!>Long<!> = 1234567890123L<!>
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>s<!>: String? = null<!>
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>sh<!>: Short = 42<!>
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>integer<!>: <!REDUNDANT_EXPLICIT_TYPE!>Int<!> = 42<!>
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>piFloat<!>: <!REDUNDANT_EXPLICIT_TYPE!>Float<!> = 3.14f<!>
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>piDouble<!>: <!REDUNDANT_EXPLICIT_TYPE!>Double<!> = 3.14<!>
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>charZ<!>: <!REDUNDANT_EXPLICIT_TYPE!>Char<!> = 'z'<!>
<!CAN_BE_VAL{LT}, UNUSED_VARIABLE{LT}!><!CAN_BE_VAL{PSI}!>var<!> <!UNUSED_VARIABLE{PSI}!>alpha<!>: <!REDUNDANT_EXPLICIT_TYPE!>Int<!> = 0<!>
}
fun test(boolean: Boolean) {
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>expectedLong<!>: Long = if (boolean) {
42
} else {
return
}<!>
}
class My {
val x: Int = 1
}
val ZERO: Int = 0
fun main() {
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>id<!>: Id = 11<!>
}
typealias Id = Int
@@ -0,0 +1,143 @@
FILE: RedundantModalityModifierChecker.kt
public final object O : R|kotlin/Any| {
private constructor(): R|O| {
super<R|kotlin/Any|>()
}
public final fun foo(): R|kotlin/Unit| {
}
}
public abstract interface Interface : R|kotlin/Any| {
public open val gav: R|kotlin/Int|
public get(): R|kotlin/Int| {
^ Int(42)
}
public abstract fun foo(): R|kotlin/Unit|
private final fun bar(): R|kotlin/Unit| {
}
public open fun goo(): R|kotlin/Unit| {
}
public abstract fun tar(): R|kotlin/Unit|
public abstract fun too(): R|kotlin/Unit| {
}
}
public abstract interface B : R|kotlin/Any| {
public abstract var bar: R|kotlin/Unit|
public get(): R|kotlin/Unit|
public set(value: R|kotlin/Unit|): R|kotlin/Unit|
public abstract fun foo(): R|kotlin/Unit|
}
public abstract interface Foo : R|kotlin/Any| {
}
public abstract expect class AbstractClass : R|Foo| {
public expect constructor(): R|AbstractClass| {
super<R|kotlin/Any|>()
}
public abstract expect override fun foo(): R|kotlin/Unit|
public abstract expect fun bar(): R|kotlin/Unit|
public abstract expect val baz: R|kotlin/Int|
public get(): R|kotlin/Int|
}
public abstract class Base : R|kotlin/Any| {
public constructor(): R|Base| {
super<R|kotlin/Any|>()
}
public final fun foo(): R|kotlin/Unit| {
}
public abstract fun bar(): R|kotlin/Unit|
public open val gav: R|kotlin/Int| = Int(42)
public get(): R|kotlin/Int|
}
public final class FinalDerived : R|Base| {
public constructor(): R|FinalDerived| {
super<R|Base|>()
}
public final override fun bar(): R|kotlin/Unit| {
}
public open override val gav: R|kotlin/Int| = Int(13)
public get(): R|kotlin/Int|
}
public open class OpenDerived : R|Base| {
public constructor(): R|OpenDerived| {
super<R|Base|>()
}
public final override fun bar(): R|kotlin/Unit| {
}
public open override val gav: R|kotlin/Int| = Int(13)
public get(): R|kotlin/Int|
}
public final class Final : R|kotlin/Any| {
public constructor(): R|Final| {
super<R|kotlin/Any|>()
}
}
public abstract interface Derived : R|Interface| {
public open override fun foo(): R|kotlin/Unit| {
}
public final class Nested : R|kotlin/Any| {
public constructor(): R|Derived.Nested| {
super<R|kotlin/Any|>()
}
}
}
public abstract class AbstractDerived1 : R|Interface| {
public constructor(gav: R|kotlin/Int|): R|AbstractDerived1| {
super<R|kotlin/Any|>()
}
public final override val gav: R|kotlin/Int| = R|<local>/gav|
public get(): R|kotlin/Int|
public open override fun foo(): R|kotlin/Unit| {
}
}
public abstract class AbstractDerived2 : R|Interface| {
public constructor(): R|AbstractDerived2| {
super<R|kotlin/Any|>()
}
public final override fun foo(): R|kotlin/Unit| {
}
public open override val gav: R|kotlin/Int| = Int(13)
public get(): R|kotlin/Int|
}
public abstract interface AbstractInterface : R|kotlin/Any| {
}
public final object FinalObject : R|kotlin/Any| {
private constructor(): R|FinalObject| {
super<R|kotlin/Any|>()
}
}
public open interface OpenInterface : R|kotlin/Any| {
}
@@ -0,0 +1,85 @@
object O {
fun foo() {}
}
// Interface
interface Interface {
<!REDUNDANT_MODALITY_MODIFIER{LT}!>// Questionable cuz compiler reports warning here in FE 1.0
<!REDUNDANT_MODALITY_MODIFIER{PSI}!>open<!> val gav: Int
get() = 42<!>
<!REDUNDANT_MODALITY_MODIFIER{LT}!>// Redundant
<!REDUNDANT_MODALITY_MODIFIER{PSI}!>abstract<!> fun foo()<!>
// error
private final fun bar() {}
<!REDUNDANT_MODALITY_MODIFIER{LT}!><!REDUNDANT_MODALITY_MODIFIER{PSI}!>open<!> fun goo() {}<!>
<!REDUNDANT_MODALITY_MODIFIER{LT}!><!REDUNDANT_MODALITY_MODIFIER{PSI}!>abstract<!> fun tar()<!>
// error
abstract fun too() {}
}
interface B {
<!REDUNDANT_MODALITY_MODIFIER{LT}!><!REDUNDANT_MODALITY_MODIFIER{PSI}!>abstract<!> var bar: Unit<!>
<!REDUNDANT_MODALITY_MODIFIER{LT}!><!REDUNDANT_MODALITY_MODIFIER{PSI}!>abstract<!> fun foo()<!>
}
interface Foo
expect abstract class AbstractClass : Foo {
abstract override fun foo()
abstract fun bar()
abstract val baz: Int
}
// Abstract
abstract class Base {
<!REDUNDANT_MODALITY_MODIFIER{LT}!>// Redundant final
<!REDUNDANT_MODALITY_MODIFIER{PSI}!>final<!> fun foo() {}<!>
// Abstract
abstract fun bar()
// Open
open val gav = 42
}
class FinalDerived : Base() {
<!REDUNDANT_MODALITY_MODIFIER{LT}!>// Redundant final
override <!REDUNDANT_MODALITY_MODIFIER{PSI}!>final<!> fun bar() {}<!>
// Non-final member in final class
override open val gav = 13
}
// Open
open class OpenDerived : Base() {
// Final
override final fun bar() {}
<!REDUNDANT_MODALITY_MODIFIER{LT}!>// Redundant open
override <!REDUNDANT_MODALITY_MODIFIER{PSI}!>open<!> val gav = 13<!>
}
<!REDUNDANT_MODALITY_MODIFIER{LT}!>// Redundant final
<!REDUNDANT_MODALITY_MODIFIER{PSI}!>final<!> class Final<!>
// Derived interface
interface Derived : Interface {
<!REDUNDANT_MODALITY_MODIFIER{LT}!>// Redundant
override <!REDUNDANT_MODALITY_MODIFIER{PSI}!>open<!> fun foo() {}<!>
// error
final class Nested
}
// Derived abstract class
abstract class AbstractDerived1(override final val gav: Int) : Interface {
<!REDUNDANT_MODALITY_MODIFIER{LT}!>// Redundant
override <!REDUNDANT_MODALITY_MODIFIER{PSI}!>open<!> fun foo() {}<!>
}
// Derived abstract class
abstract class AbstractDerived2 : Interface {
// Final
override final fun foo() {}
<!REDUNDANT_MODALITY_MODIFIER{LT}!>// Redundant
override <!REDUNDANT_MODALITY_MODIFIER{PSI}!>open<!> val gav = 13<!>
}
// Redundant abstract interface
abstract interface AbstractInterface
<!REDUNDANT_MODALITY_MODIFIER{LT}!>// Redundant final object
<!REDUNDANT_MODALITY_MODIFIER{PSI}!>final<!> object FinalObject<!>
// Open interface
open interface OpenInterface
@@ -0,0 +1,97 @@
FILE: RedundantReturnUnitTypeChecker.kt
public final data class My : R|kotlin/Any| {
public constructor(x: R|kotlin/Unit|): R|My| {
super<R|kotlin/Any|>()
}
public final val x: R|kotlin/Unit| = R|<local>/x|
public get(): R|kotlin/Unit|
public final fun component1(): R|kotlin/Unit|
public final fun copy(x: R|kotlin/Unit| = this@R|/My|.R|/My.x|): R|My|
}
public abstract interface I : R|kotlin/Any| {
public abstract val x: R|kotlin/Unit|
public get(): R|kotlin/Unit|
}
public final class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
public final fun too(): @R|kotlin/Annotation|() R|kotlin/Unit| {
}
public final fun foo(): R|kotlin/Unit| {
}
public final fun bar(): R|kotlin/Unit| {
^bar Q|kotlin/Unit|
}
public final fun baz(): R|kotlin/Unit| {
^baz this@R|/A|.R|/A.bar|()
}
public final fun f1(): R|kotlin/Int| {
^f1 Int(1)
}
public final fun f2(): R|kotlin/Unit| {
throw R|java/lang/UnsupportedOperationException.UnsupportedOperationException|(String())
}
public final fun f3(): R|kotlin/Unit| {
^f3 throw R|java/lang/UnsupportedOperationException.UnsupportedOperationException|(String())
}
}
public final class B : R|kotlin/Any| {
public constructor(): R|B| {
super<R|kotlin/Any|>()
}
public final fun <T> run(f: R|() -> T|): R|T| {
^run R|<local>/f|.R|SubstitutionOverride<kotlin/Function0.invoke: R|T|>|()
}
public final fun foo(): R|kotlin/Unit| {
^foo this@R|/B|.R|/B.run|<R|kotlin/Unit|>(<L> = run@fun <anonymous>(): R|kotlin/Unit| {
this@R|/B|.R|/B.bar|()
}
)
}
public final fun bar(): R|kotlin/Int| {
^bar Int(1)
}
public final fun call(f: R|() -> kotlin/Unit|): R|kotlin/Unit| {
^call R|<local>/f|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
}
public final fun boo(): R|kotlin/Unit| {
^boo this@R|/B|.R|/B.call|(<L> = call@fun <anonymous>(): R|kotlin/Unit| {
this@R|/B|.R|/B.baz|()
}
)
}
public final fun baz(): R|kotlin/Unit| {
}
public final fun <T, R> R|T|.let(f: R|(T) -> R|): R|R| {
^let R|<local>/f|.R|SubstitutionOverride<kotlin/Function1.invoke: R|R|>|(this@R|/B.let|)
}
public final fun goo(): R|kotlin/Unit| {
^goo (this@R|/B|, Int(1)).R|/B.let|<R|kotlin/Int|, R|kotlin/Unit|>(<L> = let@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Unit| {
this@R|/B|.R|/B.bar|()
}
)
}
}
@@ -0,0 +1,54 @@
data class My(val x: Unit)
interface I {
val x: Unit
}
class A {
fun too(): @Annotation Unit {}
fun foo(): <!REDUNDANT_RETURN_UNIT_TYPE!>Unit<!>
{
}
fun bar(): <!REDUNDANT_RETURN_UNIT_TYPE!>Unit<!>
{
return Unit
}
fun baz(): Unit = bar()
fun f1(): Int = 1
fun f2(): <!REDUNDANT_RETURN_UNIT_TYPE!>Unit<!>
{
throw UnsupportedOperationException("")
}
fun f3(): Unit = throw UnsupportedOperationException("")
}
class B {
fun <T> run(f: () -> T) = f()
fun foo(): Unit = run {
bar()
}
fun bar() = 1
fun call(f: () -> Unit) = f()
fun boo(): Unit = call {
baz()
}
fun baz() {}
fun <T, R> T.let(f: (T) -> R) = f(this)
fun goo(): Unit = 1.let {
bar()
}
}
@@ -0,0 +1,40 @@
FILE: RedundantSetterParameterTypeChecker.kt
@R|kotlin/annotation/Target|(vararg(Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.CLASS|)) public final annotation class Ann : R|kotlin/Annotation| {
public constructor(): R|Ann| {
super<R|kotlin/Any|>()
}
}
public final var x: R|kotlin/Int|
public get(): R|kotlin/Int| {
^ Int(1)
}
public set(@R|Ann|() x: R|kotlin/Int|): R|kotlin/Unit| {
}
public final var x: R|kotlin/String| = String()
public get(): R|kotlin/String|
public set(param: R|kotlin/String|): R|kotlin/Unit| {
F|/x| = <strcat>(R|<local>/param|.R|kotlin/Any.toString|(), String( ))
}
public final class My : R|kotlin/Any| {
public constructor(): R|My| {
super<R|kotlin/Any|>()
}
public final var y: R|kotlin/Int| = Int(1)
public get(): R|kotlin/Int|
public set(param: R|kotlin/Int|): R|kotlin/Unit| {
this@R|/My|.F|/My.y| = R|<local>/param|.R|kotlin/Int.minus|(Int(1))
}
public final var z: R|kotlin/Double| = Double(3.14)
public get(): R|kotlin/Double|
private set(value: R|kotlin/Double|): R|kotlin/Unit|
public final var w: R|kotlin/Boolean| = Boolean(true)
public get(): R|kotlin/Boolean|
public set(param: R|kotlin/Boolean|): R|kotlin/Unit| {
this@R|/My|.F|/My.w| = R|<local>/param|.R|kotlin/Boolean.not|()
}
}
@@ -0,0 +1,28 @@
@Target(AnnotationTarget.CLASS)
annotation class Ann
<!REDECLARATION!>var x: Int
get() = 1
set(@Ann private x) { }<!>
<!REDECLARATION!>var x: String = ""
set(param: <!REDUNDANT_SETTER_PARAMETER_TYPE!>String<!>) {
field = "$param "
}<!>
class My {
var y: Int = 1
set(param: <!REDUNDANT_SETTER_PARAMETER_TYPE!>Int<!>) {
field = param - 1
}
var z: Double = 3.14
private set
var w: Boolean = true
set(param) {
field = !param
}
}
@@ -0,0 +1,39 @@
FILE: RedundantSingleExpressionStringTemplateChecker.kt
public final val x: R|kotlin/String| = String(Hello)
public get(): R|kotlin/String|
public final val y: R|kotlin/String| = <strcat>(R|/x|.R|kotlin/Any.toString|())
public get(): R|kotlin/String|
public final val z: R|kotlin/String| = <strcat>(R|/y|.R|kotlin/Any.hashCode|().R|kotlin/Any.toString|())
public get(): R|kotlin/String|
public final fun toString(x: R|kotlin/String|): R|kotlin/String| {
^toString <strcat>(String(IC), R|<local>/x|.R|kotlin/Any.toString|())
}
public final data class ProductGroup : R|kotlin/Any| {
public constructor(short_name: R|kotlin/String|, parent: R|ProductGroup?|): R|ProductGroup| {
super<R|kotlin/Any|>()
}
public final val short_name: R|kotlin/String| = R|<local>/short_name|
public get(): R|kotlin/String|
public final val parent: R|ProductGroup?| = R|<local>/parent|
public get(): R|ProductGroup?|
public final val name: R|kotlin/String| = when () {
==(this@R|/ProductGroup|.R|/ProductGroup.parent|, Null(null)) -> {
this@R|/ProductGroup|.R|/ProductGroup.short_name|
}
else -> {
<strcat>(this@R|/ProductGroup|.R|/ProductGroup.parent|.R|/ProductGroup.name|.R|kotlin/Any.toString|(), String( ), this@R|/ProductGroup|.R|/ProductGroup.short_name|.R|kotlin/Any.toString|())
}
}
public get(): R|kotlin/String|
public final fun component1(): R|kotlin/String|
public final fun component2(): R|ProductGroup?|
public final fun copy(short_name: R|kotlin/String| = this@R|/ProductGroup|.R|/ProductGroup.short_name|, parent: R|ProductGroup?| = this@R|/ProductGroup|.R|/ProductGroup.parent|): R|ProductGroup|
}
@@ -0,0 +1,11 @@
val x = "Hello"
val y = "$<!REDUNDANT_SINGLE_EXPRESSION_STRING_TEMPLATE!>x<!>"
val z = "${y.hashCode()}"
fun toString(x: String) = "IC$x"
data class ProductGroup(val short_name: String, val parent: ProductGroup?) {
val name: String = if (parent == null) short_name else "${parent.name} $short_name"
}
@@ -0,0 +1,173 @@
FILE: RedundantVisibilityModifierChecker.kt
public final fun f(): R|kotlin/Unit| {
lvar baz: R|kotlin/Int| = Int(0)
local final class LocalClass : R|kotlin/Any| {
public constructor(): R|LocalClass| {
super<R|kotlin/Any|>()
}
internal final var foo: R|kotlin/Int| = Int(0)
internal get(): R|kotlin/Int|
internal set(value: R|kotlin/Int|): R|kotlin/Unit|
}
R|/LocalClass.LocalClass|().R|/LocalClass.foo| = Int(1)
}
internal final inline fun internal(): R|kotlin/Unit| {
R|/f|()
}
public final class C : R|kotlin/Any| {
public constructor(): R|C| {
super<R|kotlin/Any|>()
}
internal final val z: R|<anonymous>| = object : R|kotlin/Any| {
private constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public final fun foo(): R|kotlin/Int| {
^foo Int(13)
}
}
internal get(): R|<anonymous>|
}
public final class Foo2<T1, T2 : R|T1|> : R|kotlin/Any| {
public constructor<T1, T2 : R|T1|>(): R|Foo2<T1, T2>| {
super<R|kotlin/Any|>()
}
public final fun <T1, T2> foo2(): R|kotlin/Unit| {
}
internal final inner class B<T, T2, T1, T2 : R|T1|> : R|kotlin/Any| {
public constructor<T, T2>(): R|Foo2.B<T, T2, T1, T2>| {
super<R|kotlin/Any|>()
}
}
}
public final class C : R|kotlin/Any| {
public constructor(): R|C| {
super<R|kotlin/Any|>()
}
public final val foo: R|kotlin/Int| = Int(0)
public get(): R|kotlin/Int|
public final fun bar(): R|kotlin/Unit| {
}
}
public open class D : R|kotlin/Any| {
public constructor(): R|D| {
super<R|kotlin/Any|>()
}
protected open fun willRemainProtected(): R|kotlin/Unit| {
}
protected open fun willBecomePublic(): R|kotlin/Unit| {
}
}
public final class E : R|D| {
public constructor(): R|E| {
super<R|D|>()
}
protected final override fun willRemainProtected(): R|kotlin/Unit| {
}
public final override fun willBecomePublic(): R|kotlin/Unit| {
}
}
public final enum class F : R|kotlin/Enum<F>| {
private constructor(x: R|kotlin/Int|): R|F| {
super<R|kotlin/Enum<F>|>()
}
public final val x: R|kotlin/Int| = R|<local>/x|
public get(): R|kotlin/Int|
public final static enum entry FIRST: R|F| = object : R|F| {
private constructor(): R|<anonymous>| {
super<R|F|>(Int(42))
}
}
public final static fun values(): R|kotlin/Array<F>| {
}
public final static fun valueOf(value: R|kotlin/String|): R|F| {
}
}
public sealed class G : R|kotlin/Any| {
private constructor(y: R|kotlin/Int|): R|G| {
super<R|kotlin/Any|>()
}
public final val y: R|kotlin/Int| = R|<local>/y|
public get(): R|kotlin/Int|
private constructor(): R|G| {
this<R|G|>(Int(42))
}
public final object H : R|G| {
private constructor(): R|G.H| {
super<R|G|>()
}
}
}
public abstract interface I : R|kotlin/Any| {
public abstract fun bar(): R|kotlin/Unit|
}
public final var baz: R|kotlin/Int| = Int(0)
public get(): R|kotlin/Int|
public set(value: R|kotlin/Int|): R|kotlin/Unit|
public open class J : R|kotlin/Any| {
public constructor(): R|J| {
super<R|kotlin/Any|>()
}
protected final val baz: R|kotlin/Int| = Int(0)
protected get(): R|kotlin/Int| {
^ this@R|/J|.F|/J.baz|.R|kotlin/Int.times|(Int(2))
}
public final var baf: R|kotlin/Int| = Int(0)
public get(): R|kotlin/Int| {
^ Int(1)
}
public set(value: R|kotlin/Int|): R|kotlin/Unit| {
this@R|/J|.F|/J.baf| = R|<local>/value|
}
public final var buf: R|kotlin/Int| = Int(0)
private get(): R|kotlin/Int| {
^ Int(42)
}
protected set(value: R|kotlin/Int|): R|kotlin/Unit| {
this@R|/J|.F|/J.buf| = R|<local>/value|
}
public final var bar: R|kotlin/Int| = Int(0)
public get(): R|kotlin/Int| {
^ Double(3.1415926535)
}
public set(value: R|kotlin/Int|): R|kotlin/Unit| {
}
}
@@ -0,0 +1,86 @@
fun f() {
<!CAN_BE_VAL{LT}, REDUNDANT_VISIBILITY_MODIFIER{LT}, UNUSED_VARIABLE{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>public<!> <!CAN_BE_VAL{PSI}!>var<!> <!UNUSED_VARIABLE{PSI}!>baz<!> = 0<!>
class LocalClass {
<!REDUNDANT_VISIBILITY_MODIFIER{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>internal<!> var foo = 0<!>
}
LocalClass().foo = 1
}
internal inline fun internal() {
f()
}
<!REDECLARATION!>class C {
internal val z = object {
fun foo() = 13
}
}<!>
class Foo2<
T1,
T2: T1,
> {
fun <T1,
T2, > foo2() {}
internal inner class B<T,T2,>
}
<!REDECLARATION, REDUNDANT_VISIBILITY_MODIFIER{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>public<!> class C {
<!REDUNDANT_VISIBILITY_MODIFIER{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>public<!> val foo: Int = 0<!>
<!REDUNDANT_VISIBILITY_MODIFIER{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>public<!> fun bar() {}<!>
}<!>
open class D {
protected open fun willRemainProtected() {
}
protected open fun willBecomePublic() {
}
}
class E : D() {
<!REDUNDANT_VISIBILITY_MODIFIER{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>protected<!> override fun willRemainProtected() {
}<!>
public override fun willBecomePublic() {
}
}
enum class F <!REDUNDANT_VISIBILITY_MODIFIER{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>private<!> constructor(val x: Int)<!> {
FIRST(42)
}
sealed class G constructor(val y: Int) {
<!REDUNDANT_VISIBILITY_MODIFIER{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>private<!> constructor(): this(42)<!>
object H : G()
}
interface I {
fun bar()
}
<!REDUNDANT_VISIBILITY_MODIFIER{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>public<!> var baz = 0<!>
open class J {
protected val baz = 0
<!REDUNDANT_VISIBILITY_MODIFIER{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>protected<!> get() = field * 2<!>
var baf = 0
<!REDUNDANT_VISIBILITY_MODIFIER{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>public<!> get() = 1<!>
<!REDUNDANT_VISIBILITY_MODIFIER{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>public<!> set(value) {
field = value
}<!>
var buf = 0
private get() = 42
protected set(value) {
field = value
}
var bar = 0
get() = 3.1415926535
set(value) {}
}
@@ -0,0 +1,5 @@
FILE: Basic.kt
public final val list1: R|kotlin/collections/List<kotlin/Int>| = R|kotlin/collections/listOf|<R|kotlin/Int|>(Int(1))
public get(): R|kotlin/collections/List<kotlin/Int>|
public final val list: R|kotlin/collections/List<kotlin/Int>| = R|/list1|.R|kotlin/collections/orEmpty|<R|kotlin/Int|>()
public get(): R|kotlin/collections/List<kotlin/Int>|
@@ -0,0 +1,4 @@
// WITH_RUNTIME
val list1: List<Int> = listOf(1)
val list = list1.<!USELESS_CALL_ON_NOT_NULL!>orEmpty()<!>
@@ -0,0 +1,5 @@
FILE: NotNullType.kt
public final val list1: R|kotlin/collections/List<kotlin/Int>| = R|kotlin/collections/listOf|<R|kotlin/Int|>(Int(1))
public get(): R|kotlin/collections/List<kotlin/Int>|
public final val list: R|kotlin/collections/List<kotlin/Int>| = R|/list1|.R|kotlin/collections/orEmpty|<R|kotlin/Int|>()
public get(): R|kotlin/collections/List<kotlin/Int>|
@@ -0,0 +1,4 @@
// WITH_RUNTIME
val list1: List<Int> = listOf(1)
val list = list1.<!USELESS_CALL_ON_NOT_NULL!>orEmpty()<!>
@@ -0,0 +1,8 @@
FILE: NotNullTypeChain.kt
public final val list1: R|kotlin/collections/List<kotlin/Int>| = R|kotlin/collections/listOf|<R|kotlin/Int|>(Int(1))
public get(): R|kotlin/collections/List<kotlin/Int>|
public final val list: R|kotlin/collections/List<kotlin/String>| = R|/list1|.R|kotlin/collections/orEmpty|<R|kotlin/Int|>().R|kotlin/collections/map|<R|kotlin/Int|, R|kotlin/String|>(<L> = map@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/String| <kind=UNKNOWN> {
^ <strcat>(R|<local>/it|.R|kotlin/Any.toString|())
}
)
public get(): R|kotlin/collections/List<kotlin/String>|
@@ -0,0 +1,4 @@
// WITH_RUNTIME
val list1: List<Int> = listOf(1)
val list = list1.<!USELESS_CALL_ON_NOT_NULL!>orEmpty()<!>.map { "$it" }
@@ -0,0 +1,5 @@
FILE: NullOrBlankSafe.kt
public final val s: R|kotlin/String?| = String()
public get(): R|kotlin/String?|
public final val blank: R|kotlin/Boolean| = R|/s|.R|kotlin/text/isNullOrBlank|()
public get(): R|kotlin/Boolean|
@@ -0,0 +1,4 @@
// WITH_RUNTIME
val s: String? = ""
val blank = s.isNullOrBlank()
@@ -0,0 +1,5 @@
FILE: NullOrEmpty.kt
public final val s: R|kotlin/String| = String()
public get(): R|kotlin/String|
public final val empty: R|kotlin/Boolean| = R|/s|.R|kotlin/text/isNullOrEmpty|()
public get(): R|kotlin/Boolean|
@@ -0,0 +1,4 @@
// WITH_RUNTIME
val s = ""
val empty = s.<!USELESS_CALL_ON_NOT_NULL!>isNullOrEmpty()<!>
@@ -0,0 +1,5 @@
FILE: NullOrEmptyFake.kt
public final val s: R|kotlin/String?| = Null(null)
public get(): R|kotlin/String?|
public final val empty: R|kotlin/Boolean| = R|/s|.R|kotlin/text/isNullOrEmpty|()
public get(): R|kotlin/Boolean|
@@ -0,0 +1,4 @@
// WITH_RUNTIME
val s: String? = null
val empty = s.isNullOrEmpty()
@@ -0,0 +1,5 @@
FILE: NullOrEmptySafe.kt
public final val s: R|kotlin/String?| = String()
public get(): R|kotlin/String?|
public final val empty: R|kotlin/Boolean?| = R|/s|?.{ $subj$.R|kotlin/text/isNullOrEmpty|() }
public get(): R|kotlin/Boolean?|
@@ -0,0 +1,4 @@
// WITH_RUNTIME
val s: String? = ""
val empty = s?.<!USELESS_CALL_ON_NOT_NULL!>isNullOrEmpty()<!>
@@ -0,0 +1,5 @@
FILE: OrEmptyFake.kt
public final val list: R|kotlin/collections/List<kotlin/String>?| = Null(null)
public get(): R|kotlin/collections/List<kotlin/String>?|
public final val empty: R|kotlin/collections/List<kotlin/String>| = R|/list|.R|kotlin/collections/orEmpty|<R|kotlin/String|>()
public get(): R|kotlin/collections/List<kotlin/String>|
@@ -0,0 +1,4 @@
// WITH_RUNTIME
val list: List<String>? = null
val empty = list.orEmpty()
@@ -0,0 +1,5 @@
FILE: SafeCall.kt
public final val list1: R|kotlin/collections/List<kotlin/Int>?| = R|kotlin/collections/listOf|<R|kotlin/Int|>(Int(1))
public get(): R|kotlin/collections/List<kotlin/Int>?|
public final val list: R|kotlin/collections/List<kotlin/Int>?| = R|/list1|?.{ $subj$.R|kotlin/collections/orEmpty|<R|kotlin/Int|>() }
public get(): R|kotlin/collections/List<kotlin/Int>?|
@@ -0,0 +1,4 @@
// WITH_RUNTIME
val list1: List<Int>? = listOf(1)
val list = list1?.<!USELESS_CALL_ON_NOT_NULL!>orEmpty()<!>
@@ -0,0 +1,4 @@
FILE: Sequence.kt
public final fun test(s: R|kotlin/sequences/Sequence<kotlin/Int>|): R|kotlin/Unit| {
lval foo: R|kotlin/sequences/Sequence<kotlin/Int>| = R|<local>/s|.R|kotlin/sequences/orEmpty|<R|kotlin/Int|>()
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(s: Sequence<Int>) {
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>foo<!> = s.<!USELESS_CALL_ON_NOT_NULL!>orEmpty()<!><!>
}
@@ -0,0 +1,5 @@
FILE: String.kt
public final val s: R|kotlin/String| = String()
public get(): R|kotlin/String|
public final val s1: R|kotlin/String| = R|/s|.R|kotlin/text/orEmpty|()
public get(): R|kotlin/String|
@@ -0,0 +1,4 @@
// WITH_RUNTIME
val s = ""
val s1 = s.<!USELESS_CALL_ON_NOT_NULL!>orEmpty()<!>
@@ -0,0 +1,8 @@
FILE: BasicTest.kt
public final fun goo(): R|kotlin/Unit| {
lvar a: R|kotlin/Int| = Int(2)
lval b: R|kotlin/Int| = Int(4)
R|<local>/a| = R|<local>/a|.R|kotlin/Int.plus|(Int(1)).R|kotlin/Int.plus|(R|<local>/b|)
R|<local>/a| = R|<local>/a|.R|kotlin/Int.plus|(Int(1))
R|<local>/a| = R|<local>/a|.R|kotlin/Int.times|(R|<local>/b|).R|kotlin/Int.plus|(Int(1))
}
@@ -0,0 +1,7 @@
fun goo() {
var a = 2
val b = 4
<!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{LT}!>a <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{PSI}!>=<!> a + 1 + b<!>
<!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{LT}!>a <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{PSI}!>=<!> (a + 1)<!>
<!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> = a * b + 1
}
@@ -0,0 +1,5 @@
FILE: ComplexExpression.kt
public final fun foo(): R|kotlin/Unit| {
lvar a: R|kotlin/Int| = Int(0)
R|<local>/a| = R|<local>/a|.R|kotlin/Int.plus|(Int(1)).R|kotlin/Int.div|(Int(2))
}
@@ -0,0 +1,4 @@
fun foo() {
var a = 0
<!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> = (a + 1) / 2
}
@@ -0,0 +1,5 @@
FILE: OperatorAssignment.kt
public final fun foo(): R|kotlin/Unit| {
lvar a: R|kotlin/Int| = Int(0)
R|<local>/a| = R|<local>/a|.R|kotlin/Int.plus|(Int(10).R|kotlin/Int.plus|(R|<local>/a|))
}
@@ -0,0 +1,4 @@
fun foo() {
var a = 0
<!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> += 10 + a
}
@@ -0,0 +1,6 @@
FILE: flexibleTypeBug.kt
public final fun foo(): R|kotlin/Unit| {
lvar list1: R|ft<@FlexibleNullability kotlin/collections/MutableList<ft<kotlin/String, kotlin/String?>!>, kotlin/collections/List<ft<kotlin/String, kotlin/String?>!>?>!| = Q|java/util/Collections|.R|java/util/Collections.emptyList|<R|ft<kotlin/String, kotlin/String?>!|>()
lval list2: R|kotlin/collections/List<kotlin/String>| = R|kotlin/collections/listOf|<R|kotlin/String|>(String(b))
R|<local>/list1| = R|<local>/list1|.R|kotlin/collections/plus|<R|ft<kotlin/String, kotlin/String?>!|>(R|<local>/list2|)
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
var list1 = java.util.Collections.emptyList<String>()
val list2 = listOf("b")
<!ASSIGNED_VALUE_IS_NEVER_READ!>list1<!> = list1 + list2
}
@@ -0,0 +1,5 @@
FILE: illegalMultipleOperators.kt
public final fun foo(): R|kotlin/Unit| {
lvar x: R|kotlin/Int| = Int(0)
R|<local>/x| = R|<local>/x|.R|kotlin/Int.div|(Int(1)).R|kotlin/Int.plus|(Int(1))
}
@@ -0,0 +1,4 @@
fun foo() {
var x = 0
<!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> = x / 1 + 1
}
@@ -0,0 +1,6 @@
FILE: illegalMultipleOperatorsMiddle.kt
public final fun foo(): R|kotlin/Unit| {
lvar x: R|kotlin/Int| = Int(0)
lval y: R|kotlin/Int| = Int(0)
R|<local>/x| = R|<local>/y|.R|kotlin/Int.div|(R|<local>/x|).R|kotlin/Int.plus|(Int(0))
}
@@ -0,0 +1,5 @@
fun foo() {
var x = 0
val y = 0
<!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> = y / x + 0
}
@@ -0,0 +1,5 @@
FILE: invalidSubtraction.kt
public final fun foo(): R|kotlin/Unit| {
lvar x: R|kotlin/Int| = Int(0)
R|<local>/x| = Int(1).R|kotlin/Int.minus|(R|<local>/x|)
}
@@ -0,0 +1,4 @@
fun foo() {
var x = 0
<!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> = 1 - x
}
@@ -0,0 +1,5 @@
FILE: list.kt
public final fun foo(): R|kotlin/Unit| {
lvar list: R|kotlin/collections/List<kotlin/Int>| = R|kotlin/collections/listOf|<R|kotlin/Int|>(vararg(Int(1), Int(2), Int(3)))
R|<local>/list| = R|<local>/list|.R|kotlin/collections/plus|<R|kotlin/Int|>(Int(4))
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
fun foo() {
var list = listOf(1, 2, 3)
// Should not be highlighted because it's the way we use to say explicitly
// "yes, we want to re-assign this immutable list"
<!ASSIGNED_VALUE_IS_NEVER_READ!>list<!> = list + 4
}
@@ -0,0 +1,5 @@
FILE: logicOperators.kt
public final fun foo(something: R|kotlin/Boolean|): R|kotlin/Unit| {
lvar res: R|kotlin/Boolean| = Boolean(false)
R|<local>/res| = R|<local>/res|.R|kotlin/Boolean.and|(R|<local>/something|)
}
@@ -0,0 +1,4 @@
fun foo(something: Boolean) {
var res = false
<!ASSIGNED_VALUE_IS_NEVER_READ!>res<!> = res and something
}
@@ -0,0 +1,6 @@
FILE: multipleOperators.kt
public final fun foo(): R|kotlin/Unit| {
lvar x: R|kotlin/Int| = Int(0)
lvar y: R|kotlin/Int| = Int(0)
R|<local>/x| = R|<local>/x|.R|kotlin/Int.plus|(R|<local>/y|).R|kotlin/Int.plus|(Int(5))
}
@@ -0,0 +1,5 @@
fun foo() {
var x = 0
<!CAN_BE_VAL{LT}!><!CAN_BE_VAL{PSI}!>var<!> y = 0<!>
<!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{LT}!><!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{PSI}!>=<!> x + y + 5<!>
}
@@ -0,0 +1,6 @@
FILE: multipleOperatorsRightSideRepeat.kt
public final fun foo(): R|kotlin/Unit| {
lvar x: R|kotlin/Int| = Int(0)
lvar y: R|kotlin/Int| = Int(0)
R|<local>/x| = R|<local>/y|.R|kotlin/Int.plus|(R|<local>/x|).R|kotlin/Int.plus|(Int(5))
}
@@ -0,0 +1,5 @@
fun foo() {
var x = 0
<!CAN_BE_VAL{LT}!><!CAN_BE_VAL{PSI}!>var<!> y = 0<!>
<!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{LT}!><!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{PSI}!>=<!> y + x + 5<!>
}

Some files were not shown because too many files have changed in this diff Show More