[FIR] Add inline checker for bodies of inline functions
This checker doesn't support `@PublishedAPI` yet, so some BB tests for it were muted. #KT-46270
This commit is contained in:
committed by
TeamCityServer
parent
7e052c1eb1
commit
32c3f85679
@@ -1,14 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE
|
||||
inline fun inlineFunWithInvoke(s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {
|
||||
var d = s
|
||||
d = s
|
||||
|
||||
var e = ext
|
||||
e = ext
|
||||
}
|
||||
|
||||
|
||||
inline fun Function1<Int, Unit>.inlineExt() {
|
||||
var d = this
|
||||
d = this
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE
|
||||
inline fun inlineFunWithInvoke(s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {
|
||||
var d = <!USAGE_IS_NOT_INLINABLE!>s<!>
|
||||
@@ -11,4 +12,4 @@ inline fun inlineFunWithInvoke(s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {
|
||||
inline fun Function1<Int, Unit>.inlineExt() {
|
||||
var d = this
|
||||
d = this
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -TYPE_MISMATCH
|
||||
|
||||
inline fun inlineFunWithInvoke(s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {
|
||||
s && ext
|
||||
s || s
|
||||
}
|
||||
|
||||
inline fun inlineFunWithInvokeNonInline(noinline s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {
|
||||
s && ext
|
||||
s || s
|
||||
}
|
||||
|
||||
inline fun Function1<Int, Unit>.inlineExt() {
|
||||
invoke(11)
|
||||
this && this
|
||||
this || this
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -TYPE_MISMATCH
|
||||
|
||||
inline fun inlineFunWithInvoke(s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {
|
||||
@@ -14,4 +15,4 @@ inline fun Function1<Int, Unit>.inlineExt() {
|
||||
invoke(11)
|
||||
this && this
|
||||
this || this
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -17,6 +17,6 @@ operator fun <T, U, V, W> @ExtensionFunctionType Function3<T, U, V, W>.get(index
|
||||
}
|
||||
|
||||
inline fun <T, U, V, W> inlineFunWithInvoke(s: (p: T, l: U) -> V, ext: T.(p: U, l: V) -> W) {
|
||||
s[1]
|
||||
ext[1]
|
||||
<!USAGE_IS_NOT_INLINABLE!>s[1]<!>
|
||||
<!USAGE_IS_NOT_INLINABLE!>ext[1]<!>
|
||||
}
|
||||
|
||||
+5
-5
@@ -8,8 +8,8 @@ inline operator fun <T, U> Function1<T, U>.modAssign(p: Function1<T, U>) = {
|
||||
}
|
||||
|
||||
inline operator fun <T, U> Function1<T, U>.plusAssign(p: Function1<T, U>) {
|
||||
this -= p
|
||||
p -= this
|
||||
this -= <!USAGE_IS_NOT_INLINABLE!>p<!>
|
||||
p <!USAGE_IS_NOT_INLINABLE!>-=<!> this
|
||||
}
|
||||
|
||||
operator fun <T, U, V> @ExtensionFunctionType Function2<T, U, V>.minusAssign(ext : @ExtensionFunctionType Function2<T, U, V>) {}
|
||||
@@ -20,11 +20,11 @@ inline operator fun <T, U, V> @ExtensionFunctionType Function2<T, U, V>.modAssig
|
||||
}
|
||||
|
||||
inline operator fun <T, U, V> @ExtensionFunctionType Function2<T, U, V>.plusAssign(ext : @ExtensionFunctionType Function2<T, U, V>) {
|
||||
this -= ext
|
||||
ext -= this
|
||||
this -= <!USAGE_IS_NOT_INLINABLE!>ext<!>
|
||||
ext <!USAGE_IS_NOT_INLINABLE!>-=<!> this
|
||||
}
|
||||
|
||||
inline fun <T, U, V> inlineFunWithInvoke(s: (p: T) -> U, ext: T.(p: U) -> V) {
|
||||
s += s
|
||||
ext += ext
|
||||
}
|
||||
}
|
||||
|
||||
+8
-8
@@ -14,13 +14,13 @@ operator fun <T, U, V> Function2<T, U, V>.compareTo(index : Function2<T, U, V>)
|
||||
operator fun <T, U, V, W> @ExtensionFunctionType Function3<T, U, V, W>.compareTo(index : @ExtensionFunctionType Function3<T, U, V, W>) = 1
|
||||
|
||||
inline fun <T, U, V, W> inlineFunWithInvoke(s: (p: T, l: U) -> V, ext: T.(p: U, l: V) -> W) {
|
||||
s < s
|
||||
s <= s
|
||||
s > s
|
||||
s >= s
|
||||
s <!USAGE_IS_NOT_INLINABLE!><<!> <!USAGE_IS_NOT_INLINABLE!>s<!>
|
||||
s <!USAGE_IS_NOT_INLINABLE!><=<!> <!USAGE_IS_NOT_INLINABLE!>s<!>
|
||||
s <!USAGE_IS_NOT_INLINABLE!>><!> <!USAGE_IS_NOT_INLINABLE!>s<!>
|
||||
s <!USAGE_IS_NOT_INLINABLE!>>=<!> <!USAGE_IS_NOT_INLINABLE!>s<!>
|
||||
|
||||
ext < ext
|
||||
ext > ext
|
||||
ext <= ext
|
||||
ext >= ext
|
||||
ext <!USAGE_IS_NOT_INLINABLE!><<!> <!USAGE_IS_NOT_INLINABLE!>ext<!>
|
||||
ext <!USAGE_IS_NOT_INLINABLE!>><!> <!USAGE_IS_NOT_INLINABLE!>ext<!>
|
||||
ext <!USAGE_IS_NOT_INLINABLE!><=<!> <!USAGE_IS_NOT_INLINABLE!>ext<!>
|
||||
ext <!USAGE_IS_NOT_INLINABLE!>>=<!> <!USAGE_IS_NOT_INLINABLE!>ext<!>
|
||||
}
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@ inline operator fun <T, U> Function1<T, U>.component1() = 1
|
||||
inline operator fun <T, U> Function1<T, U>.component2() = 2
|
||||
|
||||
inline fun <T, U, V> inlineFunWithInvoke(s: (p: T) -> U) {
|
||||
val (d1, e1) = s
|
||||
val (d1, e1) = <!USAGE_IS_NOT_INLINABLE!>s<!>
|
||||
}
|
||||
|
||||
operator fun <T, U, V> Function2<T, U, V>.component1() = 1
|
||||
@@ -13,6 +13,6 @@ operator fun <T, U, V, W> @ExtensionFunctionType Function3<T, U, V, W>.component
|
||||
operator fun <T, U, V, W> @ExtensionFunctionType Function3<T, U, V, W>.component2() = 2
|
||||
|
||||
inline fun <T, U, V, W> inlineFunWithInvoke(s: (p: T, l: U) -> V, ext: T.(p: U, l: V) -> W) {
|
||||
val (d1, e1) = s
|
||||
val (d2, e2) = ext
|
||||
val (d1, e1) = <!USAGE_IS_NOT_INLINABLE!>s<!>
|
||||
val (d2, e2) = <!USAGE_IS_NOT_INLINABLE!>ext<!>
|
||||
}
|
||||
|
||||
+4
-4
@@ -16,9 +16,9 @@ operator fun <T, U, V> Function2<T, U, V>.contains(p: Function2<T, U, V>): Boole
|
||||
operator fun <T, U, V, W> @ExtensionFunctionType Function3<T, U, V, W>.contains(ext: @ExtensionFunctionType Function3<T, U, V, W>): Boolean = false
|
||||
|
||||
inline fun <T, U, V> inlineFunWithInvoke(s: (p: T, l: U) -> U, ext: T.(p: U, l: U) -> V) {
|
||||
s in s
|
||||
s !in s
|
||||
<!USAGE_IS_NOT_INLINABLE!>s<!> <!USAGE_IS_NOT_INLINABLE!>in<!> s
|
||||
<!USAGE_IS_NOT_INLINABLE!>s<!> <!USAGE_IS_NOT_INLINABLE!>!in<!> s
|
||||
|
||||
ext in ext
|
||||
ext !in ext
|
||||
<!USAGE_IS_NOT_INLINABLE!>ext<!> <!USAGE_IS_NOT_INLINABLE!>in<!> ext
|
||||
<!USAGE_IS_NOT_INLINABLE!>ext<!> <!USAGE_IS_NOT_INLINABLE!>!in<!> ext
|
||||
}
|
||||
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -CONFLICTING_JVM_DECLARATIONS -CONFLICTING_OVERLOADS
|
||||
operator fun <T, U> Function1<T, U>.minus(p: Function1<T, U>) {
|
||||
|
||||
}
|
||||
|
||||
operator fun <T, U, V> @ExtensionFunctionType Function2<T, U, V>.minus(p: T.(p: U) -> V) {
|
||||
|
||||
}
|
||||
|
||||
inline operator fun <T, U> Function1<T, U>.plus(p: Function1<T, U>) {
|
||||
this - p
|
||||
}
|
||||
|
||||
inline operator fun <T, U, V> @ExtensionFunctionType Function2<T, U, V>.plus(p: T.(p: U) -> V) {
|
||||
this - p
|
||||
}
|
||||
|
||||
inline fun <T, U, V> inlineFunWithInvoke(s: (p: T) -> U, ext: T.(p: U) -> V) {
|
||||
s + s
|
||||
ext + ext
|
||||
}
|
||||
|
||||
inline fun <T, U, V> inlineFunWithInvoke(s: (p: T) -> U, ext: T.(p: U) -> V) {
|
||||
s + s
|
||||
ext + ext
|
||||
}
|
||||
|
||||
inline fun <T, U> Function1<T, U>.submit() {
|
||||
this + this
|
||||
}
|
||||
|
||||
inline fun <T, U, V> @ExtensionFunctionType Function2<T, U, V>.submit() {
|
||||
this + this
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -CONFLICTING_JVM_DECLARATIONS -CONFLICTING_OVERLOADS
|
||||
operator fun <T, U> Function1<T, U>.minus(p: Function1<T, U>) {
|
||||
|
||||
|
||||
+4
-4
@@ -21,9 +21,9 @@ operator fun <T, U, V, W> @ExtensionFunctionType Function3<T, U, V, W>.rangeTo(e
|
||||
}
|
||||
|
||||
inline fun <T, U, V> inlineFunWithInvoke(s: (p: T, l: U) -> U, ext: T.(p: U, l: U) -> V) {
|
||||
s..s
|
||||
s..s
|
||||
s<!USAGE_IS_NOT_INLINABLE!>..<!><!USAGE_IS_NOT_INLINABLE!>s<!>
|
||||
s<!USAGE_IS_NOT_INLINABLE!>..<!><!USAGE_IS_NOT_INLINABLE!>s<!>
|
||||
|
||||
ext..ext
|
||||
ext..ext
|
||||
ext<!USAGE_IS_NOT_INLINABLE!>..<!><!USAGE_IS_NOT_INLINABLE!>ext<!>
|
||||
ext<!USAGE_IS_NOT_INLINABLE!>..<!><!USAGE_IS_NOT_INLINABLE!>ext<!>
|
||||
}
|
||||
|
||||
@@ -46,6 +46,6 @@ inline fun testExtension(s: (p: Int) -> Unit) {
|
||||
|
||||
inline fun inlineFunWrongExtension(s: (p: Int) -> Unit) {
|
||||
{
|
||||
s.noInlineExt(11)
|
||||
s.<!USAGE_IS_NOT_INLINABLE!>noInlineExt<!>(11)
|
||||
} ()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@ inline fun testExtension(s: (p: Int) -> Unit) {
|
||||
}
|
||||
|
||||
inline fun inlineFunWrongExtension(s: (p: Int) -> Unit) {
|
||||
s.noInlineExt(11)
|
||||
s.<!USAGE_IS_NOT_INLINABLE!>noInlineExt<!>(11)
|
||||
}
|
||||
|
||||
inline fun inlineFunNoInline(noinline s: (p: Int) -> Unit) {
|
||||
s.noInlineExt(11)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
inline fun <R> onlyLocal(p: () -> R) {
|
||||
inlineAll(p)
|
||||
inlineAll(<!USAGE_IS_NOT_INLINABLE!>p<!>)
|
||||
}
|
||||
|
||||
inline fun <R> inlineAll(noinline p: () -> R) {
|
||||
p()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNNECESSARY_NOT_NULL_ASSERTION -UNNECESSARY_SAFE_CALL
|
||||
|
||||
fun getFun(s: (p: Int) -> Unit): Function1<Int, Int> = {11}
|
||||
|
||||
inline fun getInlineFun(s: (p: Int) -> Unit): Function1<Int, Int> = {11}
|
||||
|
||||
inline fun testExtension(s: (p: Int) -> Unit) {
|
||||
getFun(s).invoke(10)
|
||||
getInlineFun(s).invoke(10)
|
||||
getInlineFun(s)!!.invoke(10)
|
||||
getInlineFun(s)?.invoke(10)
|
||||
}
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNNECESSARY_NOT_NULL_ASSERTION -UNNECESSARY_SAFE_CALL
|
||||
|
||||
fun getFun(s: (p: Int) -> Unit): Function1<Int, Int> = {11}
|
||||
@@ -9,4 +10,4 @@ inline fun testExtension(s: (p: Int) -> Unit) {
|
||||
getInlineFun(s).invoke(10)
|
||||
getInlineFun(s)!!.invoke(10)
|
||||
getInlineFun(s)?.invoke(10)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,6 @@ inline public fun reg(converter: (Any) -> Any, flag: Boolean) {
|
||||
}
|
||||
|
||||
public inline fun register(converter: (Any) -> Any) {
|
||||
converter is (Any) -> Any
|
||||
reg(converter, converter is (Any) -> Any)
|
||||
}
|
||||
<!USAGE_IS_NOT_INLINABLE!>converter<!> is (Any) -> Any
|
||||
reg(converter, <!USAGE_IS_NOT_INLINABLE!>converter<!> is (Any) -> Any)
|
||||
}
|
||||
|
||||
@@ -6,5 +6,5 @@ open class Foo protected constructor()
|
||||
inline fun foo(f: () -> Unit) = object: Foo() {}
|
||||
|
||||
class A : Foo() {
|
||||
inline fun foo(f: () -> Unit) = Foo()
|
||||
inline fun foo(f: () -> Unit) = <!PROTECTED_CONSTRUCTOR_CALL_FROM_PUBLIC_INLINE!>Foo<!>()
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
inline fun test(s: () -> Unit, p: (() -> Unit)?) {
|
||||
s()
|
||||
p?.invoke()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
class SomeContainer {
|
||||
protected class Limit
|
||||
|
||||
protected fun makeLimit(): Limit = TODO()
|
||||
|
||||
public inline fun foo(f: () -> Unit) {
|
||||
Limit()
|
||||
makeLimit()
|
||||
}
|
||||
}
|
||||
|
||||
open class A protected constructor() {
|
||||
inline fun foo(f: () -> Unit) {
|
||||
A()
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
class SomeContainer {
|
||||
|
||||
@@ -2,5 +2,5 @@ inline fun foo(f: () -> Unit) {
|
||||
val ff = { f: () -> Unit ->
|
||||
f.invoke()
|
||||
}
|
||||
ff(f)
|
||||
ff(<!USAGE_IS_NOT_INLINABLE!>f<!>)
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ inline fun foo(bar1: (String.() -> Int) -> Int, bar2: (()->Int) -> Int) {
|
||||
}
|
||||
|
||||
inline fun foo2(bar1: (String.() -> Int) -> Int) {
|
||||
l1@ bar1
|
||||
l1@ <!USAGE_IS_NOT_INLINABLE!>bar1<!>
|
||||
|
||||
l2@ bar1 {
|
||||
11
|
||||
@@ -37,4 +37,4 @@ inline fun foo2(bar1: (String.() -> Int) -> Int) {
|
||||
(l5@ (l4@ bar1)) {
|
||||
11
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNCHECKED_CAST -USELESS_CAST
|
||||
inline public fun reg(convertFunc: (Any) -> Any) {
|
||||
convertFunc("")
|
||||
}
|
||||
|
||||
public inline fun <reified T : Any, reified R : Any> register(converter: (T) -> R) {
|
||||
converter as (Any) -> Any
|
||||
reg(converter as (Any) -> Any)
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNCHECKED_CAST -USELESS_CAST
|
||||
inline public fun reg(convertFunc: (Any) -> Any) {
|
||||
convertFunc("")
|
||||
@@ -6,4 +7,4 @@ inline public fun reg(convertFunc: (Any) -> Any) {
|
||||
public inline fun <reified T : Any, reified R : Any> register(converter: (T) -> R) {
|
||||
<!USAGE_IS_NOT_INLINABLE!>converter<!> as (Any) -> Any
|
||||
reg(<!USAGE_IS_NOT_INLINABLE!>converter<!> as (Any) -> Any)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
|
||||
inline fun <R> toOnlyLocal(crossinline p: () -> R) {
|
||||
p()
|
||||
}
|
||||
|
||||
inline fun <R> inlineAll(p: () -> R) {
|
||||
toOnlyLocal(p)
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
inline fun <R> toOnlyLocal(crossinline p: () -> R) {
|
||||
p()
|
||||
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -PRIVATE_CLASS_MEMBER_FROM_INLINE
|
||||
private class Z public constructor(){
|
||||
public val publicProperty:Int = 12
|
||||
public fun publicFun() {}
|
||||
}
|
||||
|
||||
public inline fun test() {
|
||||
Z().publicProperty
|
||||
Z().publicFun()
|
||||
}
|
||||
|
||||
internal inline fun testInternal() {
|
||||
Z().publicProperty
|
||||
Z().publicFun()
|
||||
}
|
||||
|
||||
internal class Z2 {
|
||||
private val privateProperty = 11;
|
||||
|
||||
public val publicProperty:Int = 12
|
||||
|
||||
private fun privateFun() {}
|
||||
|
||||
public fun publicFun() {}
|
||||
|
||||
public inline fun test() {
|
||||
privateProperty
|
||||
privateFun()
|
||||
publicProperty
|
||||
publicFun()
|
||||
Z2().publicProperty
|
||||
Z2().publicFun()
|
||||
Z2().privateProperty
|
||||
Z2().privateFun()
|
||||
}
|
||||
|
||||
internal inline fun testInternal() {
|
||||
privateProperty
|
||||
privateFun()
|
||||
publicProperty
|
||||
publicFun()
|
||||
Z2().publicProperty
|
||||
Z2().publicFun()
|
||||
Z2().privateProperty
|
||||
Z2().privateFun()
|
||||
}
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -PRIVATE_CLASS_MEMBER_FROM_INLINE
|
||||
private class Z public constructor(){
|
||||
public val publicProperty:Int = 12
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
||||
|
||||
private val privateProperty = 11;
|
||||
private fun privateFun() {}
|
||||
|
||||
internal val internalProperty = 11;
|
||||
internal fun internalFun() {}
|
||||
|
||||
public inline fun test() {
|
||||
privateFun()
|
||||
privateProperty
|
||||
}
|
||||
|
||||
public inline fun test2() {
|
||||
internalFun()
|
||||
internalProperty
|
||||
}
|
||||
|
||||
internal inline fun testInternal() {
|
||||
privateFun()
|
||||
privateProperty
|
||||
}
|
||||
|
||||
internal inline fun test2Internal() {
|
||||
internalFun()
|
||||
internalProperty
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
||||
|
||||
private val privateProperty = 11;
|
||||
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
||||
public class Z {
|
||||
internal val privateProperty = 11;
|
||||
|
||||
internal fun privateFun() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public inline fun test() {
|
||||
Z().privateProperty
|
||||
Z().privateFun()
|
||||
}
|
||||
|
||||
internal inline fun testInternal() {
|
||||
Z().privateProperty
|
||||
Z().privateFun()
|
||||
}
|
||||
|
||||
|
||||
public class Z2 {
|
||||
private val privateProperty = 11;
|
||||
|
||||
private fun privateFun() {
|
||||
|
||||
}
|
||||
|
||||
public inline fun test() {
|
||||
privateProperty
|
||||
privateFun()
|
||||
}
|
||||
|
||||
internal inline fun testInternal() {
|
||||
privateProperty
|
||||
privateFun()
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
||||
public class Z {
|
||||
internal val privateProperty = 11;
|
||||
|
||||
+3
-3
@@ -2,11 +2,11 @@
|
||||
|
||||
|
||||
inline fun call(a: A) {
|
||||
a.test()
|
||||
a.<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>test<!>()
|
||||
|
||||
privateFun()
|
||||
<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>privateFun<!>()
|
||||
|
||||
internalFun()
|
||||
<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>internalFun<!>()
|
||||
}
|
||||
|
||||
@PublishedApi
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNNECESSARY_SAFE_CALL -UNNECESSARY_NOT_NULL_ASSERTION -CONFLICTING_JVM_DECLARATIONS
|
||||
inline fun String.submit(action: Function1<Int, Int>) {
|
||||
|
||||
}
|
||||
|
||||
inline fun Function1<Int, Int>.submit() {
|
||||
this?.invoke(11)
|
||||
this!!.invoke(11)
|
||||
|
||||
submit(this!!)
|
||||
}
|
||||
|
||||
inline fun submit(action: Function1<Int, Int>) {
|
||||
action?.invoke(10)
|
||||
action!!.invoke(10)
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNNECESSARY_SAFE_CALL -UNNECESSARY_NOT_NULL_ASSERTION -CONFLICTING_JVM_DECLARATIONS
|
||||
inline fun String.submit(action: Function1<Int, Int>) {
|
||||
|
||||
@@ -13,4 +14,4 @@ inline fun Function1<Int, Int>.submit() {
|
||||
inline fun submit(action: Function1<Int, Int>) {
|
||||
<!USAGE_IS_NOT_INLINABLE!>action<!>?.invoke(10)
|
||||
<!USAGE_IS_NOT_INLINABLE!>action<!>!!.invoke(10)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,4 +18,4 @@ public inline fun <T> Function1<Int, Int>?.submit() {
|
||||
|
||||
public inline fun <T> submit(action: Function1<Int, Int>?) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ inline fun inlineFunWithInvoke(s: (p: Int) -> Unit) {
|
||||
(s)(11)
|
||||
(s).invoke(11)
|
||||
(s) invoke 11
|
||||
(s)
|
||||
(<!USAGE_IS_NOT_INLINABLE!>s<!>)
|
||||
}
|
||||
|
||||
inline fun Function1<Int, Unit>.inlineExt() {
|
||||
@@ -18,10 +18,10 @@ inline fun inlineFunWithInvoke2(s: (p: Int) -> Unit) {
|
||||
(((s)))(11)
|
||||
(((s))).invoke(11)
|
||||
(((s))) invoke 11
|
||||
(((s)))
|
||||
(((<!USAGE_IS_NOT_INLINABLE!>s<!>)))
|
||||
}
|
||||
|
||||
inline fun propagation(s: (p: Int) -> Unit) {
|
||||
inlineFunWithInvoke((label@ s))
|
||||
inlineFunWithInvoke((label2@ label@ s))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
// !DIAGNOSTICS: -EXPOSED_PARAMETER_TYPE
|
||||
|
||||
private class S public constructor() {
|
||||
fun a() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
internal inline fun x(s: S, z: () -> Unit) {
|
||||
z()
|
||||
S()
|
||||
s.a()
|
||||
test()
|
||||
}
|
||||
|
||||
private inline fun x2(s: S, z: () -> Unit) {
|
||||
z()
|
||||
S()
|
||||
s.a()
|
||||
test()
|
||||
}
|
||||
|
||||
private fun test(): S {
|
||||
return S()
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
// FIR_IDENTICAL
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -EXPOSED_PARAMETER_TYPE
|
||||
|
||||
private class S public constructor() {
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -NON_LOCAL_RETURN_NOT_ALLOWED
|
||||
|
||||
inline fun inlineFunWithInvoke(s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {
|
||||
subInline(s, ext)
|
||||
subNoInline(s, ext)
|
||||
}
|
||||
|
||||
inline fun inlineFunWithInvokeClosure(s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {
|
||||
subInline({p: Int -> s(p)}, { p -> this.ext(p)})
|
||||
subNoInline({p: Int -> s(p)}, { p -> this.ext(p)})
|
||||
}
|
||||
|
||||
//No inline
|
||||
inline fun inlineFunWithInvokeNonInline(noinline s: (p: Int) -> Unit, noinline ext: Int.(p: Int) -> Unit) {
|
||||
subInline(s, ext)
|
||||
subNoInline(s, ext)
|
||||
}
|
||||
|
||||
inline fun inlineFunWithInvokeClosureNoinline(noinline s: (p: Int) -> Unit, noinline ext: Int.(p: Int) -> Unit) {
|
||||
subInline({p: Int -> s(p)}, { p -> this.ext(p)})
|
||||
subNoInline({p: Int -> s(p)}, { p -> this.ext(p)})
|
||||
}
|
||||
|
||||
//ext function
|
||||
inline fun Function1<Int, Unit>.inlineExt(ext: Int.(p: Int) -> Unit) {
|
||||
subInline(this, ext)
|
||||
subNoInline(this, ext)
|
||||
}
|
||||
|
||||
inline fun Function1<Int, Unit>.inlineExtWithClosure(ext: Int.(p: Int) -> Unit) {
|
||||
subInline({p: Int -> this(p)}, { p -> this.ext(p)})
|
||||
subNoInline({p: Int -> this(p)}, { p -> this.ext(p)})
|
||||
}
|
||||
|
||||
inline fun subInline(s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {}
|
||||
|
||||
fun subNoInline(s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -NON_LOCAL_RETURN_NOT_ALLOWED
|
||||
|
||||
inline fun inlineFunWithInvoke(s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {
|
||||
|
||||
@@ -18,10 +18,10 @@ open class A {
|
||||
protected set(value) {}
|
||||
|
||||
inline fun call() {
|
||||
test()
|
||||
z
|
||||
<!PROTECTED_CALL_FROM_PUBLIC_INLINE!>test<!>()
|
||||
<!PROTECTED_CALL_FROM_PUBLIC_INLINE!>z<!>
|
||||
zVar
|
||||
zVar = "123"
|
||||
zVar <!PROTECTED_CALL_FROM_PUBLIC_INLINE!>=<!> "123"
|
||||
}
|
||||
|
||||
internal inline fun callFromInternal() {
|
||||
@@ -48,13 +48,13 @@ open class A {
|
||||
|
||||
class B : A() {
|
||||
inline fun testB() {
|
||||
test()
|
||||
<!PROTECTED_CALL_FROM_PUBLIC_INLINE!>test<!>()
|
||||
}
|
||||
}
|
||||
|
||||
class C : JavaClass() {
|
||||
inline fun call() {
|
||||
bind()
|
||||
<!PROTECTED_CALL_FROM_PUBLIC_INLINE!>bind<!>()
|
||||
}
|
||||
|
||||
internal inline fun callFromInternal() {
|
||||
@@ -99,4 +99,4 @@ private class X {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ open class A {
|
||||
protected set(value) {}
|
||||
|
||||
inline fun call() {
|
||||
test()
|
||||
z
|
||||
<!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>test<!>()
|
||||
<!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>z<!>
|
||||
zVar
|
||||
zVar = "123"
|
||||
zVar <!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>=<!> "123"
|
||||
}
|
||||
|
||||
internal inline fun callFromInternal() {
|
||||
@@ -48,13 +48,13 @@ open class A {
|
||||
|
||||
class B : A() {
|
||||
inline fun testB() {
|
||||
test()
|
||||
<!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>test<!>()
|
||||
}
|
||||
}
|
||||
|
||||
class C : JavaClass() {
|
||||
inline fun call() {
|
||||
bind()
|
||||
<!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>bind<!>()
|
||||
}
|
||||
|
||||
internal inline fun callFromInternal() {
|
||||
@@ -99,4 +99,4 @@ private class X {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// !DIAGNOSTICS: -EXPOSED_PARAMETER_TYPE -NOTHING_TO_INLINE
|
||||
inline fun call(a: A) {
|
||||
a.test()
|
||||
publishedTopLevel()
|
||||
a.<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>test<!>()
|
||||
<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>publishedTopLevel<!>()
|
||||
|
||||
a.publishedVar
|
||||
a.publishedVar = 1
|
||||
a.<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>publishedVar<!>
|
||||
a.publishedVar <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>=<!> 1
|
||||
|
||||
publishedVarTopLevel
|
||||
publishedVarTopLevel = 1
|
||||
<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>publishedVarTopLevel<!>
|
||||
publishedVarTopLevel <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>=<!> 1
|
||||
}
|
||||
|
||||
inline var inlineVar: Int
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -NOTHING_TO_INLINE -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -VARIABLE_EXPECTED
|
||||
|
||||
inline fun inlineFun(s: (p: Int) -> Unit) {
|
||||
inlineFun(s)
|
||||
}
|
||||
|
||||
inline fun <T> inlineFun(s: T) {
|
||||
inlineFun<Int>(11)
|
||||
}
|
||||
|
||||
|
||||
inline fun <T> Function0<T>.inlineExt() {
|
||||
(checkSubtype<Function0<Int>>({11})).inlineExt();
|
||||
{11}.inlineExt()
|
||||
}
|
||||
|
||||
inline operator fun <T, V> Function1<T, V>.not() : Boolean {
|
||||
return !this
|
||||
}
|
||||
|
||||
inline operator fun <T, V> Function1<T, V>.inc() : Function1<T, V> {
|
||||
return this++
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -NOTHING_TO_INLINE -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -VARIABLE_EXPECTED
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
//KT-4341 No resolved call for right-hand side of equals expression
|
||||
package g
|
||||
|
||||
inline fun <T, U, V> inlineFunWithInvoke(s: (p: T) -> U) {
|
||||
s == s //resolved call for right-hand side 's' not traced
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
//KT-4341 No resolved call for right-hand side of equals expression
|
||||
package g
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
inline fun inlineFun(s: (p: Int) -> Unit) : (p: Int) -> Unit {
|
||||
return s
|
||||
return <!USAGE_IS_NOT_INLINABLE!>s<!>
|
||||
}
|
||||
|
||||
inline fun inlineFun2(s: (p: Int) -> Unit) : (p: Int) -> Unit = s
|
||||
inline fun inlineFun2(s: (p: Int) -> Unit) : (p: Int) -> Unit = <!USAGE_IS_NOT_INLINABLE!>s<!>
|
||||
|
||||
|
||||
inline fun inlineFunWithExt(ext: Int.(p: Int) -> Unit) : Int.(p: Int) -> Unit {
|
||||
return ext
|
||||
return <!USAGE_IS_NOT_INLINABLE!>ext<!>
|
||||
}
|
||||
|
||||
inline fun inlineFunWithExt2(ext: Int.(p: Int) -> Unit) : Int.(p: Int) -> Unit = ext
|
||||
inline fun inlineFunWithExt2(ext: Int.(p: Int) -> Unit) : Int.(p: Int) -> Unit = <!USAGE_IS_NOT_INLINABLE!>ext<!>
|
||||
|
||||
|
||||
|
||||
@@ -17,4 +17,4 @@ inline fun Function1<Int, Unit>.inlineExt(): Function1<Int, Unit> {
|
||||
return this
|
||||
}
|
||||
|
||||
inline fun Function1<Int, Unit>.inlineExt2(): Function1<Int, Unit> = this
|
||||
inline fun Function1<Int, Unit>.inlineExt2(): Function1<Int, Unit> = this
|
||||
|
||||
+4
-4
@@ -22,8 +22,8 @@ inline fun inlineFunWithInvoke(s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {
|
||||
11.ext(11)
|
||||
11 ext 11
|
||||
|
||||
s
|
||||
ext
|
||||
<!USAGE_IS_NOT_INLINABLE!>s<!>
|
||||
<!USAGE_IS_NOT_INLINABLE!>ext<!>
|
||||
11
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ inline fun inlineFunWithInvokeNonInline(noinline s: (p: Int) -> Unit, ext: Int.(
|
||||
11 ext 11
|
||||
|
||||
s
|
||||
ext
|
||||
<!USAGE_IS_NOT_INLINABLE!>ext<!>
|
||||
|
||||
11
|
||||
}
|
||||
@@ -55,4 +55,4 @@ inline fun Function1<Int, Unit>.inlineExt() {
|
||||
|
||||
11
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||
inline public fun reg(converter: (Any) -> Any, str: String) {
|
||||
str
|
||||
converter("")
|
||||
}
|
||||
|
||||
public inline fun register(converter: (Any) -> Any) {
|
||||
"123$converter"
|
||||
reg(converter, "123$converter")
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||
inline public fun reg(converter: (Any) -> Any, str: String) {
|
||||
str
|
||||
@@ -7,4 +8,4 @@ inline public fun reg(converter: (Any) -> Any, str: String) {
|
||||
public inline fun register(converter: (Any) -> Any) {
|
||||
"123$<!USAGE_IS_NOT_INLINABLE!>converter<!>"
|
||||
reg(converter, "123$<!USAGE_IS_NOT_INLINABLE!>converter<!>")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ open class AndroidTargetConfigurator :
|
||||
AndroidModuleConfigurator {
|
||||
|
||||
public inline fun inlineFun(): String {
|
||||
return super.classFun() + super<ModuleConfiguratorWithTests>.getConfiguratorSettings() + super<AndroidModuleConfigurator>.getConfiguratorSettings()
|
||||
return <!SUPER_CALL_FROM_PUBLIC_INLINE!>super<!>.classFun() + <!SUPER_CALL_FROM_PUBLIC_INLINE!>super<ModuleConfiguratorWithTests><!>.getConfiguratorSettings() + <!SUPER_CALL_FROM_PUBLIC_INLINE!>super<AndroidModuleConfigurator><!>.getConfiguratorSettings()
|
||||
}
|
||||
|
||||
@PublishedApi
|
||||
@@ -17,11 +17,11 @@ open class AndroidTargetConfigurator :
|
||||
|
||||
public inline fun inlineFunAnonymousObjects(): String {
|
||||
{
|
||||
super.classFun() + super<ModuleConfiguratorWithTests>.getConfiguratorSettings() + super<AndroidModuleConfigurator>.getConfiguratorSettings()
|
||||
<!SUPER_CALL_FROM_PUBLIC_INLINE!>super<!>.classFun() + <!SUPER_CALL_FROM_PUBLIC_INLINE!>super<ModuleConfiguratorWithTests><!>.getConfiguratorSettings() + <!SUPER_CALL_FROM_PUBLIC_INLINE!>super<AndroidModuleConfigurator><!>.getConfiguratorSettings()
|
||||
}()
|
||||
|
||||
return object {
|
||||
fun run() = super@AndroidTargetConfigurator.classFun() + super<ModuleConfiguratorWithTests>@AndroidTargetConfigurator.getConfiguratorSettings() + super<AndroidModuleConfigurator>@AndroidTargetConfigurator.getConfiguratorSettings()
|
||||
fun run() = <!SUPER_CALL_FROM_PUBLIC_INLINE!>super@AndroidTargetConfigurator<!>.classFun() + <!SUPER_CALL_FROM_PUBLIC_INLINE!>super<ModuleConfiguratorWithTests>@AndroidTargetConfigurator<!>.getConfiguratorSettings() + <!SUPER_CALL_FROM_PUBLIC_INLINE!>super<AndroidModuleConfigurator>@AndroidTargetConfigurator<!>.getConfiguratorSettings()
|
||||
}.run()
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ sealed class FooSealed : Base() {
|
||||
class B: FooSealed()
|
||||
|
||||
inline fun test() {
|
||||
super.classFun()
|
||||
<!SUPER_CALL_FROM_PUBLIC_INLINE!>super<!>.classFun()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -114,8 +114,8 @@ class FooOuter : Base() {
|
||||
|
||||
inner class FooInner: Base() {
|
||||
inline fun test() {
|
||||
super@FooOuter.classFun()
|
||||
super.classFun()
|
||||
<!SUPER_CALL_FROM_PUBLIC_INLINE!>super@FooOuter<!>.classFun()
|
||||
<!SUPER_CALL_FROM_PUBLIC_INLINE!>super<!>.classFun()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -12,17 +12,17 @@ operator fun <T, V> @ExtensionFunctionType Function2<T, T, V>.dec() = this
|
||||
|
||||
inline fun <T, V> inlineFunWithInvoke(s: (p: T) -> V, ext: T.(p: T) -> V) {
|
||||
+s
|
||||
-s
|
||||
s++
|
||||
++s
|
||||
s--
|
||||
--s
|
||||
<!USAGE_IS_NOT_INLINABLE!>-<!>s
|
||||
<!USAGE_IS_NOT_INLINABLE!>s<!>++
|
||||
<!USAGE_IS_NOT_INLINABLE!>++<!>s
|
||||
<!USAGE_IS_NOT_INLINABLE!>s<!>--
|
||||
<!USAGE_IS_NOT_INLINABLE, USAGE_IS_NOT_INLINABLE!>--<!>s
|
||||
+ext
|
||||
-ext
|
||||
ext++
|
||||
++ext
|
||||
ext--
|
||||
--ext
|
||||
<!USAGE_IS_NOT_INLINABLE!>-<!>ext
|
||||
<!USAGE_IS_NOT_INLINABLE!>ext<!>++
|
||||
<!USAGE_IS_NOT_INLINABLE!>++<!>ext
|
||||
<!USAGE_IS_NOT_INLINABLE!>ext<!>--
|
||||
<!USAGE_IS_NOT_INLINABLE, USAGE_IS_NOT_INLINABLE!>--<!>ext
|
||||
}
|
||||
|
||||
inline fun <T, V> Function1<T, V>.inlineFunWithInvoke() {
|
||||
|
||||
+2
-2
@@ -16,6 +16,6 @@ operator fun <T, U, V, W> @ExtensionFunctionType Function3<T, U, V, W>.not() : B
|
||||
}
|
||||
|
||||
inline fun <T, U, V> inlineFunWithInvoke(s: (p: T, l: U) -> V, ext: T.(p: T, l : U) -> V) {
|
||||
!s
|
||||
!ext
|
||||
<!USAGE_IS_NOT_INLINABLE!>!<!>s
|
||||
<!USAGE_IS_NOT_INLINABLE!>!<!>ext
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
||||
|
||||
inline fun inlineFun(s: (p: Int) -> Unit, noinline b: (p: Int) -> Unit) {
|
||||
subInline(s, b)
|
||||
subNoInline(s, b)
|
||||
}
|
||||
|
||||
inline fun Function1<Int, Unit>.inlineExt(s: (p: Int) -> Unit, noinline b: (p: Int) -> Unit) {
|
||||
subInline(this, s, b)
|
||||
subNoInline(this, s, b)
|
||||
}
|
||||
|
||||
|
||||
inline fun subInline(vararg s: (p: Int) -> Unit) {}
|
||||
|
||||
fun subNoInline(vararg s: (p: Int) -> Unit) {}
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
||||
|
||||
inline fun inlineFun(s: (p: Int) -> Unit, noinline b: (p: Int) -> Unit) {
|
||||
@@ -13,4 +14,4 @@ inline fun Function1<Int, Unit>.inlineExt(s: (p: Int) -> Unit, noinline b: (p: I
|
||||
|
||||
inline fun subInline(vararg s: (p: Int) -> Unit) {}
|
||||
|
||||
fun subNoInline(vararg s: (p: Int) -> Unit) {}
|
||||
fun subNoInline(vararg s: (p: Int) -> Unit) {}
|
||||
|
||||
+4
-4
@@ -4,8 +4,8 @@ inline public fun reg(converter: (Any) -> Any) {
|
||||
}
|
||||
|
||||
public inline fun register(converter: (Any) -> Any) {
|
||||
reg(when(converter) {
|
||||
is (Any) -> Any -> converter
|
||||
else -> converter
|
||||
reg(when(<!USAGE_IS_NOT_INLINABLE!>converter<!>) {
|
||||
is (Any) -> Any -> <!USAGE_IS_NOT_INLINABLE!>converter<!>
|
||||
else -> <!USAGE_IS_NOT_INLINABLE!>converter<!>
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -NOTHING_TO_INLINE -USELESS_ELVIS
|
||||
|
||||
inline fun inlineFunWrongUsage(s: (p: Int) -> Unit) {
|
||||
s
|
||||
|
||||
if (true) s else 0
|
||||
|
||||
s ?: s
|
||||
}
|
||||
|
||||
inline fun inlineFunWrongUsageExt(ext: Int.(p: Int) -> Unit) {
|
||||
ext
|
||||
|
||||
if (true) ext else 0
|
||||
|
||||
ext ?: ext
|
||||
}
|
||||
|
||||
inline fun inlineFunWrongUsageInClosure(s: (p: Int) -> Unit) {
|
||||
{
|
||||
s
|
||||
|
||||
if (true) s else 0
|
||||
|
||||
s ?: s
|
||||
}()
|
||||
}
|
||||
|
||||
inline fun inlineFunWrongUsageInClosureExt(ext: Int.(p: Int) -> Unit) {
|
||||
{
|
||||
ext
|
||||
|
||||
if (true) ext else 0
|
||||
|
||||
ext ?: ext
|
||||
}()
|
||||
}
|
||||
|
||||
inline fun inlineFunNoInline(noinline s: (p: Int) -> Unit) {
|
||||
s
|
||||
if (true) s else 0
|
||||
|
||||
s ?: s
|
||||
}
|
||||
|
||||
inline fun inlineFunNoInline(noinline ext: Int.(p: Int) -> Unit) {
|
||||
ext
|
||||
if (true) ext else 0
|
||||
|
||||
ext ?: ext
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -NOTHING_TO_INLINE -USELESS_ELVIS
|
||||
|
||||
inline fun inlineFunWrongUsage(s: (p: Int) -> Unit) {
|
||||
@@ -48,4 +49,4 @@ inline fun inlineFunNoInline(noinline ext: Int.(p: Int) -> Unit) {
|
||||
if (true) ext else 0
|
||||
|
||||
ext ?: ext
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ fun <T> javaClass(): Class<T> = null!!
|
||||
|
||||
public class AppServiceModule : AbstractModule<String>() {
|
||||
inline fun <reified T> AbstractModule<Int>.bind() {
|
||||
val x = bind(javaClass<T>())
|
||||
val x = <!PROTECTED_CALL_FROM_PUBLIC_INLINE!>bind<!>(javaClass<T>())
|
||||
|
||||
x checkType { <!INAPPLICABLE_CANDIDATE!>_<!><String>() } // check that Class receiver is used instead of extension one
|
||||
}
|
||||
|
||||
Vendored
+4
-4
@@ -15,16 +15,16 @@ fun foo(y: Boolean) {
|
||||
inline fun case1(block: () -> Unit) {
|
||||
val contracts = listOf(
|
||||
contract {
|
||||
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
|
||||
callsInPlace(<!USAGE_IS_NOT_INLINABLE!>block<!>, InvocationKind.EXACTLY_ONCE)
|
||||
}, contract {
|
||||
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
|
||||
callsInPlace(<!USAGE_IS_NOT_INLINABLE!>block<!>, InvocationKind.EXACTLY_ONCE)
|
||||
}
|
||||
)
|
||||
block()
|
||||
}
|
||||
|
||||
inline fun case_2(block: () -> Unit) = contract {
|
||||
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
|
||||
callsInPlace(<!USAGE_IS_NOT_INLINABLE!>block<!>, InvocationKind.EXACTLY_ONCE)
|
||||
}
|
||||
|
||||
fun case_3(block: () -> Unit) {
|
||||
@@ -73,4 +73,4 @@ fun case_7(cond: Boolean): Boolean {
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ inline fun test(crossinline c: () -> Unit) {
|
||||
}
|
||||
}
|
||||
val l = { c() }
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
c.<!USAGE_IS_NOT_INLINABLE!>startCoroutine<!>(EmptyContinuation)
|
||||
}
|
||||
|
||||
suspend fun calculate() = "OK"
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ inline fun test(crossinline c: suspend () -> Unit) {
|
||||
}
|
||||
}
|
||||
val l: suspend () -> Unit = { c() }
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
c.<!USAGE_IS_NOT_INLINABLE!>startCoroutine<!>(EmptyContinuation)
|
||||
}
|
||||
|
||||
suspend fun calculate() = "OK"
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ inline fun test(c: () -> Unit) {
|
||||
}
|
||||
}
|
||||
val l = { c() }
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
c.<!USAGE_IS_NOT_INLINABLE!>startCoroutine<!>(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ inline fun test(c: suspend () -> Unit) {
|
||||
}
|
||||
}
|
||||
val l: suspend () -> Unit = { c() }
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
c.<!USAGE_IS_NOT_INLINABLE!>startCoroutine<!>(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {}
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ suspend inline fun test(crossinline c: () -> Unit) {
|
||||
}
|
||||
}
|
||||
val l = { c() }
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
c.<!USAGE_IS_NOT_INLINABLE!>startCoroutine<!>(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ suspend inline fun test(crossinline c: suspend () -> Unit) {
|
||||
}
|
||||
}
|
||||
val l: suspend () -> Unit = { c() }
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
c.<!USAGE_IS_NOT_INLINABLE!>startCoroutine<!>(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {}
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ suspend inline fun test(c: () -> Unit) {
|
||||
}
|
||||
}
|
||||
val l = { c() }
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
c.<!USAGE_IS_NOT_INLINABLE!>startCoroutine<!>(EmptyContinuation)
|
||||
}
|
||||
|
||||
suspend fun calculate() = "OK"
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ suspend inline fun test(c: suspend () -> Unit) {
|
||||
}
|
||||
}
|
||||
val l: suspend () -> Unit = { c() }
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
c.<!USAGE_IS_NOT_INLINABLE!>startCoroutine<!>(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
|
||||
Reference in New Issue
Block a user