Add diagnostics tests. Forbid callable reference to coroutineContext

#KT-16908: Fixed
This commit is contained in:
Ilmir Usmanov
2018-06-06 18:54:08 +03:00
parent f94b579d19
commit eea95441c5
107 changed files with 780 additions and 4849 deletions
@@ -0,0 +1,14 @@
// SKIP_TXT
// COMMON_COROUTINES_TEST
import COROUTINES_PACKAGE.coroutineContext
val c = ::<!UNSUPPORTED!>coroutineContext<!>
fun test() {
c()
}
suspend fun test2() {
c()
}
@@ -8,21 +8,21 @@ class A {
suspend fun A.ext() {}
fun test1(a: A) {
val x = ::<!ILLEGAL_SUSPEND_FUNCTION_CALL, UNSUPPORTED!>foo<!>
val x = ::foo
val y1 = a::<!ILLEGAL_SUSPEND_FUNCTION_CALL, UNSUPPORTED!>member<!>
val y2 = A::<!ILLEGAL_SUSPEND_FUNCTION_CALL, UNSUPPORTED!>member<!>
val y1 = a::member
val y2 = A::member
val z1 = a::<!ILLEGAL_SUSPEND_FUNCTION_CALL, UNSUPPORTED!>ext<!>
val z2 = A::<!ILLEGAL_SUSPEND_FUNCTION_CALL, UNSUPPORTED!>ext<!>
val z1 = a::ext
val z2 = A::ext
}
suspend fun test2(a: A) {
val x = ::<!UNSUPPORTED!>foo<!>
val x = ::foo
val y1 = a::<!UNSUPPORTED!>member<!>
val y2 = A::<!UNSUPPORTED!>member<!>
val y1 = a::member
val y2 = A::member
val z1 = a::<!UNSUPPORTED!>ext<!>
val z2 = A::<!UNSUPPORTED!>ext<!>
val z1 = a::ext
val z2 = A::ext
}
@@ -11,7 +11,7 @@ typealias Test4 = <!WRONG_MODIFIER_TARGET!>suspend<!> Action
typealias Test5 = List<suspend () -> Unit>
typealias Test6 = <!WRONG_MODIFIER_TARGET!>suspend<!> List<() -> Unit>
typealias Test7 = <!WRONG_MODIFIER_TARGET!>suspend<!> SAM
typealias Test8 = <!WRONG_MODIFIER_TARGET!>suspend<!> <!UNRESOLVED_REFERENCE!>SuspendFunction0<!><Unit>
typealias Test8 = <!WRONG_MODIFIER_TARGET!>suspend<!> SuspendFunction0<Unit>
typealias Test9 = suspend (() -> Unit) -> Unit
typealias Test10 = suspend (suspend () -> Unit) -> Unit
typealias Test11 = suspend () -> (suspend () -> Unit)
@@ -50,5 +50,5 @@ public typealias Test4 = Action
public typealias Test5 = kotlin.collections.List<suspend () -> kotlin.Unit>
public typealias Test6 = kotlin.collections.List<() -> kotlin.Unit>
public typealias Test7 = SAM
public typealias Test8 = [ERROR : SuspendFunction0<Unit>]<kotlin.Unit>
public typealias Test8 = suspend () -> kotlin.Unit
public typealias Test9 = suspend (() -> kotlin.Unit) -> kotlin.Unit
@@ -0,0 +1,4 @@
// JAVAC_SKIP
typealias Test1 = SuspendFunction0<Unit>
typealias Test2 = kotlin.SuspendFunction0<Unit>
typealias Test3 = kotlin.coroutines.<!UNRESOLVED_REFERENCE!>SuspendFunction0<!><Unit>
@@ -0,0 +1,5 @@
package
public typealias Test1 = suspend () -> kotlin.Unit
public typealias Test2 = suspend () -> kotlin.Unit
public typealias Test3 = [ERROR : kotlin.coroutines.SuspendFunction0<Unit>]<kotlin.Unit>
@@ -1,4 +0,0 @@
// JAVAC_SKIP
typealias Test1 = <!UNRESOLVED_REFERENCE!>SuspendFunction0<!><Unit>
typealias Test2 = kotlin.<!UNRESOLVED_REFERENCE!>SuspendFunction0<!><Unit>
typealias Test3 = kotlin.coroutines.<!UNRESOLVED_REFERENCE!>SuspendFunction0<!><Unit>
@@ -1,5 +0,0 @@
package
public typealias Test1 = [ERROR : SuspendFunction0<Unit>]<kotlin.Unit>
public typealias Test2 = [ERROR : kotlin.SuspendFunction0<Unit>]<kotlin.Unit>
public typealias Test3 = [ERROR : kotlin.coroutines.SuspendFunction0<Unit>]<kotlin.Unit>