Introduce warning for private inline functions which return anonymous objects without specified supertypes (KT-33917)
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
private inline fun foo(crossinline f: () -> Int) = object {
|
||||
fun bar(): Int = f()
|
||||
}
|
||||
|
||||
fun test(b: Boolean) {
|
||||
var x = foo { 1 }
|
||||
if (b) {
|
||||
x = foo { 2 }
|
||||
}
|
||||
x.bar()
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
private inline fun <!PRIVATE_INLINE_FUNCTIONS_RETURNING_ANONYMOUS_OBJECTS!>foo<!>(crossinline f: () -> Int) = object {
|
||||
fun bar(): Int = f()
|
||||
}
|
||||
|
||||
fun test(b: Boolean) {
|
||||
var x = foo { 1 }
|
||||
if (b) {
|
||||
x = foo { 2 }
|
||||
}
|
||||
x.bar()
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package
|
||||
|
||||
private inline fun foo(/*0*/ crossinline f: () -> kotlin.Int): foo.<no name provided>
|
||||
public fun test(/*0*/ b: kotlin.Boolean): kotlin.Unit
|
||||
Reference in New Issue
Block a user