fun use(x: Any, y: Any) {
}

class P {
  constructor(x: Int, y: Int) /* primary */ {
    super/*Any*/()
    /* <init>() */

  }

  val x: Int
    field = x
    get

  val y: Int
    field = y
    get

  operator fun component1(): Int {
    return <this>.<get-x>()
  }

  operator fun component2(): Int {
    return <this>.<get-y>()
  }

}

class Q<T1 : Any?, T2 : Any?> {
  constructor(x: T1, y: T2) /* primary */ {
    super/*Any*/()
    /* <init>() */

  }

  val x: T1
    field = x
    get

  val y: T2
    field = y
    get

  operator fun component1(): T1 {
    return <this>.<get-x>()
  }

  operator fun component2(): T2 {
    return <this>.<get-y>()
  }

}

fun test1() {
  val <destruct>: P = notNullP() /*!! P */
  val x: Int = <destruct>.component1()
  val y: Int = <destruct>.component2()
  use(x = x, y = y)
}

fun test2() {
  val <destruct>: @FlexibleNullability Q<@EnhancedNullability String, @FlexibleNullability String?>? = notNullComponents()
  val x: String = <destruct>.component1() /*!! String */
  val y: @FlexibleNullability String? = <destruct>.component2()
  use(x = x, y = y /*!! @FlexibleNullability String */)
}

fun test2Desugared() {
  val tmp: @FlexibleNullability Q<@EnhancedNullability String, @FlexibleNullability String?>? = notNullComponents()
  val x: String = tmp.component1() /*!! String */
  val y: @FlexibleNullability String? = tmp.component2()
  use(x = x, y = y /*!! @FlexibleNullability String */)
}

fun test3() {
  val <destruct>: Q<@EnhancedNullability String, @FlexibleNullability String?> = notNullQAndComponents() /*!! Q<@EnhancedNullability String, @FlexibleNullability String?> */
  val x: String = <destruct>.component1() /*!! String */
  val y: @FlexibleNullability String? = <destruct>.component2()
  use(x = x, y = y /*!! @FlexibleNullability String */)
}

fun test4() {
  val <destruct>: IndexedValue<@FlexibleNullability P?> = listOfNotNull() /*!! @FlexibleNullability List<@FlexibleNullability P?> */.withIndex<@FlexibleNullability P?>().first<IndexedValue<@FlexibleNullability P?>>()
  val x: Int = <destruct>.component1()
  val y: @FlexibleNullability P? = <destruct>.component2()
  use(x = x, y = y /*!! @FlexibleNullability P */)
}

