Move coroutine-related diagnostic tests to run them with stdlib

It's necessary because all coroutine related declarations (Continuation, etc)
are now in the stdlib
This commit is contained in:
Denis Zharkov
2017-01-26 19:51:49 +03:00
parent 8fa8ba7055
commit 1d5144b168
110 changed files with 381 additions and 381 deletions
@@ -0,0 +1,28 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
suspend fun foo() {}
class A {
suspend fun member() {}
}
suspend fun A.ext() {}
fun test1(a: A) {
val x = ::<!ILLEGAL_SUSPEND_FUNCTION_CALL, UNSUPPORTED!>foo<!>
val y1 = a::<!ILLEGAL_SUSPEND_FUNCTION_CALL, UNSUPPORTED!>member<!>
val y2 = A::<!ILLEGAL_SUSPEND_FUNCTION_CALL, UNSUPPORTED!>member<!>
val z1 = a::<!ILLEGAL_SUSPEND_FUNCTION_CALL, UNSUPPORTED!>ext<!>
val z2 = A::<!ILLEGAL_SUSPEND_FUNCTION_CALL, UNSUPPORTED!>ext<!>
}
suspend fun test2(a: A) {
val x = ::<!UNSUPPORTED!>foo<!>
val y1 = a::<!UNSUPPORTED!>member<!>
val y2 = A::<!UNSUPPORTED!>member<!>
val z1 = a::<!UNSUPPORTED!>ext<!>
val z2 = A::<!UNSUPPORTED!>ext<!>
}
@@ -0,0 +1,14 @@
package
public suspend fun foo(): kotlin.Unit
public fun test1(/*0*/ a: A): kotlin.Unit
public suspend fun test2(/*0*/ a: A): kotlin.Unit
public suspend fun A.ext(): kotlin.Unit
public final class A {
public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final suspend fun member(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,18 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !LANGUAGE: +ErrorOnCoroutines
<!EXPERIMENTAL_FEATURE_ERROR!>suspend<!> fun suspendHere(): String = "OK"
fun builder(c: <!EXPERIMENTAL_FEATURE_ERROR!>suspend<!> () -> Unit) {
}
fun box(): String {
var result = ""
<!EXPERIMENTAL_FEATURE_ERROR!>builder<!> {
suspendHere()
}
return result
}
@@ -0,0 +1,5 @@
package
public fun box(): kotlin.String
public fun builder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit
public suspend fun suspendHere(): kotlin.String
@@ -0,0 +1,18 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !LANGUAGE: +WarnOnCoroutines
<!EXPERIMENTAL_FEATURE_WARNING!>suspend<!> fun suspendHere(): String = "OK"
fun builder(c: <!EXPERIMENTAL_FEATURE_WARNING!>suspend<!> () -> Unit) {
}
fun box(): String {
var result = ""
<!EXPERIMENTAL_FEATURE_WARNING!>builder<!> {
suspendHere()
}
return result
}
@@ -0,0 +1,5 @@
package
public fun box(): kotlin.String
public fun builder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit
public suspend fun suspendHere(): kotlin.String
@@ -0,0 +1,22 @@
import Host.bar
object Host {
suspend fun bar() {}
}
suspend fun foo() {}
fun noSuspend() {
<!ILLEGAL_SUSPEND_FUNCTION_CALL!>foo<!>()
<!ILLEGAL_SUSPEND_FUNCTION_CALL!>bar<!>()
}
class A {
init {
<!ILLEGAL_SUSPEND_FUNCTION_CALL!>foo<!>()
<!ILLEGAL_SUSPEND_FUNCTION_CALL!>bar<!>()
}
}
val x = <!ILLEGAL_SUSPEND_FUNCTION_CALL!>foo<!>()
val y = <!ILLEGAL_SUSPEND_FUNCTION_CALL!>bar<!>()
@@ -0,0 +1,21 @@
package
public val x: kotlin.Unit
public val y: kotlin.Unit
public suspend fun foo(): kotlin.Unit
public fun noSuspend(): kotlin.Unit
public final class A {
public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public object Host {
private constructor Host()
public final suspend fun bar(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,20 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
interface Controller<T> {
suspend fun yield(t: T) {}
fun justString(): String = ""
fun <Z> generidFun(t: Z) = t
}
fun <S> generate(g: suspend Controller<S>.() -> Unit): S = TODO()
val test1 = generate {
yield(justString())
}
val test2 = generate {
yield(generidFun(2))
}
@@ -0,0 +1,14 @@
package
public val test1: kotlin.String
public val test2: kotlin.Int
public fun </*0*/ S> generate(/*0*/ g: suspend Controller<S>.() -> kotlin.Unit): S
public interface Controller</*0*/ T> {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open fun </*0*/ Z> generidFun(/*0*/ t: Z): Z
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open fun justString(): kotlin.String
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public open suspend fun yield(/*0*/ t: T): kotlin.Unit
}
@@ -0,0 +1,21 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
class GenericController<T>
suspend fun <S> GenericController<S>.yieldAll(s: Collection<S>): String = ""
suspend fun <S> GenericController<S>.yieldAll(s: Set<S>): Int = 4
fun <T, R> generate(g: suspend GenericController<T>.() -> R): Pair<T, R> = TODO()
val test1 = generate {
yieldAll(setOf(4))
}
val test2 = generate {
yieldAll(listOf(4))
}
// Util function
fun <X> setOf(vararg x: X): Set<X> = TODO()
fun <X> listOf(vararg x: X): List<X> = TODO()
class Pair<T, S>
@@ -0,0 +1,23 @@
package
public val test1: Pair<kotlin.Int, kotlin.Int>
public val test2: Pair<kotlin.Int, kotlin.String>
public fun </*0*/ T, /*1*/ R> generate(/*0*/ g: suspend GenericController<T>.() -> R): Pair<T, R>
public fun </*0*/ X> listOf(/*0*/ vararg x: X /*kotlin.Array<out X>*/): kotlin.collections.List<X>
public fun </*0*/ X> setOf(/*0*/ vararg x: X /*kotlin.Array<out X>*/): kotlin.collections.Set<X>
public suspend fun </*0*/ S> GenericController<S>.yieldAll(/*0*/ s: kotlin.collections.Collection<S>): kotlin.String
public suspend fun </*0*/ S> GenericController<S>.yieldAll(/*0*/ s: kotlin.collections.Set<S>): kotlin.Int
public final class GenericController</*0*/ T> {
public constructor GenericController</*0*/ T>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Pair</*0*/ T, /*1*/ S> {
public constructor Pair</*0*/ T, /*1*/ S>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,37 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
class GenericController<T> {
suspend fun yield(t: T) {}
}
suspend fun <S> GenericController<S>.yieldAll(s: Collection<S>) {}
fun <S> generate(g: suspend GenericController<S>.() -> Unit): S = TODO()
val test1 = generate {
yield(4)
yieldAll(setOf(4, 5))
}
val test2 = generate {
yieldAll(setOf(B))
}
val test3 = generate {
yieldAll(setOf(B, C))
}
val test4 = generate {
yieldAll(setOf(B))
yield(C)
}
// Utils
fun <X> setOf(vararg x: X): Set<X> = TODO()
interface A
object B : A
object C : A
@@ -0,0 +1,37 @@
package
public val test1: kotlin.Int
public val test2: B
public val test3: A
public val test4: A
public fun </*0*/ S> generate(/*0*/ g: suspend GenericController<S>.() -> kotlin.Unit): S
public fun </*0*/ X> setOf(/*0*/ vararg x: X /*kotlin.Array<out X>*/): kotlin.collections.Set<X>
public suspend fun </*0*/ S> GenericController<S>.yieldAll(/*0*/ s: kotlin.collections.Collection<S>): kotlin.Unit
public interface A {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public object B : A {
private constructor B()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public object C : A {
private constructor C()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class GenericController</*0*/ T> {
public constructor GenericController</*0*/ T>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final suspend fun yield(/*0*/ t: T): kotlin.Unit
}
@@ -0,0 +1,30 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
class GenericController<T> {
suspend fun yield(t: T) {}
fun notYield(t: T) {}
suspend fun yieldBarReturnType(t: T) = t
fun barReturnType(): T = TODO()
}
fun <S> generate(g: suspend GenericController<S>.() -> Unit): List<S> = TODO()
val test1 = generate {
yield(3)
}
val test2 = <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>generate<!> {
yield(3)
notYield(3)
}
val test3 = <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>generate<!> {
yield(3)
yieldBarReturnType(3)
}
val test4 = <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>generate<!> {
yield(3)
barReturnType()
}
@@ -0,0 +1,27 @@
package
public val test1: kotlin.collections.List<kotlin.Int>
public val test2: [ERROR : Type for generate {
yield(3)
notYield(3)
}]
public val test3: [ERROR : Type for generate {
yield(3)
yieldBarReturnType(3)
}]
public val test4: [ERROR : Type for generate {
yield(3)
barReturnType()
}]
public fun </*0*/ S> generate(/*0*/ g: suspend GenericController<S>.() -> kotlin.Unit): kotlin.collections.List<S>
public final class GenericController</*0*/ T> {
public constructor GenericController</*0*/ T>()
public final fun barReturnType(): T
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final fun notYield(/*0*/ t: T): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final suspend fun yield(/*0*/ t: T): kotlin.Unit
public final suspend fun yieldBarReturnType(/*0*/ t: T): T
}
@@ -0,0 +1,17 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
class GenericController<T> {
suspend fun yield(t: T) {}
}
fun <S> generate(g: suspend GenericController<S>.() -> Unit): List<S> = TODO()
val test1 = generate {
yield(generate {
yield(generate {
yield(generate {
yield(3)
})
})
})
}
@@ -0,0 +1,12 @@
package
public val test1: kotlin.collections.List<kotlin.collections.List<kotlin.collections.List<kotlin.collections.List<kotlin.Int>>>>
public fun </*0*/ S> generate(/*0*/ g: suspend GenericController<S>.() -> kotlin.Unit): kotlin.collections.List<S>
public final class GenericController</*0*/ T> {
public constructor GenericController</*0*/ T>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final suspend fun yield(/*0*/ t: T): kotlin.Unit
}
@@ -0,0 +1,16 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
class GenericController<T> {
suspend fun yield(t: T) {}
}
fun <S> generate(g: suspend GenericController<S>.() -> Unit): List<S> = TODO()
suspend fun <S> GenericController<List<S>>.yieldGenerate(g: suspend GenericController<S>.() -> Unit): Unit = TODO()
val test1 = generate {
// TODO: KT-15185
<!TYPE_MISMATCH, TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR!>yieldGenerate<!> {
yield(4)
}
}
@@ -0,0 +1,13 @@
package
public val test1: kotlin.collections.List<kotlin.Int>
public fun </*0*/ S> generate(/*0*/ g: suspend GenericController<S>.() -> kotlin.Unit): kotlin.collections.List<S>
public suspend fun </*0*/ S> GenericController<kotlin.collections.List<S>>.yieldGenerate(/*0*/ g: suspend GenericController<S>.() -> kotlin.Unit): kotlin.Unit
public final class GenericController</*0*/ T> {
public constructor GenericController</*0*/ T>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final suspend fun yield(/*0*/ t: T): kotlin.Unit
}
@@ -0,0 +1,9 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
class Controller
fun <R> generate(g: suspend Controller.() -> R): R = TODO()
val test1 = generate {
3
}
@@ -0,0 +1,11 @@
package
public val test1: kotlin.Int
public fun </*0*/ R> generate(/*0*/ g: suspend Controller.() -> R): R
public final class Controller {
public constructor Controller()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,14 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
class Controller<T> {
suspend fun yield(t: T) {}
}
fun <T, R> generate(g: suspend Controller<T>.() -> R): Pair<T, R> = TODO()
val test1 = generate {
yield("")
3
}
class Pair<T, R>
@@ -0,0 +1,19 @@
package
public val test1: Pair<kotlin.String, kotlin.Int>
public fun </*0*/ T, /*1*/ R> generate(/*0*/ g: suspend Controller<T>.() -> R): Pair<T, R>
public final class Controller</*0*/ T> {
public constructor Controller</*0*/ T>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final suspend fun yield(/*0*/ t: T): kotlin.Unit
}
public final class Pair</*0*/ T, /*1*/ R> {
public constructor Pair</*0*/ T, /*1*/ R>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,29 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
class GenericController<T> {
suspend fun yield(t: T) {}
suspend fun yieldSet(t: Set<T>) {}
suspend fun yieldVararg(vararg t: T) {}
}
fun <S> generate(g: suspend GenericController<S>.() -> Unit): S = TODO()
val test1 = generate {
yield(4)
}
val test2 = generate {
yieldSet(setOf(1, 2, 3))
}
val test3 = generate {
yieldVararg(1, 2, 3)
}
val test4 = generate {
yieldVararg(1, 2, "")
}
// Util function
fun <X> setOf(vararg x: X): Set<X> = TODO()
@@ -0,0 +1,18 @@
package
public val test1: kotlin.Int
public val test2: kotlin.Int
public val test3: kotlin.Int
public val test4: kotlin.Any
public fun </*0*/ S> generate(/*0*/ g: suspend GenericController<S>.() -> kotlin.Unit): S
public fun </*0*/ X> setOf(/*0*/ vararg x: X /*kotlin.Array<out X>*/): kotlin.collections.Set<X>
public final class GenericController</*0*/ T> {
public constructor GenericController</*0*/ T>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final suspend fun yield(/*0*/ t: T): kotlin.Unit
public final suspend fun yieldSet(/*0*/ t: kotlin.collections.Set<T>): kotlin.Unit
public final suspend fun yieldVararg(/*0*/ vararg t: T /*kotlin.Array<out T>*/): kotlin.Unit
}
@@ -0,0 +1,11 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
class GenericController<T>
fun <S> generate(g: suspend GenericController<S>.() -> Unit): List<S> = TODO()
suspend fun GenericController<List<String>>.test() {}
val test1 = generate {
test()
}
@@ -0,0 +1,12 @@
package
public val test1: kotlin.collections.List<kotlin.collections.List<kotlin.String>>
public fun </*0*/ S> generate(/*0*/ g: suspend GenericController<S>.() -> kotlin.Unit): kotlin.collections.List<S>
public suspend fun GenericController<kotlin.collections.List<kotlin.String>>.test(): kotlin.Unit
public final class GenericController</*0*/ T> {
public constructor GenericController</*0*/ T>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,16 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
class GenericController<T> {
suspend fun yield(t: T) {}
}
fun <S, P1, P2, R> generate(p1: P1, p2: List<P2>, g: suspend GenericController<S>.(P1, P2) -> R): Four<S, P1, P2, R> = TODO()
val test1 = generate(1, listOf("")) { p1, p2 ->
yield(p1)
p2
}
fun <X> listOf(vararg x: X): List<X> = TODO()
class Four<X, Y, Z, T>
@@ -0,0 +1,20 @@
package
public val test1: Four<kotlin.Int, kotlin.Int, kotlin.String, kotlin.String>
public fun </*0*/ S, /*1*/ P1, /*2*/ P2, /*3*/ R> generate(/*0*/ p1: P1, /*1*/ p2: kotlin.collections.List<P2>, /*2*/ g: suspend GenericController<S>.(P1, P2) -> R): Four<S, P1, P2, R>
public fun </*0*/ X> listOf(/*0*/ vararg x: X /*kotlin.Array<out X>*/): kotlin.collections.List<X>
public final class Four</*0*/ X, /*1*/ Y, /*2*/ Z, /*3*/ T> {
public constructor Four</*0*/ X, /*1*/ Y, /*2*/ Z, /*3*/ T>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class GenericController</*0*/ T> {
public constructor GenericController</*0*/ T>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final suspend fun yield(/*0*/ t: T): kotlin.Unit
}
@@ -0,0 +1,19 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
class GenericController<T> {
suspend fun yield(t: T) {}
}
fun <S> generate(g: suspend GenericController<S>.(S) -> Unit): S = TODO()
val test1 = <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>generate<!> {
yield(4)
}
val test2 = generate<Int> {
yield(4)
}
val test3 = generate { bar: Int ->
yield(4)
}
@@ -0,0 +1,16 @@
package
public val test1: [ERROR : Type for generate {
yield(4)
}]
public val test2: kotlin.Int
public val test3: kotlin.Int
public fun </*0*/ S> generate(/*0*/ g: suspend GenericController<S>.(S) -> kotlin.Unit): S
public final class GenericController</*0*/ T> {
public constructor GenericController</*0*/ T>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final suspend fun yield(/*0*/ t: T): kotlin.Unit
}
@@ -0,0 +1,23 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !CHECK_TYPE
class Controller {
suspend fun suspendHere(a: String) = 1
}
class A {
suspend fun suspendHere(a: Int) = 1
}
fun builder(c: suspend Controller.() -> Unit) {}
fun test() {
builder {
suspendHere("")
with(A()) {
suspendHere("")
// With the new convention calling a suspension member with receiver different from the one obtained from the coroutine is OK
suspendHere(1)
}
}
}
@@ -0,0 +1,20 @@
package
public fun builder(/*0*/ c: suspend Controller.() -> kotlin.Unit): kotlin.Unit
public fun test(): kotlin.Unit
public final class A {
public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final suspend fun suspendHere(/*0*/ a: kotlin.Int): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Controller {
public constructor Controller()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final suspend fun suspendHere(/*0*/ a: kotlin.String): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,51 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_PARAMETER -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_VARIABLE
fun builder(c: suspend () -> Int) = 1
fun <T> genericBuilder(c: suspend () -> T): T = null!!
fun unitBuilder(c: suspend () -> Unit) = 1
fun emptyBuilder(c: suspend () -> Unit) = 1
fun <T> manyArgumentsBuilder(
c1: suspend () -> Unit,
c2: suspend () -> T,
c3: suspend () -> Int
):T = null!!
fun severalParamsInLambda(c: suspend (String, Int) -> Unit) {}
fun foo() {
builder({ 1 })
builder { 1 }
val x = { 1 }
builder(<!TYPE_MISMATCH!>x<!>)
builder(<!UNCHECKED_CAST!>{1} as (suspend () -> Int)<!>)
var i: Int = 1
i = genericBuilder({ 1 })
i = genericBuilder { 1 }
genericBuilder { 1 }
genericBuilder<Int> { 1 }
genericBuilder<Int> { <!TYPE_MISMATCH!>""<!> }
val y = { 1 }
<!TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR!>genericBuilder<!>(<!TYPE_MISMATCH!>y<!>)
unitBuilder {}
unitBuilder { <!UNUSED_EXPRESSION!>1<!> }
unitBuilder({})
unitBuilder({ <!UNUSED_EXPRESSION!>1<!> })
manyArgumentsBuilder({}, { "" }) { 1 }
val s: String = manyArgumentsBuilder({}, { "" }) { 1 }
manyArgumentsBuilder<String>({}, { "" }, { 1 })
manyArgumentsBuilder<String>({}, { <!CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!> }, { 2 })
severalParamsInLambda { x, y ->
x checkType { _<String>() }
y checkType { _<Int>() }
}
}
@@ -0,0 +1,9 @@
package
public fun builder(/*0*/ c: suspend () -> kotlin.Int): kotlin.Int
public fun emptyBuilder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Int
public fun foo(): kotlin.Unit
public fun </*0*/ T> genericBuilder(/*0*/ c: suspend () -> T): T
public fun </*0*/ T> manyArgumentsBuilder(/*0*/ c1: suspend () -> kotlin.Unit, /*1*/ c2: suspend () -> T, /*2*/ c3: suspend () -> kotlin.Int): T
public fun severalParamsInLambda(/*0*/ c: suspend (kotlin.String, kotlin.Int) -> kotlin.Unit): kotlin.Unit
public fun unitBuilder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Int
@@ -0,0 +1,6 @@
interface AsyncVal { suspend fun getVal(): Int = 1}
interface SyncVal { fun getVal(): Int = 1 }
<!CONFLICTING_INHERITED_MEMBERS!>class MixSuspend<!> : AsyncVal, SyncVal {
}
@@ -0,0 +1,23 @@
package
public interface AsyncVal {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open suspend fun getVal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class MixSuspend : AsyncVal, SyncVal {
public constructor MixSuspend()
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open suspend override /*1*/ /*fake_override*/ fun getVal(): kotlin.Int
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface SyncVal {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open fun getVal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,8 @@
// FILE: 1.kt
fun test(<!UNUSED_PARAMETER!>c<!>: <!UNRESOLVED_REFERENCE!>Continuation<!><Unit>) {}
// FILE: 2.kt
import kotlin.coroutines.experimental.*
fun test2(<!UNUSED_PARAMETER!>c<!>: Continuation<Unit>) {}
@@ -0,0 +1,4 @@
package
public fun test(/*0*/ c: [ERROR : Continuation<Unit>]<kotlin.Unit>): kotlin.Unit
public fun test2(/*0*/ c: kotlin.coroutines.experimental.Continuation<kotlin.Unit>): kotlin.Unit
@@ -0,0 +1,81 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
import Host.suspendFromObject
suspend fun suspendHere() = 1
suspend fun <T> another(a: T) = 1
object Host {
suspend fun suspendFromObject() = 1
}
fun <T> builder(c: suspend () -> Unit) { }
inline fun run(x: () -> Unit) {}
inline fun runCross(crossinline x: () -> Unit) {}
fun noinline(x: () -> Unit) {}
fun foo() {
var result = 1
builder<String> {
suspendHere()
suspendFromObject()
another("")
another(1)
result += suspendHere()
result += suspendFromObject()
run {
result += suspendHere()
result += suspendFromObject()
run {
suspendHere()
suspendFromObject()
}
}
runCross {
result += <!NON_LOCAL_SUSPENSION_POINT!>suspendHere<!>()
result += <!NON_LOCAL_SUSPENSION_POINT!>suspendFromObject<!>()
runCross {
<!NON_LOCAL_SUSPENSION_POINT!>suspendHere<!>()
<!NON_LOCAL_SUSPENSION_POINT!>suspendFromObject<!>()
}
}
noinline {
result += <!NON_LOCAL_SUSPENSION_POINT!>suspendHere<!>()
result += <!NON_LOCAL_SUSPENSION_POINT!>suspendFromObject<!>()
noinline {
<!NON_LOCAL_SUSPENSION_POINT!>suspendHere<!>()
<!NON_LOCAL_SUSPENSION_POINT!>suspendFromObject<!>()
}
}
class A {
fun bar() {
<!NON_LOCAL_SUSPENSION_POINT!>suspendHere<!>()
<!NON_LOCAL_SUSPENSION_POINT!>suspendFromObject<!>()
}
}
object : Any() {
fun baz() {
<!NON_LOCAL_SUSPENSION_POINT!>suspendHere<!>()
<!NON_LOCAL_SUSPENSION_POINT!>suspendFromObject<!>()
}
}
builder<Int> {
suspendHere()
suspendFromObject()
another(1)
another("")
}
}
}
@@ -0,0 +1,17 @@
package
public suspend fun </*0*/ T> another(/*0*/ a: T): kotlin.Int
public fun </*0*/ T> builder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit
public fun foo(): kotlin.Unit
public fun noinline(/*0*/ x: () -> kotlin.Unit): kotlin.Unit
public inline fun run(/*0*/ x: () -> kotlin.Unit): kotlin.Unit
public inline fun runCross(/*0*/ crossinline x: () -> kotlin.Unit): kotlin.Unit
public suspend fun suspendHere(): kotlin.Int
public object Host {
private constructor Host()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final suspend fun suspendFromObject(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,99 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE
interface SuperInterface {
suspend fun superFun() {}
suspend fun String.superExtFun() {}
}
@kotlin.coroutines.experimental.RestrictsSuspension
open class RestrictedController : SuperInterface {
suspend fun memberFun() {}
suspend fun String.memberExtFun() {}
}
class SubClass : RestrictedController() {
suspend fun subFun() {}
suspend fun String.subExtFun() {}
}
fun generate1(f: suspend SuperInterface.() -> Unit) {}
fun generate2(f: suspend RestrictedController.() -> Unit) {}
fun generate3(f: suspend SubClass.() -> Unit) {}
fun String.test() {
generate1 {
superFun()
superExtFun()
with("") {
superFun()
superExtFun()
}
}
generate2 {
superFun()
superExtFun()
memberFun()
memberExtFun()
with("") {
superFun()
superExtFun()
memberFun()
memberExtFun()
}
}
generate3 {
superFun()
superExtFun()
memberFun()
memberExtFun()
subFun()
superExtFun()
with("") {
superFun()
superExtFun()
memberFun()
memberExtFun()
subFun()
superExtFun()
}
}
<!WRONG_MODIFIER_TARGET!>suspend<!> fun SuperInterface.fun1() {
superFun()
superExtFun()
with("") {
superFun()
superExtFun()
}
}
<!WRONG_MODIFIER_TARGET!>suspend<!> fun RestrictedController.fun2() {
superFun()
superExtFun()
memberFun()
memberExtFun()
with("") {
superFun()
superExtFun()
memberFun()
memberExtFun()
}
}
<!WRONG_MODIFIER_TARGET!>suspend<!> fun SubClass.fun3() {
superFun()
superExtFun()
memberFun()
memberExtFun()
subFun()
superExtFun()
with("") {
superFun()
superExtFun()
memberFun()
memberExtFun()
subFun()
superExtFun()
}
}
}
@@ -0,0 +1,38 @@
package
public fun generate1(/*0*/ f: suspend SuperInterface.() -> kotlin.Unit): kotlin.Unit
public fun generate2(/*0*/ f: suspend RestrictedController.() -> kotlin.Unit): kotlin.Unit
public fun generate3(/*0*/ f: suspend SubClass.() -> kotlin.Unit): kotlin.Unit
public fun kotlin.String.test(): kotlin.Unit
@kotlin.coroutines.experimental.RestrictsSuspension public open class RestrictedController : SuperInterface {
public constructor RestrictedController()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final suspend fun memberFun(): kotlin.Unit
public open suspend override /*1*/ /*fake_override*/ fun superFun(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final suspend fun kotlin.String.memberExtFun(): kotlin.Unit
public open suspend override /*1*/ /*fake_override*/ fun kotlin.String.superExtFun(): kotlin.Unit
}
public final class SubClass : RestrictedController {
public constructor SubClass()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final suspend override /*1*/ /*fake_override*/ fun memberFun(): kotlin.Unit
public final suspend fun subFun(): kotlin.Unit
public open suspend override /*1*/ /*fake_override*/ fun superFun(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final suspend override /*1*/ /*fake_override*/ fun kotlin.String.memberExtFun(): kotlin.Unit
public final suspend fun kotlin.String.subExtFun(): kotlin.Unit
public open suspend override /*1*/ /*fake_override*/ fun kotlin.String.superExtFun(): kotlin.Unit
}
public interface SuperInterface {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open suspend fun superFun(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public open suspend fun kotlin.String.superExtFun(): kotlin.Unit
}
@@ -0,0 +1,129 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE
interface SuperInterface
@kotlin.coroutines.experimental.RestrictsSuspension
open class RestrictedController : SuperInterface
class SubClass : RestrictedController()
suspend fun Any?.extAny() {}
suspend fun SuperInterface.extSuper() {}
suspend fun RestrictedController.ext() {}
suspend fun SubClass.extSub() {}
class A {
suspend fun Any?.memExtAny() {}
suspend fun SuperInterface.memExtSuper() {}
suspend fun RestrictedController.memExt() {}
suspend fun SubClass.memExtSub() {}
}
fun generate1(f: suspend SuperInterface.() -> Unit) {}
fun generate2(f: suspend RestrictedController.() -> Unit) {}
fun generate3(f: suspend SubClass.() -> Unit) {}
fun A.test() {
generate1 {
extAny()
memExtAny()
extSuper()
memExtSuper()
with(A()) {
extAny()
memExtAny()
extSuper()
memExtSuper()
}
}
generate2 {
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>extAny<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>memExtAny<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>extSuper<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>memExtSuper<!>()
ext()
memExt()
with(A()) {
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>extAny<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>memExtAny<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>extSuper<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>memExtSuper<!>()
ext()
memExt()
}
}
generate3 {
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>extAny<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>memExtAny<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>extSuper<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>memExtSuper<!>()
ext()
memExt()
extSub()
memExtSub()
with(A()) {
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>extAny<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>memExtAny<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>extSuper<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>memExtSuper<!>()
ext()
memExt()
extSub()
memExtSub()
}
}
<!WRONG_MODIFIER_TARGET!>suspend<!> fun SuperInterface.fun1() {
extAny()
memExtAny()
extSuper()
memExtSuper()
with(A()) {
extAny()
memExtAny()
extSuper()
memExtSuper()
}
}
<!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<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>memExtSuper<!>()
ext()
memExt()
with(A()) {
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>extAny<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>memExtAny<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>extSuper<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>memExtSuper<!>()
ext()
memExt()
}
}
<!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<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>memExtSuper<!>()
ext()
memExt()
extSub()
memExtSub()
with(A()) {
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>extAny<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>memExtAny<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>extSuper<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>memExtSuper<!>()
ext()
memExt()
extSub()
memExtSub()
}
}
}
@@ -0,0 +1,41 @@
package
public fun generate1(/*0*/ f: suspend SuperInterface.() -> kotlin.Unit): kotlin.Unit
public fun generate2(/*0*/ f: suspend RestrictedController.() -> kotlin.Unit): kotlin.Unit
public fun generate3(/*0*/ f: suspend SubClass.() -> kotlin.Unit): kotlin.Unit
public suspend fun RestrictedController.ext(): kotlin.Unit
public suspend fun kotlin.Any?.extAny(): kotlin.Unit
public suspend fun SubClass.extSub(): kotlin.Unit
public suspend fun SuperInterface.extSuper(): kotlin.Unit
public fun A.test(): kotlin.Unit
public final class A {
public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final suspend fun RestrictedController.memExt(): kotlin.Unit
public final suspend fun kotlin.Any?.memExtAny(): kotlin.Unit
public final suspend fun SubClass.memExtSub(): kotlin.Unit
public final suspend fun SuperInterface.memExtSuper(): kotlin.Unit
}
@kotlin.coroutines.experimental.RestrictsSuspension public open class RestrictedController : SuperInterface {
public constructor RestrictedController()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class SubClass : RestrictedController {
public constructor SubClass()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface SuperInterface {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,72 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE
interface SuperInterface
@kotlin.coroutines.experimental.RestrictsSuspension
open class RestrictedController : SuperInterface
class SubClass : RestrictedController()
suspend fun topLevel() {}
class A {
suspend fun member() {}
}
fun generate1(f: suspend SuperInterface.() -> Unit) {}
fun generate2(f: suspend RestrictedController.() -> Unit) {}
fun generate3(f: suspend SubClass.() -> Unit) {}
fun A.test() {
generate1 {
topLevel()
member()
with(A()) {
topLevel()
member()
}
}
generate2 {
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>topLevel<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>member<!>()
with(A()) {
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>topLevel<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>member<!>()
}
}
generate3 {
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>topLevel<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>member<!>()
with(A()) {
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>topLevel<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>member<!>()
}
}
<!WRONG_MODIFIER_TARGET!>suspend<!> fun SuperInterface.fun1() {
topLevel()
member()
with(A()) {
topLevel()
member()
}
}
<!WRONG_MODIFIER_TARGET!>suspend<!> fun RestrictedController.fun2() {
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>topLevel<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>member<!>()
with(A()) {
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>topLevel<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>member<!>()
}
}
<!WRONG_MODIFIER_TARGET!>suspend<!> fun SubClass.fun3() {
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>topLevel<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>member<!>()
with(A()) {
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>topLevel<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>member<!>()
}
}
}
@@ -0,0 +1,35 @@
package
public fun generate1(/*0*/ f: suspend SuperInterface.() -> kotlin.Unit): kotlin.Unit
public fun generate2(/*0*/ f: suspend RestrictedController.() -> kotlin.Unit): kotlin.Unit
public fun generate3(/*0*/ f: suspend SubClass.() -> kotlin.Unit): kotlin.Unit
public suspend fun topLevel(): kotlin.Unit
public fun A.test(): kotlin.Unit
public final class A {
public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final suspend fun member(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@kotlin.coroutines.experimental.RestrictsSuspension public open class RestrictedController : SuperInterface {
public constructor RestrictedController()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class SubClass : RestrictedController {
public constructor SubClass()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface SuperInterface {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,53 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE
@kotlin.coroutines.experimental.RestrictsSuspension
class RestrictedController {
suspend fun member() {}
}
suspend fun RestrictedController.extension() {}
fun generate(f: suspend RestrictedController.() -> Unit) {}
fun test() {
generate() l@ {
member()
extension()
this.member()
this.extension()
val foo = this
foo.<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>member<!>()
foo.<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>extension<!>()
this@l.member()
this@l.extension()
with(1) {
this@l.member()
this@l.extension()
}
}
}
suspend fun RestrictedController.l() {
member()
extension()
this.member()
this.extension()
val foo = this
foo.<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>member<!>()
foo.<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>extension<!>()
this@l.member()
this@l.extension()
with(1) {
this@l.member()
this@l.extension()
}
}
@@ -0,0 +1,14 @@
package
public fun generate(/*0*/ f: suspend RestrictedController.() -> kotlin.Unit): kotlin.Unit
public fun test(): kotlin.Unit
public suspend fun RestrictedController.extension(): kotlin.Unit
public suspend fun RestrictedController.l(): kotlin.Unit
@kotlin.coroutines.experimental.RestrictsSuspension public final class RestrictedController {
public constructor RestrictedController()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final suspend fun member(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,14 @@
@kotlin.coroutines.experimental.RestrictsSuspension
class RestrictedController
suspend fun Any?.extFun() {}
suspend fun suspendFun() {}
fun generate(<!UNUSED_PARAMETER!>c<!>: suspend RestrictedController.() -> Unit) {}
fun test() {
generate {
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>extFun<!>()
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>suspendFun<!>()
}
}
@@ -0,0 +1,13 @@
package
public fun generate(/*0*/ c: suspend RestrictedController.() -> kotlin.Unit): kotlin.Unit
public suspend fun suspendFun(): kotlin.Unit
public fun test(): kotlin.Unit
public suspend fun kotlin.Any?.extFun(): kotlin.Unit
@kotlin.coroutines.experimental.RestrictsSuspension public final class RestrictedController {
public constructor RestrictedController()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,27 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -NOTHING_TO_INLINE
import kotlin.coroutines.experimental.*
suspend fun notMember(q: Double) = 1
suspend fun String.wrongExtension(x: Any) = 1
suspend fun Controller.controllerReceiver() = 1
class Controller {
// is still valid
suspend fun oldConvention(x: Continuation<Int>) {
}
suspend fun noParameters() {
}
suspend fun oneParameter(q: Any) {}
suspend fun varargParameter(vararg q: Any) {}
suspend fun returnsString(q: Any) = ""
inline suspend fun inlineFun(x: Int) {}
suspend fun String.memberExtension() = 1
}
@@ -0,0 +1,19 @@
package
public suspend fun notMember(/*0*/ q: kotlin.Double): kotlin.Int
public suspend fun Controller.controllerReceiver(): kotlin.Int
public suspend fun kotlin.String.wrongExtension(/*0*/ x: kotlin.Any): kotlin.Int
public final class Controller {
public constructor Controller()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final inline suspend fun inlineFun(/*0*/ x: kotlin.Int): kotlin.Unit
public final suspend fun noParameters(): kotlin.Unit
public final suspend fun oldConvention(/*0*/ x: kotlin.coroutines.experimental.Continuation<kotlin.Int>): kotlin.Unit
public final suspend fun oneParameter(/*0*/ q: kotlin.Any): kotlin.Unit
public final suspend fun returnsString(/*0*/ q: kotlin.Any): kotlin.String
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final suspend fun varargParameter(/*0*/ vararg q: kotlin.Any /*kotlin.Array<out kotlin.Any>*/): kotlin.Unit
public final suspend fun kotlin.String.memberExtension(): kotlin.Int
}
@@ -0,0 +1,15 @@
// FILE: main.kt
interface A {
<!CONFLICTING_OVERLOADS!>suspend fun foo()<!>
<!CONFLICTING_OVERLOADS!>fun foo()<!>
}
interface B : A {
<!CONFLICTING_OVERLOADS, CONFLICTING_OVERLOADS!>suspend override fun foo()<!> {
}
<!CONFLICTING_OVERLOADS, CONFLICTING_OVERLOADS!>override fun foo()<!> {
}
}
@@ -0,0 +1,17 @@
package
public interface A {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public abstract fun foo(): kotlin.Unit
public abstract suspend fun foo(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface B : A {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ fun foo(): kotlin.Unit
public open suspend override /*1*/ fun foo(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,34 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !CHECK_TYPE
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.*
class Controller {
suspend fun noParams(): Unit = suspendCoroutineOrReturn {
if (hashCode() % 2 == 0) {
it.resume(Unit)
SUSPENDED_MARKER
}
else {
Unit
}
}
suspend fun yieldString(value: String) = suspendCoroutineOrReturn<Int> {
it.resume(1)
it checkType { _<Continuation<Int>>() }
it.resume(<!TYPE_MISMATCH!>""<!>)
// We can return anything here, 'suspendCoroutineOrReturn' is not very type-safe
// Also we can call resume and then return the value too, but it's still just our problem
"Not-int"
}
}
fun builder(c: suspend Controller.() -> Unit) {}
fun test() {
builder {
noParams() checkType { _<Unit>() }
yieldString("abc") checkType { _<Int>() }
}
}
@@ -0,0 +1,13 @@
package
public fun builder(/*0*/ c: suspend Controller.() -> kotlin.Unit): kotlin.Unit
public fun test(): kotlin.Unit
public final class Controller {
public constructor Controller()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final suspend fun noParams(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final suspend fun yieldString(/*0*/ value: kotlin.String): kotlin.Int
}
@@ -0,0 +1,47 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !CHECK_TYPE
suspend fun noParams() {
}
suspend fun yieldString(value: String) {}
suspend fun <V> await(f: () -> V) = f()
suspend fun <V> await(f: Int): V = null!!
suspend fun severalParams(x: String, y: Int) = 1.0
suspend fun String.stringReceiver(y: Int) = 1.0
suspend fun Any.anyReceiver(y: Int) = 1.0
fun builder(c: suspend () -> Unit) {}
fun test() {
builder {
noParams()
yieldString("abc") checkType { _<Unit>() }
yieldString(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>) checkType { _<Unit>() }
await<String> { "123" } checkType { _<String>() }
// Inference from lambda return type
await { 123 } checkType { _<Int>() }
// Inference from expected type
checkSubtype<String>(await(567))
await<Double>(123) checkType { _<Double>() }
severalParams("", 89) checkType { _<Double>() }
// TODO: should we allow somehow to call with passing continuation explicitly?
severalParams("", 89, <!TOO_MANY_ARGUMENTS!>6.9<!>) checkType { <!TYPE_MISMATCH!>_<!><Unit>() }
"".stringReceiver(1)
Any().anyReceiver(1)
with("") {
stringReceiver(2)
}
}
}
@@ -0,0 +1,11 @@
package
public suspend fun </*0*/ V> await(/*0*/ f: () -> V): V
public suspend fun </*0*/ V> await(/*0*/ f: kotlin.Int): V
public fun builder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit
public suspend fun noParams(): kotlin.Unit
public suspend fun severalParams(/*0*/ x: kotlin.String, /*1*/ y: kotlin.Int): kotlin.Double
public fun test(): kotlin.Unit
public suspend fun yieldString(/*0*/ value: kotlin.String): kotlin.Unit
public suspend fun kotlin.Any.anyReceiver(/*0*/ y: kotlin.Int): kotlin.Double
public suspend fun kotlin.String.stringReceiver(/*0*/ y: kotlin.Int): kotlin.Double
@@ -0,0 +1,18 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun useSuspendFn(sfn: suspend () -> Unit) = sfn
fun useFn(fn: () -> Unit) = fn
fun ambiguous(sfn: suspend () -> Unit) = sfn
fun ambiguous(fn: () -> Unit) = fn
fun test1(sfn: suspend () -> Unit) = useFn(<!TYPE_MISMATCH!>sfn<!>)
fun test2(fn: () -> Unit) = useSuspendFn(<!TYPE_MISMATCH!>fn<!>)
fun test3(sfn: suspend () -> Unit) = useSuspendFn(sfn)
fun test4(): suspend () -> Unit = useSuspendFn {}
fun test5() = useSuspendFn {}
fun test5(sfn: suspend () -> Unit) = ambiguous(sfn)
fun test6(fn: () -> Unit) = ambiguous(fn)
fun test7(): () -> Unit = <!OVERLOAD_RESOLUTION_AMBIGUITY!>ambiguous<!> {}
@@ -0,0 +1,14 @@
package
public fun ambiguous(/*0*/ fn: () -> kotlin.Unit): () -> kotlin.Unit
public fun ambiguous(/*0*/ sfn: suspend () -> kotlin.Unit): suspend () -> kotlin.Unit
public fun test1(/*0*/ sfn: suspend () -> kotlin.Unit): () -> kotlin.Unit
public fun test2(/*0*/ fn: () -> kotlin.Unit): suspend () -> kotlin.Unit
public fun test3(/*0*/ sfn: suspend () -> kotlin.Unit): suspend () -> kotlin.Unit
public fun test4(): suspend () -> kotlin.Unit
public fun test5(): suspend () -> kotlin.Unit
public fun test5(/*0*/ sfn: suspend () -> kotlin.Unit): suspend () -> kotlin.Unit
public fun test6(/*0*/ fn: () -> kotlin.Unit): () -> kotlin.Unit
public fun test7(): () -> kotlin.Unit
public fun useFn(/*0*/ fn: () -> kotlin.Unit): () -> kotlin.Unit
public fun useSuspendFn(/*0*/ sfn: suspend () -> kotlin.Unit): suspend () -> kotlin.Unit
@@ -0,0 +1,7 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun <T> withS(x: T, sfn: suspend (T) -> Unit) = x
val test1 = withS(100) {}
fun <TT> test2(x: TT) = withS(x) {}
@@ -0,0 +1,5 @@
package
public val test1: kotlin.Int
public fun </*0*/ TT> test2(/*0*/ x: TT): TT
public fun </*0*/ T> withS(/*0*/ x: T, /*1*/ sfn: suspend (T) -> kotlin.Unit): T
@@ -0,0 +1,5 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun <T1, T2> withS2(x: T1, sfn1: suspend (T1) -> T2, sfn2: suspend (T2) -> Unit): T2 = null!!
val test1 = withS2(100, { it.toLong().toString() }, { it.length })
@@ -0,0 +1,4 @@
package
public val test1: kotlin.String
public fun </*0*/ T1, /*1*/ T2> withS2(/*0*/ x: T1, /*1*/ sfn1: suspend (T1) -> T2, /*2*/ sfn2: suspend (T2) -> kotlin.Unit): T2
@@ -0,0 +1,7 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun <T> withS(x: T, sfn: suspend T.() -> Unit) = x
val test1 = withS(100) {}
fun <TT> test2(x: TT) = withS(x) {}
@@ -0,0 +1,5 @@
package
public val test1: kotlin.Int
public fun </*0*/ TT> test2(/*0*/ x: TT): TT
public fun </*0*/ T> withS(/*0*/ x: T, /*1*/ sfn: suspend T.() -> kotlin.Unit): T
@@ -0,0 +1,5 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun <T1, T2> withS2(x: T1, sfn1: suspend T1.() -> T2, sfn2: suspend T2.() -> Unit): T2 = null!!
val test1 = withS2(100, { toLong().toString() }, { length })
@@ -0,0 +1,4 @@
package
public val test1: kotlin.String
public fun </*0*/ T1, /*1*/ T2> withS2(/*0*/ x: T1, /*1*/ sfn1: suspend T1.() -> T2, /*2*/ sfn2: suspend T2.() -> kotlin.Unit): T2
@@ -0,0 +1,10 @@
suspend fun foo1(q: suspend () -> Unit) = q()
suspend fun foo2(x: suspend (Int) -> String) = x(1)
suspend fun foo3(y: suspend String.(Int) -> Double) = "".y(1)
suspend fun String.foo4(y: suspend String.(Int) -> Double) = "".y(1)
fun noSuspend(x: suspend (Int) -> String) {
<!ILLEGAL_SUSPEND_FUNCTION_CALL!>x<!>(1)
}
@@ -0,0 +1,7 @@
package
public suspend fun foo1(/*0*/ q: suspend () -> kotlin.Unit): kotlin.Unit
public suspend fun foo2(/*0*/ x: suspend (kotlin.Int) -> kotlin.String): kotlin.String
public suspend fun foo3(/*0*/ y: suspend kotlin.String.(kotlin.Int) -> kotlin.Double): kotlin.Double
public fun noSuspend(/*0*/ x: suspend (kotlin.Int) -> kotlin.String): kotlin.Unit
public suspend fun kotlin.String.foo4(/*0*/ y: suspend kotlin.String.(kotlin.Int) -> kotlin.Double): kotlin.Double
@@ -0,0 +1,23 @@
interface Foo {
val foo: suspend () -> Unit
}
interface Bar<T> {
val bar: T
}
class Test1 : Foo {
override val <!PROPERTY_TYPE_MISMATCH_ON_OVERRIDE!>foo<!> = {}
}
class Test2 : Foo {
override val foo: suspend () -> Unit = {}
}
class Test3 : Bar<suspend () -> Unit> {
override val <!PROPERTY_TYPE_MISMATCH_ON_OVERRIDE!>bar<!> = {}
}
class Test4 : Bar<suspend () -> Unit> {
override val bar: suspend () -> Unit = {}
}
@@ -0,0 +1,47 @@
package
public interface Bar</*0*/ T> {
public abstract val bar: T
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface Foo {
public abstract val foo: suspend () -> kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Test1 : Foo {
public constructor Test1()
public open override /*1*/ val foo: () -> kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Test2 : Foo {
public constructor Test2()
public open override /*1*/ val foo: suspend () -> kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Test3 : Bar<suspend () -> kotlin.Unit> {
public constructor Test3()
public open override /*1*/ val bar: () -> kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Test4 : Bar<suspend () -> kotlin.Unit> {
public constructor Test4()
public open override /*1*/ val bar: suspend () -> kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,6 @@
typealias SuspendFn = suspend () -> Unit
val test1: suspend () -> Unit = {}
val test2: suspend Any.() -> Unit = {}
val test3: suspend Any.(Int) -> Int = { k: Int -> k + 1 }
val test4: SuspendFn = {}
@@ -0,0 +1,7 @@
package
public val test1: suspend () -> kotlin.Unit
public val test2: suspend kotlin.Any.() -> kotlin.Unit
public val test3: suspend kotlin.Any.(kotlin.Int) -> kotlin.Int
public val test4: SuspendFn /* = suspend () -> kotlin.Unit */
public typealias SuspendFn = suspend () -> kotlin.Unit
@@ -0,0 +1,26 @@
typealias Action = () -> Unit
interface SAM {
fun run()
}
typealias Test1 = suspend () -> Unit
typealias Test2 = suspend Int.() -> Unit
typealias Test3 = <!WRONG_MODIFIER_TARGET!>suspend<!> Function0<Unit>
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 Test9 = suspend (() -> Unit) -> Unit
typealias Test10 = suspend (suspend () -> Unit) -> Unit
typealias Test11 = suspend () -> (suspend () -> Unit)
typealias Test12 = suspend (suspend (() -> Unit)) -> Unit
interface Supertype1 : <!SUPERTYPE_IS_SUSPEND_FUNCTION_TYPE!>suspend () -> Unit<!> {
}
interface Supertype2 : <!SUPERTYPE_IS_SUSPEND_FUNCTION_TYPE!>suspend String.() -> Unit<!> {
}
@@ -0,0 +1,35 @@
package
public interface SAM {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public abstract fun run(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface Supertype1 : suspend () -> kotlin.Unit {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public abstract suspend override /*1*/ /*fake_override*/ fun invoke(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface Supertype2 : suspend kotlin.String.() -> kotlin.Unit {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public abstract suspend override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: kotlin.String): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public typealias Action = () -> kotlin.Unit
public typealias Test1 = suspend () -> kotlin.Unit
public typealias Test10 = suspend (suspend () -> kotlin.Unit) -> kotlin.Unit
public typealias Test11 = suspend () -> suspend () -> kotlin.Unit
public typealias Test12 = suspend (suspend () -> kotlin.Unit) -> kotlin.Unit
public typealias Test2 = suspend kotlin.Int.() -> kotlin.Unit
public typealias Test3 = () -> kotlin.Unit
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 Test9 = suspend (() -> kotlin.Unit) -> kotlin.Unit
@@ -0,0 +1,2 @@
fun test1(sfn: suspend () -> Unit) = <!ILLEGAL_SUSPEND_FUNCTION_CALL!>sfn<!>()
fun test2(sfn: suspend () -> Unit) = sfn.<!ILLEGAL_SUSPEND_FUNCTION_CALL!>invoke<!>()
@@ -0,0 +1,4 @@
package
public fun test1(/*0*/ sfn: suspend () -> kotlin.Unit): kotlin.Unit
public fun test2(/*0*/ sfn: suspend () -> kotlin.Unit): kotlin.Unit
@@ -0,0 +1,4 @@
typealias Test1 = suspend (Int) -> Unit
typealias Test2 = suspend Int.(Int) -> Unit
typealias Test3 = List<suspend (Int) -> Unit>
typealias Test4 = List<suspend Int.(Int) -> Unit>
@@ -0,0 +1,6 @@
package
public typealias Test1 = suspend (kotlin.Int) -> kotlin.Unit
public typealias Test2 = suspend kotlin.Int.(kotlin.Int) -> kotlin.Unit
public typealias Test3 = kotlin.collections.List<suspend (kotlin.Int) -> kotlin.Unit>
public typealias Test4 = kotlin.collections.List<suspend kotlin.Int.(kotlin.Int) -> kotlin.Unit>
@@ -0,0 +1,9 @@
val test1: (suspend () -> Unit)? = null
val test2: <!WRONG_MODIFIER_TARGET!>suspend<!> (() -> Unit)? = null
val test3: <!WRONG_MODIFIER_TARGET!>suspend<!> ( (() -> Unit)? ) = null
fun foo() {
test1?.<!ILLEGAL_SUSPEND_FUNCTION_CALL!>invoke<!>()
test2?.<!ILLEGAL_SUSPEND_FUNCTION_CALL!>invoke<!>()
test3?.<!ILLEGAL_SUSPEND_FUNCTION_CALL!>invoke<!>()
}
@@ -0,0 +1,6 @@
package
public val test1: (suspend () -> kotlin.Unit)? = null
public val test2: (suspend () -> kotlin.Unit)? = null
public val test3: (suspend () -> kotlin.Unit)? = null
public fun foo(): kotlin.Unit
@@ -0,0 +1,3 @@
typealias Test1 = <!UNRESOLVED_REFERENCE!>SuspendFunction0<!><Unit>
typealias Test2 = kotlin.<!UNRESOLVED_REFERENCE!>SuspendFunction0<!><Unit>
typealias Test3 = kotlin.coroutines.<!UNRESOLVED_REFERENCE!>SuspendFunction0<!><Unit>
@@ -0,0 +1,5 @@
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>
@@ -0,0 +1,42 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !CHECK_TYPE
import kotlin.coroutines.experimental.*
class Controller {
suspend fun noParams() {
}
suspend fun yieldString(value: String) {}
suspend fun <V> await(f: () -> V): V = f()
suspend fun <V> await(f: Int): V = null!!
suspend fun severalParams(x: String, y: Int) = 1.0
}
fun builder(c: suspend Controller.() -> Unit) {}
fun test() {
builder {
noParams()
yieldString("abc") checkType { _<Unit>() }
yieldString(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>) checkType { _<Unit>() }
await<String> { "123" } checkType { _<String>() }
// Inference from lambda return type
await { 123 } checkType { _<Int>() }
// Inference from expected type
checkSubtype<String>(await(567))
await<Double>(123) checkType { _<Double>() }
severalParams("", 89) checkType { _<Double>() }
// TODO: should we allow somehow to call with passing continuation explicitly?
severalParams("", 89, <!TOO_MANY_ARGUMENTS!>6.9<!>) checkType { <!TYPE_MISMATCH!>_<!><Unit>() }
severalParams("", 89, <!TOO_MANY_ARGUMENTS!>this <!CAST_NEVER_SUCCEEDS!>as<!> Continuation<Double><!>) checkType { <!TYPE_MISMATCH!>_<!><Unit>() }
}
}
@@ -0,0 +1,16 @@
package
public fun builder(/*0*/ c: suspend Controller.() -> kotlin.Unit): kotlin.Unit
public fun test(): kotlin.Unit
public final class Controller {
public constructor Controller()
public final suspend fun </*0*/ V> await(/*0*/ f: () -> V): V
public final suspend fun </*0*/ V> await(/*0*/ f: kotlin.Int): V
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final suspend fun noParams(): kotlin.Unit
public final suspend fun severalParams(/*0*/ x: kotlin.String, /*1*/ y: kotlin.Int): kotlin.Double
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final suspend fun yieldString(/*0*/ value: kotlin.String): kotlin.Unit
}
@@ -0,0 +1,37 @@
// FILE: main.kt
interface A {
suspend fun foo()
fun bar()
}
interface B : A {
<!CONFLICTING_OVERLOADS!><!NOTHING_TO_OVERRIDE!>override<!> fun foo()<!> {
}
<!CONFLICTING_OVERLOADS!><!NOTHING_TO_OVERRIDE!>override<!> suspend fun bar()<!> {
}
}
interface C : A {
suspend override fun foo() {
}
override fun bar() {
}
}
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class D<!> : J {
<!ACCIDENTAL_OVERRIDE!>suspend override fun foo()<!> {
}
}
// FILE: J.java
public interface J extends A {
Object foo(kotlin.coroutines.experimental.Continuation<kotlin.Unit> y);
}
@@ -0,0 +1,44 @@
package
public interface A {
public abstract fun bar(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public abstract suspend fun foo(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface B : A {
public open suspend fun bar(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open fun foo(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface C : A {
public open override /*1*/ fun bar(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open suspend override /*1*/ fun foo(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class D : J {
public constructor D()
public abstract override /*1*/ /*fake_override*/ fun bar(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open suspend override /*1*/ fun foo(): kotlin.Unit
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ y: kotlin.coroutines.experimental.Continuation<kotlin.Unit!>!): kotlin.Any!
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface J : A {
public abstract override /*1*/ /*fake_override*/ fun bar(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public abstract suspend override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit
public abstract fun foo(/*0*/ y: kotlin.coroutines.experimental.Continuation<kotlin.Unit!>!): kotlin.Any!
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,19 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.*
fun nonSuspend() {}
suspend fun foo() {
suspendCoroutineOrReturn { x: Continuation<Int> -> }
nonSuspend()
}
suspend fun unitSuspend() {
suspendCoroutineOrReturn { x: Continuation<Int> -> }
}
suspend fun baz(): Int = run {
suspendCoroutineOrReturn { x: Continuation<Int> -> }
}
@@ -0,0 +1,6 @@
package
public suspend fun baz(): kotlin.Int
public suspend fun foo(): kotlin.Unit
public fun nonSuspend(): kotlin.Unit
public suspend fun unitSuspend(): kotlin.Unit
@@ -0,0 +1,17 @@
suspend fun baz() = 1
suspend fun unit() {}
suspend fun foo() {
<!WRONG_MODIFIER_TARGET!>suspend<!> fun bar() {
baz()
return unit()
}
<!WRONG_MODIFIER_TARGET!>suspend<!> fun foobar1(): Int {
return baz()
}
<!WRONG_MODIFIER_TARGET!>suspend<!> fun foobar2() {
return unit()
}
}
@@ -0,0 +1,5 @@
package
public suspend fun baz(): kotlin.Int
public suspend fun foo(): kotlin.Unit
public suspend fun unit(): kotlin.Unit
@@ -0,0 +1,8 @@
// Tail calls are not allowed to be Nothing typed. See KT-15051
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.*
suspend fun suspendLogAndThrow(exception: Throwable): Nothing = suspendCoroutineOrReturn { c ->
c.resumeWithException(exception)
SUSPENDED_MARKER
}
@@ -0,0 +1,3 @@
package
public suspend fun suspendLogAndThrow(/*0*/ exception: kotlin.Throwable): kotlin.Nothing
@@ -0,0 +1,18 @@
suspend fun unit1() {
unit1()
}
suspend fun unit2() {
return unit2()
}
suspend fun int1(): Int {
return int1()
}
suspend fun int2(): Int = int2()
suspend fun int3(): Int {
int3()
return int3()
}
@@ -0,0 +1,7 @@
package
public suspend fun int1(): kotlin.Int
public suspend fun int2(): kotlin.Int
public suspend fun int3(): kotlin.Int
public suspend fun unit1(): kotlin.Unit
public suspend fun unit2(): kotlin.Unit
@@ -0,0 +1,41 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.*
fun nonSuspend() {}
suspend fun baz(): Int = 1
suspend fun tryCatch(): Int {
return try {
suspendCoroutineOrReturn { x: Continuation<Int> -> }
} catch (e: Exception) {
baz() // another suspend function
}
}
suspend fun tryFinally(): Int {
return try {
suspendCoroutineOrReturn { x: Continuation<Int> -> }
} finally {
nonSuspend()
}
}
suspend fun returnInFinally(): Int {
try {
} finally {
// Probably this is too restrictive, but it does not matter much
return baz()
}
}
suspend fun tryCatchFinally(): Int {
return try {
suspendCoroutineOrReturn { x: Continuation<Int> -> }
} catch (e: Exception) {
baz() // another suspend function
} finally {
baz()
}
}
@@ -0,0 +1,8 @@
package
public suspend fun baz(): kotlin.Int
public fun nonSuspend(): kotlin.Unit
public suspend fun returnInFinally(): kotlin.Int
public suspend fun tryCatch(): kotlin.Int
public suspend fun tryCatchFinally(): kotlin.Int
public suspend fun tryFinally(): kotlin.Int

Some files were not shown because too many files have changed in this diff Show More