Add synthetic flag to generated private suspend functions

Private suspend functions need to be generated as package-local, since
they are called from their continuations.
However, this means that they can be called from Java, which breaks
their private visibility.
Adding synthetic to them fixes the issue.
 #KT-17584: Fixed
This commit is contained in:
Ilmir Usmanov
2018-04-06 20:27:09 +03:00
parent a487543827
commit eb3b9032d6
5 changed files with 25 additions and 3 deletions
@@ -0,0 +1,5 @@
private suspend fun foo() {}
class A {
private suspend fun foo() {}
}
@@ -0,0 +1,10 @@
@kotlin.Metadata
public final class A {
public method <init>(): void
synthetic final @org.jetbrains.annotations.Nullable method foo(@org.jetbrains.annotations.Nullable p0: java.lang.Object): java.lang.Object
}
@kotlin.Metadata
public final class PrivateSuspendFunKt {
synthetic final static @org.jetbrains.annotations.Nullable method foo(@org.jetbrains.annotations.Nullable p0: java.lang.Object): java.lang.Object
}
@@ -15,6 +15,6 @@ public final class TailCallIntrinsicsKt {
static method <clinit>(): void
public final static method getP(): int
public final static method setP(p0: int): void
final static @org.jetbrains.annotations.Nullable method withInline(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object
final static @org.jetbrains.annotations.Nullable method withoutInline(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object
synthetic final static @org.jetbrains.annotations.Nullable method withInline(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object
synthetic final static @org.jetbrains.annotations.Nullable method withoutInline(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object
}