class A {
  val a: Any?
    field = a
    get

  constructor(a: Any?) /* primary */ {
    super/*Any*/()
    /* <init>() */

  }

}

class Context {
  constructor() /* primary */ {
    super/*Any*/()
    /* <init>() */

  }

  fun c(): Int {
    return 1
  }

}

fun box(): String {
  return with<Context, Nothing>(receiver = Context(), block = local fun Context.<anonymous>(): Nothing {
    var result: Int = 0
    result = result.plus(other = testInline(/* $context_receiver_0 = $this$with */))
    result = result.plus(other = testInlineWithArg(/* $context_receiver_0 = $this$with, */ i = 1))
    result = result.plus(other = testInlineWithExtensionAndArg(/* $context_receiver_0 = $this$with, <this> = 1, */ i = 1))
    result = result.plus(other = testInlineWithExtensionAndMultipleArgs(/* $context_receiver_0 = $this$with, <this> = 1, */ i1 = 1, i2 = 2))
    with<A, Unit>(receiver = A(a = 1), block = local fun A.<anonymous>() {
      result = result.plus(other = testInlineWithExtensionAndMultipleContextsAndArgs(/* $context_receiver_0 = $this$with, $context_receiver_1 = $this$with, <this> = 1, */ i1 = 1, i2 = 2))
      result = result.plus(other = testInlineWithExtensionAndMultipleContextsAndArgs(/* $context_receiver_0 = $this$with, $context_receiver_1 = $this$with, <this> = 1 */))
    }
)
    return when {
      EQEQ(arg0 = result, arg1 = 23) -> "OK"
      else -> "fail"
    }
  }
)
}

context($context_receiver_0: Context)
inline fun testInline(): Int {
  return $context_receiver_0.c()
}

context($context_receiver_0: Context)
inline fun testInlineWithArg(i: Int): Int {
  return i.plus(other = $context_receiver_0.c())
}

context($context_receiver_0: Context)
inline fun Int.testInlineWithExtensionAndArg(i: Int): Int {
  return <this>.plus(other = i).plus(other = $context_receiver_0.c())
}

context($context_receiver_0: Context)
inline fun Int.testInlineWithExtensionAndMultipleArgs(i1: Int, i2: Int): Int {
  return <this>.plus(other = i1).plus(other = i2).plus(other = $context_receiver_0.c())
}

context($context_receiver_0: Context, $context_receiver_1: A)
inline fun Int.testInlineWithExtensionAndMultipleContextsAndArgs(i1: Int = 1, i2: Int = 2): Int {
  return <this>.plus(other = i1).plus(other = i2).plus(other = $context_receiver_0.c()).plus(other = when {
    EQEQ(arg0 = $context_receiver_1.<get-a>(), arg1 = null) -> 0
    else -> 1
  })
}

