interface K {

}

interface I : K {
  abstract fun ff()

}

interface J : K {

}

class A : I, J {
  constructor() /* primary */ {
    super/*Any*/()
    /* <init>() */

  }

  override fun ff() {
  }

}

class B : I, J {
  constructor() /* primary */ {
    super/*Any*/()
    /* <init>() */

  }

  override fun ff() {
  }

}

fun testIntersection(a: A, b: B) {
  val v: I = when {
    true -> a
    else -> b
  }
  v.ff()
}

fun testFlexible1() {
  val v: I? = when {
    true -> a()
    else -> b()
  }
  v.ff()
}

fun testFlexible2(a: A, b: B) {
  val v: I? = when {
    true -> id<@FlexibleNullability A?>(x = a)
    else -> id<@FlexibleNullability B?>(x = b)
  }
  v.ff()
}
