open class A {
  constructor() /* primary */ {
    super/*Any*/()
    /* <init>() */

  }

  fun f(): Int {
    return 1
  }

  val aVal: Int
    field = 42
    get

  fun testA1(x: Any): Int? {
    return when {
      x is B -> x /*as B */.f()
      else -> null
    }
  }

  fun testA2(x: Any): Int? {
    return when {
      x is B -> x /*as B */.<get-aVal>()
      else -> null
    }
  }

}

class B : A {
  constructor() /* primary */ {
    super/*A*/()
    /* <init>() */

  }

  fun testB1(x: Any): Int? {
    return when {
      x is B -> x /*as B */.f()
      else -> null
    }
  }

  fun testB2(x: Any): Int? {
    return when {
      x is B -> x /*as B */.<get-aVal>()
      else -> null
    }
  }

}

open class GA<T : Any?> {
  constructor() /* primary */ {
    super/*Any*/()
    /* <init>() */

  }

  fun f(): Int {
    return 1
  }

  val aVal: Int
    field = 42
    get

}

class GB<T : Any?, S : Any?> : GA<T> {
  constructor() /* primary */ {
    super/*GA*/<T>()
    /* <init>() */

  }

  fun testGB1(a: Any) {
    a as GB<Int, String> /*~> Unit */
    a /*as GB<Int, String> */.f() /*~> Unit */
    a /*as GB<Int, String> */.<get-aVal>() /*~> Unit */
  }

}
