Prohibit local suspend functions
#KT-15392 Fixed
This commit is contained in:
@@ -82,7 +82,7 @@ object ModifierCheckerCore {
|
||||
INLINE_KEYWORD to EnumSet.of(FUNCTION, PROPERTY, PROPERTY_GETTER, PROPERTY_SETTER),
|
||||
NOINLINE_KEYWORD to EnumSet.of(VALUE_PARAMETER),
|
||||
TAILREC_KEYWORD to EnumSet.of(FUNCTION),
|
||||
SUSPEND_KEYWORD to EnumSet.of(FUNCTION),
|
||||
SUSPEND_KEYWORD to EnumSet.of(MEMBER_FUNCTION, TOP_LEVEL_FUNCTION),
|
||||
EXTERNAL_KEYWORD to EnumSet.of(FUNCTION, PROPERTY, PROPERTY_GETTER, PROPERTY_SETTER, CLASS),
|
||||
ANNOTATION_KEYWORD to EnumSet.of(ANNOTATION_CLASS),
|
||||
CROSSINLINE_KEYWORD to EnumSet.of(VALUE_PARAMETER),
|
||||
|
||||
+3
-3
@@ -58,7 +58,7 @@ fun String.test() {
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun SuperInterface.fun1() {
|
||||
<!WRONG_MODIFIER_TARGET!>suspend<!> fun SuperInterface.fun1() {
|
||||
superFun()
|
||||
superExtFun()
|
||||
with("") {
|
||||
@@ -66,7 +66,7 @@ fun String.test() {
|
||||
superExtFun()
|
||||
}
|
||||
}
|
||||
suspend fun RestrictedController.fun2() {
|
||||
<!WRONG_MODIFIER_TARGET!>suspend<!> fun RestrictedController.fun2() {
|
||||
superFun()
|
||||
superExtFun()
|
||||
memberFun()
|
||||
@@ -78,7 +78,7 @@ fun String.test() {
|
||||
memberExtFun()
|
||||
}
|
||||
}
|
||||
suspend fun SubClass.fun3() {
|
||||
<!WRONG_MODIFIER_TARGET!>suspend<!> fun SubClass.fun3() {
|
||||
superFun()
|
||||
superExtFun()
|
||||
memberFun()
|
||||
|
||||
+3
-3
@@ -76,7 +76,7 @@ fun A.test() {
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun SuperInterface.fun1() {
|
||||
<!WRONG_MODIFIER_TARGET!>suspend<!> fun SuperInterface.fun1() {
|
||||
extAny()
|
||||
memExtAny()
|
||||
extSuper()
|
||||
@@ -88,7 +88,7 @@ fun A.test() {
|
||||
memExtSuper()
|
||||
}
|
||||
}
|
||||
suspend fun RestrictedController.fun2() {
|
||||
<!WRONG_MODIFIER_TARGET!>suspend<!> fun RestrictedController.fun2() {
|
||||
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>extAny<!>()
|
||||
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>memExtAny<!>()
|
||||
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>extSuper<!>()
|
||||
@@ -105,7 +105,7 @@ fun A.test() {
|
||||
memExt()
|
||||
}
|
||||
}
|
||||
suspend fun SubClass.fun3() {
|
||||
<!WRONG_MODIFIER_TARGET!>suspend<!> fun SubClass.fun3() {
|
||||
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>extAny<!>()
|
||||
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>memExtAny<!>()
|
||||
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>extSuper<!>()
|
||||
|
||||
+3
-3
@@ -43,7 +43,7 @@ fun A.test() {
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun SuperInterface.fun1() {
|
||||
<!WRONG_MODIFIER_TARGET!>suspend<!> fun SuperInterface.fun1() {
|
||||
topLevel()
|
||||
member()
|
||||
with(A()) {
|
||||
@@ -51,7 +51,7 @@ fun A.test() {
|
||||
member()
|
||||
}
|
||||
}
|
||||
suspend fun RestrictedController.fun2() {
|
||||
<!WRONG_MODIFIER_TARGET!>suspend<!> fun RestrictedController.fun2() {
|
||||
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>topLevel<!>()
|
||||
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>member<!>()
|
||||
with(A()) {
|
||||
@@ -59,7 +59,7 @@ fun A.test() {
|
||||
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>member<!>()
|
||||
}
|
||||
}
|
||||
suspend fun SubClass.fun3() {
|
||||
<!WRONG_MODIFIER_TARGET!>suspend<!> fun SubClass.fun3() {
|
||||
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>topLevel<!>()
|
||||
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>member<!>()
|
||||
with(A()) {
|
||||
|
||||
@@ -2,16 +2,16 @@ suspend fun baz() = 1
|
||||
suspend fun unit() {}
|
||||
|
||||
suspend fun foo() {
|
||||
suspend fun bar() {
|
||||
<!WRONG_MODIFIER_TARGET!>suspend<!> fun bar() {
|
||||
baz()
|
||||
return unit()
|
||||
}
|
||||
|
||||
suspend fun foobar1(): Int {
|
||||
<!WRONG_MODIFIER_TARGET!>suspend<!> fun foobar1(): Int {
|
||||
return baz()
|
||||
}
|
||||
|
||||
suspend fun foobar2() {
|
||||
<!WRONG_MODIFIER_TARGET!>suspend<!> fun foobar2() {
|
||||
return unit()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user