fun interface IFoo {
  abstract fun foo(i: Int)

}

fun interface IFoo2 : IFoo {

}

object A {
  private constructor() /* primary */ {
    super/*Any*/()
    /* <init>() */

  }

}

object B {
  private constructor() /* primary */ {
    super/*Any*/()
    /* <init>() */

  }

}

operator fun A.get(i: IFoo): Int {
  return 1
}

operator fun A.set(i: IFoo, newValue: Int) {
}

operator fun B.get(i: IFoo): Int {
  return 1
}

operator fun B.set(i: IFoo2, newValue: Int) {
}

fun withVararg(vararg xs: Int): Int {
  return 42
}

fun test1() {
  { // BLOCK
    val tmp_0: A = A
    val tmp_1: IFoo = { // BLOCK
      local fun withVararg(p0: Int) {
        withVararg(xs = [p0]) /*~> Unit */
      }

      ::withVararg
    } /*-> IFoo */
    tmp_0.set(i = tmp_1, newValue = tmp_0.get(i = tmp_1).plus(other = 1))
  }
}

fun test2() {
  { // BLOCK
    val tmp_2: B = B
    val tmp_3: IFoo2 = { // BLOCK
      local fun withVararg(p0: Int) {
        withVararg(xs = [p0]) /*~> Unit */
      }

      ::withVararg
    } /*-> IFoo2 */
    tmp_2.set(i = tmp_3, newValue = tmp_2.get(i = tmp_3).plus(other = 1))
  }
}

fun test3(fn: Function1<Int, Unit>) {
  { // BLOCK
    val tmp_4: A = A
    val tmp_5: IFoo = fn /*-> IFoo */
    tmp_4.set(i = tmp_5, newValue = tmp_4.get(i = tmp_5).plus(other = 1))
  }
}

fun test4(fn: Function1<Int, Unit>) {
  when {
    fn is IFoo -> { // BLOCK
      { // BLOCK
        val tmp_6: A = A
        val tmp_7: Function1<Int, Unit> = fn
        tmp_6.set(i = tmp_7 /*as IFoo */, newValue = tmp_6.get(i = tmp_7 /*as IFoo */).plus(other = 1))
      }
    }
  }
}

fun test5(a: Any) {
  a as Function1<Int, Unit> /*~> Unit */
  { // BLOCK
    val tmp_8: A = A
    val tmp_9: IFoo = a /*as Function1<Int, Unit> */ /*-> IFoo */
    tmp_8.set(i = tmp_9, newValue = tmp_8.get(i = tmp_9).plus(other = 1))
  }
}

fun test6(a: Any) {
  a as Function1<Int, Unit> /*~> Unit */
  a as IFoo /*~> Unit */
  { // BLOCK
    val tmp_10: A = A
    val tmp_11: Any = a
    tmp_10.set(i = tmp_11 /*as IFoo */, newValue = tmp_10.get(i = tmp_11 /*as IFoo */).plus(other = 1))
  }
}
