Files
kotlin-fork/idea/testData/inspections/cleanup/basic/basic.kt.after
T

123 lines
1.7 KiB
Plaintext
Vendored

import pack.bar
import pack.oldFun2 // should not be removed for non-deprecated overload used
import kotlin.reflect.KProperty
import some.unresolved.declaration // should not be removed
class A private constructor()
fun foo() {
loop@
for (i in 1..100) {
val v = bar(i + 2)
/* comment */
continue@loop
}
bar(bar(10 + 2) + 1)
oldFun2()
}
fun unnecessarySafeCall(x: String) {
x.length
}
fun unnecessaryExclExcl(x: String) {
x.length
}
fun unnecessaryCast(x: String) = x
fun unnecessaryElvis(x: String) = x
@JavaAnn(1, arg1 = "abc") class MyClass
const val i = 1
annotation class Fancy(val param: Int)
@Fancy(i) class D
class B {
operator fun plus(a: A): A = A()
}
fun foo() {
B() + B()
B() + B()
B() + B()
}
class C {
fun foo() {}
fun bar() = ::foo
infix fun willBeInfix(i: Int) {}
}
fun <T> typed() {
}
fun <T> withTypeParameters() where T : Cloneable, T : Comparable<T> {
}
val x = C() willBeInfix 1
fun bar(yield: Int = 4) {}
fun yield(yield: Int) {
"$`yield`"
"${`yield`}"
`yield`
val foo = `yield` + `yield`
val foo2 = `yield`
// bar(yield = 5) //this is different in old and new inference, should be tested in compiler
yield(4)
yield() {}
class yield<T: `yield`<T>>
return@`yield`
return@`yield` Unit
val foo5: `yield`<*>
}
fun yield(i: (Int) -> Unit) {}
annotation class yield
@`yield`()
fun test2(p: Int) {
`yield`@ p
@`yield`
fun f() {}
}
object X {
fun yield() {}
fun test3(yield: Int) {
X::`yield`
`yield`::toInt
}
}
expect class Expected
actual class Actual
// KT-33060
interface AA {
fun foo(key: Any)
}
class A1 : AA {
override fun foo(key: Any) {}
}