[FIR] Add NOTHING_TO_INLINE diagnostic

This commit is contained in:
Andrey Zinovyev
2021-07-20 13:21:38 +03:00
committed by teamcityserver
parent 28344c8530
commit 015c2d1875
34 changed files with 72 additions and 306 deletions
@@ -1,7 +0,0 @@
inline fun <R> onlyLocal(p: () -> R) {
inlineAll(<!USAGE_IS_NOT_INLINABLE!>p<!>)
}
inline fun <R> inlineAll(noinline p: () -> R) {
p()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
inline fun <R> onlyLocal(p: () -> R) {
inlineAll(<!USAGE_IS_NOT_INLINABLE!>p<!>)
}
@@ -1,4 +1,4 @@
inline fun inlineFun() {
<!NOTHING_TO_INLINE!>inline<!> fun inlineFun() {
<!NOT_YET_SUPPORTED_IN_INLINE!>fun<!> localFun() {}
<!NOT_YET_SUPPORTED_IN_INLINE!>class<!> LocalClass {}
}
@@ -7,6 +7,6 @@ fun box() : String {
return "OK"
}
inline fun <T> test(p: T) {
<!NOTHING_TO_INLINE!>inline<!> fun <T> test(p: T) {
p.toString()
}
@@ -6,6 +6,6 @@ fun box() : String {
return "OK"
}
inline fun test(p: Any) {
<!NOTHING_TO_INLINE!>inline<!> fun test(p: Any) {
p.toString()
}
}
@@ -1,4 +1,4 @@
inline fun foo() {
<!NOTHING_TO_INLINE!>inline<!> fun foo() {
<!UNRESOLVED_REFERENCE!>unresolved<!>().another
<!UNRESOLVED_REFERENCE!>unresolved<!>().another()
}
@@ -1,29 +0,0 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NULLABLE_INLINE_PARAMETER -CONFLICTING_JVM_DECLARATIONS
inline fun test() {
}
inline fun test2(s : (Int) -> Int) {
}
inline fun test3(noinline s : (Int) -> Int) {
}
inline fun test4(noinline s : Int.() -> Int) {
}
inline fun Function1<Int, Int>?.test5() {
}
inline fun Function1<Int, Int>?.test6() {
}
inline fun test2(s : ((Int) -> Int)?) {
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NULLABLE_INLINE_PARAMETER -CONFLICTING_JVM_DECLARATIONS
<!NOTHING_TO_INLINE!>inline<!> fun test() {
@@ -12,10 +12,10 @@ public inline fun <T> submitNoInline(noinline action: Function1<Int, Int>?, s: (
action?.invoke(10)
}
public inline fun <T> Function1<Int, Int>?.submit() {
public <!NOTHING_TO_INLINE!>inline<!> fun <T> Function1<Int, Int>?.submit() {
}
public inline fun <T> submit(action: Function1<Int, Int>?) {
public <!NOTHING_TO_INLINE!>inline<!> fun <T> submit(action: Function1<Int, Int>?) {
}
@@ -7,7 +7,7 @@ inline fun inlineFunWithInvoke(s: (p: Int) -> Unit) {
(<!USAGE_IS_NOT_INLINABLE!>s<!>)
}
inline fun Function1<Int, Unit>.inlineExt() {
<!NOTHING_TO_INLINE!>inline<!> fun Function1<Int, Unit>.inlineExt() {
(this).invoke(11)
(this) <!INFIX_MODIFIER_REQUIRED!>invoke<!> 11
(this)(11)
@@ -1,20 +0,0 @@
inline fun inlineFun(s: (p: Int) -> Unit) : (p: Int) -> Unit {
return <!USAGE_IS_NOT_INLINABLE!>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 <!USAGE_IS_NOT_INLINABLE!>ext<!>
}
inline fun inlineFunWithExt2(ext: Int.(p: Int) -> Unit) : Int.(p: Int) -> Unit = <!USAGE_IS_NOT_INLINABLE!>ext<!>
inline fun Function1<Int, Unit>.inlineExt(): Function1<Int, Unit> {
return this
}
inline fun Function1<Int, Unit>.inlineExt2(): Function1<Int, Unit> = this
+1
View File
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
inline fun inlineFun(s: (p: Int) -> Unit) : (p: Int) -> Unit {
return <!USAGE_IS_NOT_INLINABLE!>s<!>
}
-58
View File
@@ -1,58 +0,0 @@
// !DIAGNOSTICS: -NON_LOCAL_RETURN_NOT_ALLOWED
// FILE: Run.java
public interface Run {
public int run();
}
// FILE: Test.java
public class Test {
public void test(Run r) {
}
}
// FILE: test.kt
inline fun inlineFunWithInvoke(s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {
Test().test(){
s(11)
s.invoke(11)
s <!INFIX_MODIFIER_REQUIRED!>invoke<!> 11
11.ext(11)
11 <!INFIX_MODIFIER_REQUIRED!>ext<!> 11
<!USAGE_IS_NOT_INLINABLE!>s<!>
<!USAGE_IS_NOT_INLINABLE!>ext<!>
11
}
}
inline fun inlineFunWithInvokeNonInline(noinline s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {
Test().test(){
s(11)
s.invoke(11)
s <!INFIX_MODIFIER_REQUIRED!>invoke<!> 11
11.ext(11)
11 <!INFIX_MODIFIER_REQUIRED!>ext<!> 11
s
<!USAGE_IS_NOT_INLINABLE!>ext<!>
11
}
}
inline fun Function1<Int, Unit>.inlineExt() {
Test().test(){
invoke(11)
this.invoke(11)
this <!INFIX_MODIFIER_REQUIRED!>invoke<!> 11
this(11)
this
11
}
}
+1
View File
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -NON_LOCAL_RETURN_NOT_ALLOWED
// FILE: Run.java
public interface Run {