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, @EnhancedNullability String>? = notNullComponents()
  val x: @EnhancedNullability String = <destruct>.component1() /*!! String */
  val y: @EnhancedNullability String = <destruct>.component2() /*!! String */
  use(x = x, y = y)
}

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

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

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

