fun use(s: P) {
}

fun testForInListUnused() {
  { // BLOCK
    val <iterator>: MutableIterator<@EnhancedNullability P> = listOfNotNull().iterator()
    while (<iterator>.hasNext()) { // BLOCK
      val x: P = <iterator>.next() /*!! P */
      { // BLOCK
      }
    }
  }
}

fun testForInListDestructured() {
  { // BLOCK
    val <iterator>: MutableIterator<@EnhancedNullability P> = listOfNotNull().iterator()
    while (<iterator>.hasNext()) { // BLOCK
      val <destruct>: P = <iterator>.next() /*!! P */
      val x: Int = <destruct>.component1()
      val y: Int = <destruct>.component2()
      { // BLOCK
      }
    }
  }
}

fun testDesugaredForInList() {
  val iterator: MutableIterator<@EnhancedNullability P> = listOfNotNull().iterator()
  while (iterator.hasNext()) { // BLOCK
    val x: P = iterator.next() /*!! P */
  }
}

fun testForInArrayUnused(j: J) {
  { // BLOCK
    val <iterator>: Iterator<@EnhancedNullability P> = j.arrayOfNotNull().iterator()
    while (<iterator>.hasNext()) { // BLOCK
      val x: P = <iterator>.next() /*!! P */
      { // BLOCK
      }
    }
  }
}

fun testForInListUse() {
  { // BLOCK
    val <iterator>: MutableIterator<@EnhancedNullability P> = listOfNotNull().iterator()
    while (<iterator>.hasNext()) { // BLOCK
      val x: P = <iterator>.next() /*!! P */
      { // BLOCK
        use(s = x)
        use(s = x)
      }
    }
  }
}

fun testForInArrayUse(j: J) {
  { // BLOCK
    val <iterator>: Iterator<@EnhancedNullability P> = j.arrayOfNotNull().iterator()
    while (<iterator>.hasNext()) { // BLOCK
      val x: P = <iterator>.next() /*!! P */
      { // BLOCK
        use(s = x)
        use(s = x)
      }
    }
  }
}

interface K {
  abstract fun arrayOfNotNull(): Array<P>

}

data 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>.#x
  }

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

  fun copy(x: Int = <this>.#x, y: Int = <this>.#y): P {
    return P(x = x, y = y)
  }

  override fun equals(other: Any?): Boolean {
    when {
      EQEQEQ(arg0 = <this>, arg1 = other) -> return true
    }
    when {
      other !is P -> return false
    }
    val tmp0_other_with_cast: P = other as P
    when {
      EQEQ(arg0 = <this>.#x, arg1 = tmp0_other_with_cast.#x).not() -> return false
    }
    when {
      EQEQ(arg0 = <this>.#y, arg1 = tmp0_other_with_cast.#y).not() -> return false
    }
    return true
  }

  override fun hashCode(): Int {
    var result: Int = <this>.#x.hashCode()
    result = result.times(other = 31).plus(other = <this>.#y.hashCode())
    return result
  }

  override fun toString(): String {
    return "P(" + "x=" + <this>.#x + ", " + "y=" + <this>.#y + ")"
  }

}

