Kotlin error compiling decorated suspend inline functions

Using

  • Kotlin 1.2.51
  • Kotlinx 0.23.4

Code:

import kotlinx.coroutines.experimental.async
import kotlinx.coroutines.experimental.runBlocking
import org.junit.Test
import kotlin.coroutines.experimental.Continuation
import kotlin.coroutines.experimental.suspendCoroutine

class InlineSuspendFail {

    @Test
    fun showFail() {

        val decoratedWork = decorate {
            work {
                Thread {
                    Thread.sleep(100)
                    it.resume(42)
                }.start()
            }
        }

        val deferred = async { decoratedWork() }
        runBlocking { deferred.await() }

    }

    fun decorate(actualWork: suspend () -> Int): suspend () -> Int {
        return {
            actualWork
                    .let { workDecorator(it) }
                    .invoke()
        }
    }

    suspend inline fun work(crossinline triggerResume: (Continuation<Int>) -> Unit): Int {
        System.out.println("Starting suspend")
        return suspendCoroutine { continuation ->
            System.out.println("Triggering resume")
            triggerResume(continuation)
            System.out.println("Resume triggered")
        }
    }

    suspend inline fun workDecorator(crossinline work: suspend () -> Int): suspend () -> Int = suspend {
        System.out.println("About to call work")
        work()
    }
}

Error:

Error:Kotlin: [Internal Error] java.lang.IllegalStateException: Backend Internal error: Exception during code generation
Cause: Back-end (JVM) Internal error: wrong code generated
org.jetbrains.kotlin.codegen.CompilationException Back-end (JVM) Internal error: Couldn't transform method node:
doResume (Ljava/lang/Object;Ljava/lang/Throwable;)Ljava/lang/Object;:
  @Lorg/jetbrains/annotations/Nullable;() // invisible
    @Lorg/jetbrains/annotations/Nullable;() // invisible, parameter 0
    @Lorg/jetbrains/annotations/Nullable;() // invisible, parameter 1
   L0
   L1
   L2
    LINENUMBER 15 L2
    ALOAD 0
    GETFIELD test/InlineSuspendFail$showFail$decoratedWork$1.this$0 : Ltest/InlineSuspendFail;
    ASTORE 3
    NOP
   L3
    LINENUMBER 50 L3
    GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
    LDC "Starting suspend"
    INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
   L4
    LINENUMBER 51 L4
    NOP
   L5
    LINENUMBER 52 L5
    ICONST_0
    INVOKESTATIC kotlin/jvm/internal/InlineMarker.mark (I)V
    ALOAD 0
    INVOKESTATIC kotlin/coroutines/experimental/jvm/internal/CoroutineIntrinsics.normalizeContinuation (Lkotlin/coroutines/experimental/Continuation;)Lkotlin/coroutines/experimental/Continuation;
    ASTORE 5
   L6
    LINENUMBER 53 L6
    NEW kotlin/coroutines/experimental/SafeContinuation
    DUP
    ALOAD 5
    INVOKESPECIAL kotlin/coroutines/experimental/SafeContinuation.<init> (Lkotlin/coroutines/experimental/Continuation;)V
    ASTORE 6
   L7
    LINENUMBER 54 L7
   L8
    LINENUMBER 55 L8
    GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
    LDC "Triggering resume"
    INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
   L9
    LINENUMBER 56 L9
    ALOAD 6
   L10
   L11
    LINENUMBER 16 L11
   L12
    LINENUMBER 19 L12
   L13
    LINENUMBER 16 L13
    NEW java/lang/Thread
    DUP
    NEW test/InlineSuspendFail$showFail$decoratedWork$1$1$1
    DUP
    CHECKCAST kotlin/coroutines/experimental/Continuation
    CHECKCAST kotlin/coroutines/experimental/Continuation
    INVOKESPECIAL test/InlineSuspendFail$showFail$decoratedWork$1$1$1.<init> (Lkotlin/coroutines/experimental/Continuation;)V
    CHECKCAST java/lang/Runnable
    INVOKESPECIAL java/lang/Thread.<init> (Ljava/lang/Runnable;)V
   L14
    LINENUMBER 19 L14
    INVOKEVIRTUAL java/lang/Thread.start ()V
   L15
    LINENUMBER 20 L15
    NOP
    GOTO L16
   L17
   L18
   L16
   L19
    LINENUMBER 57 L19
    GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
    LDC "Resume triggered"
    INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
   L20
    LINENUMBER 58 L20
    NOP
    GOTO L21
   L21
   L22
    LINENUMBER 59 L22
    ALOAD 6
    INVOKEVIRTUAL kotlin/coroutines/experimental/SafeContinuation.getResult ()Ljava/lang/Object;
   L23
    NOP
   L24
    LINENUMBER 52 L24
    ICONST_1
    INVOKESTATIC kotlin/jvm/internal/InlineMarker.mark (I)V
   L25
    NOP
   L26
   L27
    LINENUMBER 60 L27
    NOP
    GOTO L28
   L28
    NOP
    GOTO L29
   L30
   L31
   L29
   L32
   L33
    LINENUMBER 20 L33
    ARETURN
   L34
    LOCALVARIABLE it Lkotlin/coroutines/experimental/Continuation; L10 L18 8
    LOCALVARIABLE $i$a$1$work I L10 L18 9
    LOCALVARIABLE continuation$iv Lkotlin/coroutines/experimental/Continuation; L8 L21 7
    LOCALVARIABLE $i$a$2$suspendCoroutine I L8 L21 10
    LOCALVARIABLE safe$iv$iv Lkotlin/coroutines/experimental/SafeContinuation; L7 L23 6
    LOCALVARIABLE c$iv$iv Lkotlin/coroutines/experimental/Continuation; L6 L24 5
    LOCALVARIABLE $i$a$2$suspendCoroutineOrReturn I L6 L24 11
    LOCALVARIABLE $i$f$suspendCoroutine I L5 L28 12
    LOCALVARIABLE this_$iv Ltest/InlineSuspendFail; L3 L31 3
    LOCALVARIABLE $i$f$work I L3 L31 13
    LOCALVARIABLE this Ltest/InlineSuspendFail$showFail$decoratedWork$1; L0 L34 0
    LOCALVARIABLE data Ljava/lang/Object; L0 L34 1
    LOCALVARIABLE throwable Ljava/lang/Throwable; L0 L34 2
    MAXSTACK = 5
    MAXLOCALS = 14
Cause: Error at instruction #55 INVOKESPECIAL java/lang/Thread.<init> (Ljava/lang/Runnable;)V: Expected value generated with NEW
Element is unknownThe root cause was thrown at: MethodAnalyzer.kt:150
bytecode:
  @Lorg/jetbrains/annotations/Nullable;() // invisible
    @Lorg/jetbrains/annotations/Nullable;() // invisible, parameter 0
    @Lorg/jetbrains/annotations/Nullable;() // invisible, parameter 1
   L0
   L1
   L2
    LINENUMBER 15 L2
    ALOAD 0
    GETFIELD test/InlineSuspendFail$showFail$decoratedWork$1.this$0 : Ltest/InlineSuspendFail;
    ASTORE 3
    NOP
   L3
    LINENUMBER 50 L3
    GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
    LDC "Starting suspend"
    INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
   L4
    LINENUMBER 51 L4
    NOP
   L5
    LINENUMBER 52 L5
    ICONST_0
    INVOKESTATIC kotlin/jvm/internal/InlineMarker.mark (I)V
    ALOAD 0
    INVOKESTATIC kotlin/coroutines/experimental/jvm/internal/CoroutineIntrinsics.normalizeContinuation (Lkotlin/coroutines/experimental/Continuation;)Lkotlin/coroutines/experimental/Continuation;
    ASTORE 5
   L6
    LINENUMBER 53 L6
    NEW kotlin/coroutines/experimental/SafeContinuation
    DUP
    ALOAD 5
    INVOKESPECIAL kotlin/coroutines/experimental/SafeContinuation.<init> (Lkotlin/coroutines/experimental/Continuation;)V
    ASTORE 6
   L7
    LINENUMBER 54 L7
   L8
    LINENUMBER 55 L8
    GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
    LDC "Triggering resume"
    INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
   L9
    LINENUMBER 56 L9
    ALOAD 6
   L10
   L11
    LINENUMBER 16 L11
   L12
    LINENUMBER 19 L12
   L13
    LINENUMBER 16 L13
    NEW java/lang/Thread
    DUP
    NEW test/InlineSuspendFail$showFail$decoratedWork$1$1$1
    DUP
    CHECKCAST kotlin/coroutines/experimental/Continuation
    CHECKCAST kotlin/coroutines/experimental/Continuation
    INVOKESPECIAL test/InlineSuspendFail$showFail$decoratedWork$1$1$1.<init> (Lkotlin/coroutines/experimental/Continuation;)V
    CHECKCAST java/lang/Runnable
    INVOKESPECIAL java/lang/Thread.<init> (Ljava/lang/Runnable;)V
   L14
    LINENUMBER 19 L14
    INVOKEVIRTUAL java/lang/Thread.start ()V
   L15
    LINENUMBER 20 L15
    NOP
    GOTO L16
   L17
   L18
   L16
   L19
    LINENUMBER 57 L19
    GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
    LDC "Resume triggered"
    INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
   L20
    LINENUMBER 58 L20
    NOP
    GOTO L21
   L21
   L22
    LINENUMBER 59 L22
    ALOAD 6
    INVOKEVIRTUAL kotlin/coroutines/experimental/SafeContinuation.getResult ()Ljava/lang/Object;
   L23
    NOP
   L24
    LINENUMBER 52 L24
    ICONST_1
    INVOKESTATIC kotlin/jvm/internal/InlineMarker.mark (I)V
   L25
    NOP
   L26
   L27
    LINENUMBER 60 L27
    NOP
    GOTO L28
   L28
    NOP
    GOTO L29
   L30
   L31
   L29
   L32
   L33
    LINENUMBER 20 L33
    ARETURN
   L34
    LOCALVARIABLE it Lkotlin/coroutines/experimental/Continuation; L10 L18 8
    LOCALVARIABLE $i$a$1$work I L10 L18 9
    LOCALVARIABLE continuation$iv Lkotlin/coroutines/experimental/Continuation; L8 L21 7
    LOCALVARIABLE $i$a$2$suspendCoroutine I L8 L21 10
    LOCALVARIABLE safe$iv$iv Lkotlin/coroutines/experimental/SafeContinuation; L7 L23 6
    LOCALVARIABLE c$iv$iv Lkotlin/coroutines/experimental/Continuation; L6 L24 5
    LOCALVARIABLE $i$a$2$suspendCoroutineOrReturn I L6 L24 11
    LOCALVARIABLE $i$f$suspendCoroutine I L5 L28 12
    LOCALVARIABLE this_$iv Ltest/InlineSuspendFail; L3 L31 3
    LOCALVARIABLE $i$f$work I L3 L31 13
    LOCALVARIABLE this Ltest/InlineSuspendFail$showFail$decoratedWork$1; L0 L34 0
    LOCALVARIABLE data Ljava/lang/Object; L0 L34 1
    LOCALVARIABLE throwable Ljava/lang/Throwable; L0 L34 2
    MAXSTACK = 5
    MAXLOCALS = 14
Cause: Back-end (JVM) Internal error: Couldn't transform method node:
doResume (Ljava/lang/Object;Ljava/lang/Throwable;)Ljava/lang/Object;:
  @Lorg/jetbrains/annotations/Nullable;() // invisible
    @Lorg/jetbrains/annotations/Nullable;() // invisible, parameter 0
    @Lorg/jetbrains/annotations/Nullable;() // invisible, parameter 1
   L0
   L1
   L2
    LINENUMBER 15 L2
    ALOAD 0
    GETFIELD test/InlineSuspendFail$showFail$decoratedWork$1.this$0 : Ltest/InlineSuspendFail;
    ASTORE 3
    NOP
   L3
    LINENUMBER 50 L3
    GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
    LDC "Starting suspend"
    INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
   L4
    LINENUMBER 51 L4
    NOP
   L5
    LINENUMBER 52 L5
    ICONST_0
    INVOKESTATIC kotlin/jvm/internal/InlineMarker.mark (I)V
    ALOAD 0
    INVOKESTATIC kotlin/coroutines/experimental/jvm/internal/CoroutineIntrinsics.normalizeContinuation (Lkotlin/coroutines/experimental/Continuation;)Lkotlin/coroutines/experimental/Continuation;
    ASTORE 5
   L6
    LINENUMBER 53 L6
    NEW kotlin/coroutines/experimental/SafeContinuation
    DUP
    ALOAD 5
    INVOKESPECIAL kotlin/coroutines/experimental/SafeContinuation.<init> (Lkotlin/coroutines/experimental/Continuation;)V
    ASTORE 6
   L7
    LINENUMBER 54 L7
   L8
    LINENUMBER 55 L8
    GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
    LDC "Triggering resume"
    INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
   L9
    LINENUMBER 56 L9
    ALOAD 6
   L10
   L11
    LINENUMBER 16 L11
   L12
    LINENUMBER 19 L12
   L13
    LINENUMBER 16 L13
    NEW java/lang/Thread
    DUP
    NEW test/InlineSuspendFail$showFail$decoratedWork$1$1$1
    DUP
    CHECKCAST kotlin/coroutines/experimental/Continuation
    CHECKCAST kotlin/coroutines/experimental/Continuation
    INVOKESPECIAL test/InlineSuspendFail$showFail$decoratedWork$1$1$1.<init> (Lkotlin/coroutines/experimental/Continuation;)V
    CHECKCAST java/lang/Runnable
    INVOKESPECIAL java/lang/Thread.<init> (Ljava/lang/Runnable;)V
   L14
    LINENUMBER 19 L14
    INVOKEVIRTUAL java/lang/Thread.start ()V
   L15
    LINENUMBER 20 L15
    NOP
    GOTO L16
   L17
   L18
   L16
   L19
    LINENUMBER 57 L19
    GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
    LDC "Resume triggered"
    INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
   L20
    LINENUMBER 58 L20
    NOP
    GOTO L21
   L21
   L22
    LINENUMBER 59 L22
    ALOAD 6
    INVOKEVIRTUAL kotlin/coroutines/experimental/SafeContinuation.getResult ()Ljava/lang/Object;
   L23
    NOP
   L24
    LINENUMBER 52 L24
    ICONST_1
    INVOKESTATIC kotlin/jvm/internal/InlineMarker.mark (I)V
   L25
    NOP
   L26
   L27
    LINENUMBER 60 L27
    NOP
    GOTO L28
   L28
    NOP
    GOTO L29
   L30
   L31
   L29
   L32
   L33
    LINENUMBER 20 L33
    ARETURN
   L34
    LOCALVARIABLE it Lkotlin/coroutines/experimental/Continuation; L10 L18 8
    LOCALVARIABLE $i$a$1$work I L10 L18 9
    LOCALVARIABLE continuation$iv Lkotlin/coroutines/experimental/Continuation; L8 L21 7
    LOCALVARIABLE $i$a$2$suspendCoroutine I L8 L21 10
    LOCALVARIABLE safe$iv$iv Lkotlin/coroutines/experimental/SafeContinuation; L7 L23 6
    LOCALVARIABLE c$iv$iv Lkotlin/coroutines/experimental/Continuation; L6 L24 5
    LOCALVARIABLE $i$a$2$suspendCoroutineOrReturn I L6 L24 11
    LOCALVARIABLE $i$f$suspendCoroutine I L5 L28 12
    LOCALVARIABLE this_$iv Ltest/InlineSuspendFail; L3 L31 3
    LOCALVARIABLE $i$f$work I L3 L31 13
    LOCALVARIABLE this Ltest/InlineSuspendFail$showFail$decoratedWork$1; L0 L34 0
    LOCALVARIABLE data Ljava/lang/Object; L0 L34 1
    LOCALVARIABLE throwable Ljava/lang/Throwable; L0 L34 2
    MAXSTACK = 5
    MAXLOCALS = 14
Cause: Error at instruction #55 INVOKESPECIAL java/lang/Thread.<init> (Ljava/lang/Runnable;)V: Expected value generated with NEW
Element is unknownThe root cause was thrown at: MethodAnalyzer.kt:150
File being compiled at position: (14,38) in .../InlineSuspendFail.kt
The root cause was thrown at: TransformationMethodVisitor.java:88
File being compiled at position: file:///.../InlineSuspendFail.kt
The root cause was thrown at: FunctionCodegen.java:1008
	at org.jetbrains.kotlin.codegen.CompilationErrorHandler.lambda$static$0(CompilationErrorHandler.java:24)
	at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generate(PackageCodegenImpl.java:74)
	at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generatePackage(CodegenFactory.kt:97)
	at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generateModule(CodegenFactory.kt:68)
	at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.doGenerateFiles(KotlinCodegenFacade.java:47)
	at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:39)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.generate(KotlinToJVMBytecodeCompiler.kt:442)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:146)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:154)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:51)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:95)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:50)
	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:88)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$1.invoke(CompileServiceImpl.kt:399)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$1.invoke(CompileServiceImpl.kt:98)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:927)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:98)
	at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:957)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:926)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:397)
	at sun.reflect.GeneratedMethodAccessor82.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
	at sun.rmi.transport.Transport$1.run(Transport.java:200)
	at sun.rmi.transport.Transport$1.run(Transport.java:197)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:835)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: wrong code generated
org.jetbrains.kotlin.codegen.CompilationException Back-end (JVM) Internal error: Couldn't transform method node:
doResume (Ljava/lang/Object;Ljava/lang/Throwable;)Ljava/lang/Object;:
  @Lorg/jetbrains/annotations/Nullable;() // invisible
    @Lorg/jetbrains/annotations/Nullable;() // invisible, parameter 0
    @Lorg/jetbrains/annotations/Nullable;() // invisible, parameter 1
   L0
   L1
   L2
    LINENUMBER 15 L2
    ALOAD 0
    GETFIELD test/InlineSuspendFail$showFail$decoratedWork$1.this$0 : Ltest/InlineSuspendFail;
    ASTORE 3
    NOP
   L3
    LINENUMBER 50 L3
    GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
    LDC "Starting suspend"
    INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
   L4
    LINENUMBER 51 L4
    NOP
   L5
    LINENUMBER 52 L5
    ICONST_0
    INVOKESTATIC kotlin/jvm/internal/InlineMarker.mark (I)V
    ALOAD 0
    INVOKESTATIC kotlin/coroutines/experimental/jvm/internal/CoroutineIntrinsics.normalizeContinuation (Lkotlin/coroutines/experimental/Continuation;)Lkotlin/coroutines/experimental/Continuation;
    ASTORE 5
   L6
    LINENUMBER 53 L6
    NEW kotlin/coroutines/experimental/SafeContinuation
    DUP
    ALOAD 5
    INVOKESPECIAL kotlin/coroutines/experimental/SafeContinuation.<init> (Lkotlin/coroutines/experimental/Continuation;)V
    ASTORE 6
   L7
    LINENUMBER 54 L7
   L8
    LINENUMBER 55 L8
    GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
    LDC "Triggering resume"
    INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
   L9
    LINENUMBER 56 L9
    ALOAD 6
   L10
   L11
    LINENUMBER 16 L11
   L12
    LINENUMBER 19 L12
   L13
    LINENUMBER 16 L13
    NEW java/lang/Thread
    DUP
    NEW test/InlineSuspendFail$showFail$decoratedWork$1$1$1
    DUP
    CHECKCAST kotlin/coroutines/experimental/Continuation
    CHECKCAST kotlin/coroutines/experimental/Continuation
    INVOKESPECIAL test/InlineSuspendFail$showFail$decoratedWork$1$1$1.<init> (Lkotlin/coroutines/experimental/Continuation;)V
    CHECKCAST java/lang/Runnable
    INVOKESPECIAL java/lang/Thread.<init> (Ljava/lang/Runnable;)V
   L14
    LINENUMBER 19 L14
    INVOKEVIRTUAL java/lang/Thread.start ()V
   L15
    LINENUMBER 20 L15
    NOP
    GOTO L16
   L17
   L18
   L16
   L19
    LINENUMBER 57 L19
    GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
    LDC "Resume triggered"
    INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
   L20
    LINENUMBER 58 L20
    NOP
    GOTO L21
   L21
   L22
    LINENUMBER 59 L22
    ALOAD 6
    INVOKEVIRTUAL kotlin/coroutines/experimental/SafeContinuation.getResult ()Ljava/lang/Object;
   L23
    NOP
   L24
    LINENUMBER 52 L24
    ICONST_1
    INVOKESTATIC kotlin/jvm/internal/InlineMarker.mark (I)V
   L25
    NOP
   L26
   L27
    LINENUMBER 60 L27
    NOP
    GOTO L28
   L28
    NOP
    GOTO L29
   L30
   L31
   L29
   L32
   L33
    LINENUMBER 20 L33
    ARETURN
   L34
    LOCALVARIABLE it Lkotlin/coroutines/experimental/Continuation; L10 L18 8
    LOCALVARIABLE $i$a$1$work I L10 L18 9
    LOCALVARIABLE continuation$iv Lkotlin/coroutines/experimental/Continuation; L8 L21 7
    LOCALVARIABLE $i$a$2$suspendCoroutine I L8 L21 10
    LOCALVARIABLE safe$iv$iv Lkotlin/coroutines/experimental/SafeContinuation; L7 L23 6
    LOCALVARIABLE c$iv$iv Lkotlin/coroutines/experimental/Continuation; L6 L24 5
    LOCALVARIABLE $i$a$2$suspendCoroutineOrReturn I L6 L24 11
    LOCALVARIABLE $i$f$suspendCoroutine I L5 L28 12
    LOCALVARIABLE this_$iv Ltest/InlineSuspendFail; L3 L31 3
    LOCALVARIABLE $i$f$work I L3 L31 13
    LOCALVARIABLE this Ltest/InlineSuspendFail$showFail$decoratedWork$1; L0 L34 0
    LOCALVARIABLE data Ljava/lang/Object; L0 L34 1
    LOCALVARIABLE throwable Ljava/lang/Throwable; L0 L34 2
    MAXSTACK = 5
    MAXLOCALS = 14
Cause: Error at instruction #55 INVOKESPECIAL java/lang/Thread.<init> (Ljava/lang/Runnable;)V: Expected value generated with NEW
Element is unknownThe root cause was thrown at: MethodAnalyzer.kt:150
bytecode:
  @Lorg/jetbrains/annotations/Nullable;() // invisible
    @Lorg/jetbrains/annotations/Nullable;() // invisible, parameter 0
    @Lorg/jetbrains/annotations/Nullable;() // invisible, parameter 1
   L0
   L1
   L2
    LINENUMBER 15 L2
    ALOAD 0
    GETFIELD test/InlineSuspendFail$showFail$decoratedWork$1.this$0 : Ltest/InlineSuspendFail;
    ASTORE 3
    NOP
   L3
    LINENUMBER 50 L3
    GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
    LDC "Starting suspend"
    INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
   L4
    LINENUMBER 51 L4
    NOP
   L5
    LINENUMBER 52 L5
    ICONST_0
    INVOKESTATIC kotlin/jvm/internal/InlineMarker.mark (I)V
    ALOAD 0
    INVOKESTATIC kotlin/coroutines/experimental/jvm/internal/CoroutineIntrinsics.normalizeContinuation (Lkotlin/coroutines/experimental/Continuation;)Lkotlin/coroutines/experimental/Continuation;
    ASTORE 5
   L6
    LINENUMBER 53 L6
    NEW kotlin/coroutines/experimental/SafeContinuation
    DUP
    ALOAD 5
    INVOKESPECIAL kotlin/coroutines/experimental/SafeContinuation.<init> (Lkotlin/coroutines/experimental/Continuation;)V
    ASTORE 6
   L7
    LINENUMBER 54 L7
   L8
    LINENUMBER 55 L8
    GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
    LDC "Triggering resume"
    INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
   L9
    LINENUMBER 56 L9
    ALOAD 6
   L10
   L11
    LINENUMBER 16 L11
   L12
    LINENUMBER 19 L12
   L13
    LINENUMBER 16 L13
    NEW java/lang/Thread
    DUP
    NEW test/InlineSuspendFail$showFail$decoratedWork$1$1$1
    DUP
    CHECKCAST kotlin/coroutines/experimental/Continuation
    CHECKCAST kotlin/coroutines/experimental/Continuation
    INVOKESPECIAL test/InlineSuspendFail$showFail$decoratedWork$1$1$1.<init> (Lkotlin/coroutines/experimental/Continuation;)V
    CHECKCAST java/lang/Runnable
    INVOKESPECIAL java/lang/Thread.<init> (Ljava/lang/Runnable;)V
   L14
    LINENUMBER 19 L14
    INVOKEVIRTUAL java/lang/Thread.start ()V
   L15
    LINENUMBER 20 L15
    NOP
    GOTO L16
   L17
   L18
   L16
   L19
    LINENUMBER 57 L19
    GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
    LDC "Resume triggered"
    INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
   L20
    LINENUMBER 58 L20
    NOP
    GOTO L21
   L21
   L22
    LINENUMBER 59 L22
    ALOAD 6
    INVOKEVIRTUAL kotlin/coroutines/experimental/SafeContinuation.getResult ()Ljava/lang/Object;
   L23
    NOP
   L24
    LINENUMBER 52 L24
    ICONST_1
    INVOKESTATIC kotlin/jvm/internal/InlineMarker.mark (I)V
   L25
    NOP
   L26
   L27
    LINENUMBER 60 L27
    NOP
    GOTO L28
   L28
    NOP
    GOTO L29
   L30
   L31
   L29
   L32
   L33
    LINENUMBER 20 L33
    ARETURN
   L34
    LOCALVARIABLE it Lkotlin/coroutines/experimental/Continuation; L10 L18 8
    LOCALVARIABLE $i$a$1$work I L10 L18 9
    LOCALVARIABLE continuation$iv Lkotlin/coroutines/experimental/Continuation; L8 L21 7
    LOCALVARIABLE $i$a$2$suspendCoroutine I L8 L21 10
    LOCALVARIABLE safe$iv$iv Lkotlin/coroutines/experimental/SafeContinuation; L7 L23 6
    LOCALVARIABLE c$iv$iv Lkotlin/coroutines/experimental/Continuation; L6 L24 5
    LOCALVARIABLE $i$a$2$suspendCoroutineOrReturn I L6 L24 11
    LOCALVARIABLE $i$f$suspendCoroutine I L5 L28 12
    LOCALVARIABLE this_$iv Ltest/InlineSuspendFail; L3 L31 3
    LOCALVARIABLE $i$f$work I L3 L31 13
    LOCALVARIABLE this Ltest/InlineSuspendFail$showFail$decoratedWork$1; L0 L34 0
    LOCALVARIABLE data Ljava/lang/Object; L0 L34 1
    LOCALVARIABLE throwable Ljava/lang/Throwable; L0 L34 2
    MAXSTACK = 5
    MAXLOCALS = 14
Cause: Back-end (JVM) Internal error: Couldn't transform method node:
doResume (Ljava/lang/Object;Ljava/lang/Throwable;)Ljava/lang/Object;:
  @Lorg/jetbrains/annotations/Nullable;() // invisible
    @Lorg/jetbrains/annotations/Nullable;() // invisible, parameter 0
    @Lorg/jetbrains/annotations/Nullable;() // invisible, parameter 1
   L0
   L1
   L2
    LINENUMBER 15 L2
    ALOAD 0
    GETFIELD test/InlineSuspendFail$showFail$decoratedWork$1.this$0 : Ltest/InlineSuspendFail;
    ASTORE 3
    NOP
   L3
    LINENUMBER 50 L3
    GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
    LDC "Starting suspend"
    INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
   L4
    LINENUMBER 51 L4
    NOP
   L5
    LINENUMBER 52 L5
    ICONST_0
    INVOKESTATIC kotlin/jvm/internal/InlineMarker.mark (I)V
    ALOAD 0
    INVOKESTATIC kotlin/coroutines/experimental/jvm/internal/CoroutineIntrinsics.normalizeContinuation (Lkotlin/coroutines/experimental/Continuation;)Lkotlin/coroutines/experimental/Continuation;
    ASTORE 5
   L6
    LINENUMBER 53 L6
    NEW kotlin/coroutines/experimental/SafeContinuation
    DUP
    ALOAD 5
    INVOKESPECIAL kotlin/coroutines/experimental/SafeContinuation.<init> (Lkotlin/coroutines/experimental/Continuation;)V
    ASTORE 6
   L7
    LINENUMBER 54 L7
   L8
    LINENUMBER 55 L8
    GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
    LDC "Triggering resume"
    INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
   L9
    LINENUMBER 56 L9
    ALOAD 6
   L10
   L11
    LINENUMBER 16 L11
   L12
    LINENUMBER 19 L12
   L13
    LINENUMBER 16 L13
    NEW java/lang/Thread
    DUP
    NEW test/InlineSuspendFail$showFail$decoratedWork$1$1$1
    DUP
    CHECKCAST kotlin/coroutines/experimental/Continuation
    CHECKCAST kotlin/coroutines/experimental/Continuation
    INVOKESPECIAL test/InlineSuspendFail$showFail$decoratedWork$1$1$1.<init> (Lkotlin/coroutines/experimental/Continuation;)V
    CHECKCAST java/lang/Runnable
    INVOKESPECIAL java/lang/Thread.<init> (Ljava/lang/Runnable;)V
   L14
    LINENUMBER 19 L14
    INVOKEVIRTUAL java/lang/Thread.start ()V
   L15
    LINENUMBER 20 L15
    NOP
    GOTO L16
   L17
   L18
   L16
   L19
    LINENUMBER 57 L19
    GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
    LDC "Resume triggered"
    INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
   L20
    LINENUMBER 58 L20
    NOP
    GOTO L21
   L21
   L22
    LINENUMBER 59 L22
    ALOAD 6
    INVOKEVIRTUAL kotlin/coroutines/experimental/SafeContinuation.getResult ()Ljava/lang/Object;
   L23
    NOP
   L24
    LINENUMBER 52 L24
    ICONST_1
    INVOKESTATIC kotlin/jvm/internal/InlineMarker.mark (I)V
   L25
    NOP
   L26
   L27
    LINENUMBER 60 L27
    NOP
    GOTO L28
   L28
    NOP
    GOTO L29
   L30
   L31
   L29
   L32
   L33
    LINENUMBER 20 L33
    ARETURN
   L34
    LOCALVARIABLE it Lkotlin/coroutines/experimental/Continuation; L10 L18 8
    LOCALVARIABLE $i$a$1$work I L10 L18 9
    LOCALVARIABLE continuation$iv Lkotlin/coroutines/experimental/Continuation; L8 L21 7
    LOCALVARIABLE $i$a$2$suspendCoroutine I L8 L21 10
    LOCALVARIABLE safe$iv$iv Lkotlin/coroutines/experimental/SafeContinuation; L7 L23 6
    LOCALVARIABLE c$iv$iv Lkotlin/coroutines/experimental/Continuation; L6 L24 5
    LOCALVARIABLE $i$a$2$suspendCoroutineOrReturn I L6 L24 11
    LOCALVARIABLE $i$f$suspendCoroutine I L5 L28 12
    LOCALVARIABLE this_$iv Ltest/InlineSuspendFail; L3 L31 3
    LOCALVARIABLE $i$f$work I L3 L31 13
    LOCALVARIABLE this Ltest/InlineSuspendFail$showFail$decoratedWork$1; L0 L34 0
    LOCALVARIABLE data Ljava/lang/Object; L0 L34 1
    LOCALVARIABLE throwable Ljava/lang/Throwable; L0 L34 2
    MAXSTACK = 5
    MAXLOCALS = 14
Cause: Error at instruction #55 INVOKESPECIAL java/lang/Thread.<init> (Ljava/lang/Runnable;)V: Expected value generated with NEW
Element is unknownThe root cause was thrown at: MethodAnalyzer.kt:150
File being compiled at position: (14,38) in .../InlineSuspendFail.kt
The root cause was thrown at: TransformationMethodVisitor.java:88
	at org.jetbrains.kotlin.codegen.FunctionCodegen.endVisit(FunctionCodegen.java:1008)
	at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethodBody(FunctionCodegen.java:412)
	at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:251)
	at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:172)
	at org.jetbrains.kotlin.codegen.coroutines.CoroutineCodegenForLambda.generateDoResume(CoroutineCodegen.kt:301)
	at org.jetbrains.kotlin.codegen.coroutines.CoroutineCodegenForLambda.generateClosureBody(CoroutineCodegen.kt:167)
	at org.jetbrains.kotlin.codegen.ClosureCodegen.generateBody(ClosureCodegen.java:166)
	at org.jetbrains.kotlin.codegen.coroutines.CoroutineCodegenForLambda.generateBody(CoroutineCodegen.kt:171)
	at org.jetbrains.kotlin.codegen.MemberCodegen.generate(MemberCodegen.java:131)
	at org.jetbrains.kotlin.codegen.ExpressionCodegen.genClosure(ExpressionCodegen.java:986)
	at org.jetbrains.kotlin.codegen.ExpressionCodegen.genClosure(ExpressionCodegen.java:960)
	at org.jetbrains.kotlin.codegen.ExpressionCodegen.visitLambdaExpression(ExpressionCodegen.java:951)
	at org.jetbrains.kotlin.codegen.ExpressionCodegen.visitLambdaExpression(ExpressionCodegen.java:108)
	at org.jetbrains.kotlin.psi.KtLambdaExpression.accept(KtLambdaExpression.java:39)
	at org.jetbrains.kotlin.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:296)
	at org.jetbrains.kotlin.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:278)
	at org.jetbrains.kotlin.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:323)
	at org.jetbrains.kotlin.codegen.CallGenerator$DefaultCallGenerator.genValueAndPut(CallGenerator.kt:53)
	at org.jetbrains.kotlin.codegen.CallBasedArgumentGenerator.generateExpression(CallBasedArgumentGenerator.java:51)
	at org.jetbrains.kotlin.codegen.ArgumentGenerator.generate(ArgumentGenerator.kt:68)
	at org.jetbrains.kotlin.codegen.ExpressionCodegen.invokeMethodWithArguments(ExpressionCodegen.java:2374)
	at org.jetbrains.kotlin.codegen.ExpressionCodegen.invokeMethodWithArguments(ExpressionCodegen.java:2351)
	at org.jetbrains.kotlin.codegen.Callable$invokeMethodWithArguments$1.invoke(Callable.kt:41)
	at org.jetbrains.kotlin.codegen.Callable$invokeMethodWithArguments$1.invoke(Callable.kt:13)
	at org.jetbrains.kotlin.codegen.OperationStackValue.putSelector(StackValue.kt:79)
	at org.jetbrains.kotlin.codegen.StackValue.put(StackValue.java:110)
	at org.jetbrains.kotlin.codegen.StackValue.put(StackValue.java:99)
	at org.jetbrains.kotlin.codegen.ExpressionCodegen.initializeLocalVariable(ExpressionCodegen.java:3929)
	at org.jetbrains.kotlin.codegen.ExpressionCodegen.visitProperty(ExpressionCodegen.java:3800)
	at org.jetbrains.kotlin.codegen.ExpressionCodegen.visitProperty(ExpressionCodegen.java:108)
	at org.jetbrains.kotlin.psi.KtProperty.accept(KtProperty.java:57)
	at org.jetbrains.kotlin.codegen.CodegenStatementVisitor.visitKtElement(CodegenStatementVisitor.java:31)
	at org.jetbrains.kotlin.codegen.CodegenStatementVisitor.visitKtElement(CodegenStatementVisitor.java:22)
	at org.jetbrains.kotlin.psi.KtVisitor.visitExpression(KtVisitor.java:182)
	at org.jetbrains.kotlin.psi.KtVisitor.visitDeclaration(KtVisitor.java:29)
	at org.jetbrains.kotlin.psi.KtVisitor.visitNamedDeclaration(KtVisitor.java:398)
	at org.jetbrains.kotlin.psi.KtVisitor.visitProperty(KtVisitor.java:57)
	at org.jetbrains.kotlin.psi.KtProperty.accept(KtProperty.java:57)
	at org.jetbrains.kotlin.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:296)
	at org.jetbrains.kotlin.codegen.ExpressionCodegen.genStatement(ExpressionCodegen.java:370)
	at org.jetbrains.kotlin.codegen.ExpressionCodegen.generateBlock(ExpressionCodegen.java:1207)
	at org.jetbrains.kotlin.codegen.ExpressionCodegen.generateBlock(ExpressionCodegen.java:1152)
	at org.jetbrains.kotlin.codegen.CodegenStatementVisitor.visitBlockExpression(CodegenStatementVisitor.java:56)
	at org.jetbrains.kotlin.codegen.CodegenStatementVisitor.visitBlockExpression(CodegenStatementVisitor.java:22)
	at org.jetbrains.kotlin.psi.KtBlockExpression.accept(KtBlockExpression.java:44)
	at org.jetbrains.kotlin.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:296)
	at org.jetbrains.kotlin.codegen.ExpressionCodegen.genStatement(ExpressionCodegen.java:370)
	at org.jetbrains.kotlin.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:331)
	at org.jetbrains.kotlin.codegen.ExpressionCodegen.returnExpression(ExpressionCodegen.java:1627)
	at org.jetbrains.kotlin.codegen.FunctionGenerationStrategy$FunctionDefault.doGenerateBody(FunctionGenerationStrategy.java:60)
	at org.jetbrains.kotlin.codegen.FunctionGenerationStrategy$CodegenBased.generateBody(FunctionGenerationStrategy.java:80)
	at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethodBody(FunctionCodegen.java:643)
	at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethodBody(FunctionCodegen.java:399)
	at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:251)
	at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:172)
	at org.jetbrains.kotlin.codegen.FunctionCodegen.gen(FunctionCodegen.java:142)
	at org.jetbrains.kotlin.codegen.MemberCodegen.genSimpleMember(MemberCodegen.java:199)
	at org.jetbrains.kotlin.codegen.ClassBodyCodegen.generateDeclaration(ClassBodyCodegen.java:155)
	at org.jetbrains.kotlin.codegen.ClassBodyCodegen.generateBody(ClassBodyCodegen.java:75)
	at org.jetbrains.kotlin.codegen.MemberCodegen.generate(MemberCodegen.java:131)
	at org.jetbrains.kotlin.codegen.MemberCodegen.genClassOrObject(MemberCodegen.java:305)
	at org.jetbrains.kotlin.codegen.MemberCodegen.genClassOrObject(MemberCodegen.java:289)
	at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generateClassOrObject(PackageCodegenImpl.java:161)
	at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generateClassesAndObjectsInFile(PackageCodegenImpl.java:86)
	at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generateFile(PackageCodegenImpl.java:119)
	at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generate(PackageCodegenImpl.java:66)
	... 35 more
Caused by: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't transform method node:
doResume (Ljava/lang/Object;Ljava/lang/Throwable;)Ljava/lang/Object;:
  @Lorg/jetbrains/annotations/Nullable;() // invisible
    @Lorg/jetbrains/annotations/Nullable;() // invisible, parameter 0
    @Lorg/jetbrains/annotations/Nullable;() // invisible, parameter 1
   L0
   L1
   L2
    LINENUMBER 15 L2
    ALOAD 0
    GETFIELD test/InlineSuspendFail$showFail$decoratedWork$1.this$0 : Ltest/InlineSuspendFail;
    ASTORE 3
    NOP
   L3
    LINENUMBER 50 L3
    GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
    LDC "Starting suspend"
    INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
   L4
    LINENUMBER 51 L4
    NOP
   L5
    LINENUMBER 52 L5
    ICONST_0
    INVOKESTATIC kotlin/jvm/internal/InlineMarker.mark (I)V
    ALOAD 0
    INVOKESTATIC kotlin/coroutines/experimental/jvm/internal/CoroutineIntrinsics.normalizeContinuation (Lkotlin/coroutines/experimental/Continuation;)Lkotlin/coroutines/experimental/Continuation;
    ASTORE 5
   L6
    LINENUMBER 53 L6
    NEW kotlin/coroutines/experimental/SafeContinuation
    DUP
    ALOAD 5
    INVOKESPECIAL kotlin/coroutines/experimental/SafeContinuation.<init> (Lkotlin/coroutines/experimental/Continuation;)V
    ASTORE 6
   L7
    LINENUMBER 54 L7
   L8
    LINENUMBER 55 L8
    GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
    LDC "Triggering resume"
    INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
   L9
    LINENUMBER 56 L9
    ALOAD 6
   L10
   L11
    LINENUMBER 16 L11
   L12
    LINENUMBER 19 L12
   L13
    LINENUMBER 16 L13
    NEW java/lang/Thread
    DUP
    NEW test/InlineSuspendFail$showFail$decoratedWork$1$1$1
    DUP
    CHECKCAST kotlin/coroutines/experimental/Continuation
    CHECKCAST kotlin/coroutines/experimental/Continuation
    INVOKESPECIAL test/InlineSuspendFail$showFail$decoratedWork$1$1$1.<init> (Lkotlin/coroutines/experimental/Continuation;)V
    CHECKCAST java/lang/Runnable
    INVOKESPECIAL java/lang/Thread.<init> (Ljava/lang/Runnable;)V
   L14
    LINENUMBER 19 L14
    INVOKEVIRTUAL java/lang/Thread.start ()V
   L15
    LINENUMBER 20 L15
    NOP
    GOTO L16
   L17
   L18
   L16
   L19
    LINENUMBER 57 L19
    GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
    LDC "Resume triggered"
    INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
   L20
    LINENUMBER 58 L20
    NOP
    GOTO L21
   L21
   L22
    LINENUMBER 59 L22
    ALOAD 6
    INVOKEVIRTUAL kotlin/coroutines/experimental/SafeContinuation.getResult ()Ljava/lang/Object;
   L23
    NOP
   L24
    LINENUMBER 52 L24
    ICONST_1
    INVOKESTATIC kotlin/jvm/internal/InlineMarker.mark (I)V
   L25
    NOP
   L26
   L27
    LINENUMBER 60 L27
    NOP
    GOTO L28
   L28
    NOP
    GOTO L29
   L30
   L31
   L29
   L32
   L33
    LINENUMBER 20 L33
    ARETURN
   L34
    LOCALVARIABLE it Lkotlin/coroutines/experimental/Continuation; L10 L18 8
    LOCALVARIABLE $i$a$1$work I L10 L18 9
    LOCALVARIABLE continuation$iv Lkotlin/coroutines/experimental/Continuation; L8 L21 7
    LOCALVARIABLE $i$a$2$suspendCoroutine I L8 L21 10
    LOCALVARIABLE safe$iv$iv Lkotlin/coroutines/experimental/SafeContinuation; L7 L23 6
    LOCALVARIABLE c$iv$iv Lkotlin/coroutines/experimental/Continuation; L6 L24 5
    LOCALVARIABLE $i$a$2$suspendCoroutineOrReturn I L6 L24 11
    LOCALVARIABLE $i$f$suspendCoroutine I L5 L28 12
    LOCALVARIABLE this_$iv Ltest/InlineSuspendFail; L3 L31 3
    LOCALVARIABLE $i$f$work I L3 L31 13
    LOCALVARIABLE this Ltest/InlineSuspendFail$showFail$decoratedWork$1; L0 L34 0
    LOCALVARIABLE data Ljava/lang/Object; L0 L34 1
    LOCALVARIABLE throwable Ljava/lang/Throwable; L0 L34 2
    MAXSTACK = 5
    MAXLOCALS = 14
Cause: Error at instruction #55 INVOKESPECIAL java/lang/Thread.<init> (Ljava/lang/Runnable;)V: Expected value generated with NEW
Element is unknownThe root cause was thrown at: MethodAnalyzer.kt:150
	at org.jetbrains.kotlin.codegen.TransformationMethodVisitor.visitEnd(TransformationMethodVisitor.java:88)
	at org.jetbrains.kotlin.codegen.FunctionCodegen.endVisit(FunctionCodegen.java:996)
	... 100 more
Caused by: org.jetbrains.org.objectweb.asm.tree.analysis.AnalyzerException: Error at instruction #55 INVOKESPECIAL java/lang/Thread.<init> (Ljava/lang/Runnable;)V: Expected value generated with NEW
	at org.jetbrains.kotlin.codegen.optimization.common.MethodAnalyzer.analyze(MethodAnalyzer.kt:150)
	at org.jetbrains.kotlin.codegen.coroutines.UninitializedStoresProcessor.run(processUninitializedStores.kt:92)
	at org.jetbrains.kotlin.codegen.coroutines.CoroutineTransformerMethodVisitor.performTransformations(CoroutineTransformerMethodVisitor.kt:103)
	at org.jetbrains.kotlin.codegen.TransformationMethodVisitor.visitEnd(TransformationMethodVisitor.java:65)
	... 101 more
Caused by: java.lang.IllegalStateException: Expected value generated with NEW
	at org.jetbrains.kotlin.codegen.coroutines.UninitializedStoresProcessor.getUninitializedValueForConstructorCall(processUninitializedStores.kt:180)
	at org.jetbrains.kotlin.codegen.coroutines.UninitializedStoresProcessor.access$getUninitializedValueForConstructorCall(processUninitializedStores.kt:74)
	at org.jetbrains.kotlin.codegen.coroutines.UninitializedStoresProcessor$UninitializedNewValueFrame.execute(processUninitializedStores.kt:154)
	at org.jetbrains.kotlin.codegen.optimization.common.MethodAnalyzer.analyze(MethodAnalyzer.kt:120)
	... 104 more

Thank you! I created an issue about this, please follow it. (it might be a duplicate, but it’s hard to tell).

Thanks Alexey!

Any thoughts on this thread? That link points to the original problem I had, and when trying to reproduce with logging I then ran into the problem described here.

The other issue seems like a much bigger error, since everything appears to compile fine but the generated code is incorrect.

1 Like

Hello, I don’t see any obvious duplicates, so I created a new issue, please follow it: https://youtrack.jetbrains.com/issue/KT-26925.