// Generated from "instanceofexpression/InstanceofExpressions.java"
@file:Suppress(
 "ALWAYS_NULL",
 "PARAMETER_NAME_CHANGED_ON_OVERRIDE",
 "SENSELESS_COMPARISON",
 "UNCHECKED_CAST",
 "UNNECESSARY_LATEINIT",
 "UNNECESSARY_NOT_NULL_ASSERTION",
 "UNREACHABLE_CODE",
 "UNUSED_ANONYMOUS_PARAMETER",
 "UNUSED_PARAMETER",
 "UNUSED_VARIABLE",
 "USELESS_CAST",
 "VARIABLE_IN_SINGLETON_WITHOUT_THREAD_LOCAL",
 "VARIABLE_WITH_REDUNDANT_INITIALIZER",
 "REDUNDANT_ELSE_IN_WHEN")

package instanceofexpression

import javaemul.lang.*
import java.io.Serializable
import kotlin.Any
import kotlin.Array
import kotlin.Boolean
import kotlin.BooleanArray
import kotlin.Byte
import kotlin.ByteArray
import kotlin.Char
import kotlin.CharArray
import kotlin.Double
import kotlin.DoubleArray
import kotlin.Float
import kotlin.FloatArray
import kotlin.Int
import kotlin.IntArray
import kotlin.Long
import kotlin.LongArray
import kotlin.Number
import kotlin.Short
import kotlin.ShortArray
import kotlin.String
import kotlin.Suppress
import kotlin.arrayOfNulls
import kotlin.run

open class InstanceofExpressions {
 open fun testInstanceofClass() {
  val `object`: Any = InstanceofExpressions()
  var b: Boolean = false
  b = `object` is Any
  b = `object` is InstanceofExpressions
  b = `object` is String
 }

 open fun testInstanceofInterface() {
  val o: Any = Any()
  var b: Boolean = false
  b = o is Serializable
  b = object : Serializable {} is Serializable
 }

 open fun testInstanceofBoxedType() {
  val b: Any = Int(1)
  var a: Boolean = b is Byte
  a = b is Double
  a = b is Float
  a = b is Int
  a = b is Long
  a = b is Short
  a = b is Number
  a = b is Char
  a = b is Boolean
  val d: Double? = null
  a = d is Any
  a = d is Number
  a = d is Double
 }

 open fun testInstanceOfArray() {
  val `object`: Any = Any()
  val objectArray: Array<Any?> = arrayOfNulls<Any>(0)
  val objectDoubleArray: Array<Array<Any?>?> = arrayOfNulls<Array<Any?>>(0)
  val stringArray: Array<String?> = arrayOfNulls<String>(0)
  var a: Boolean = false
  a = `object` is Array<*>
  a = `object` is Array<*>
  a = `object` is Array<*>
  a = `object` is Array<*>
  a = objectArray is Array<*>
  a = objectArray is Array<*>
  a = objectArray is Array<*>
  a = objectArray is Array<*>
  a = objectDoubleArray is Array<*>
  a = objectDoubleArray is Array<*>
  a = objectDoubleArray is Array<*>
  a = stringArray is Array<*>
  a = stringArray is Array<*>
  a = `object` is ByteArray
  a = `object` is ShortArray
  a = `object` is IntArray
  a = `object` is LongArray
  a = `object` is FloatArray
  a = `object` is DoubleArray
  a = `object` is CharArray
  a = `object` is BooleanArray
 }

 open fun testPrecedence() {
  val b: Boolean = (if (false) "foo" else "bar") is String
 }

 private fun testPatternMatch() {
  var exp: Any? = null
  var s: String? = null
  var exp_1: Any? = null
  var i: Int? = null
  var exp_2: Any? = null
  var n: Number? = null
  if (!run {
   exp = Any()
   s = if (exp is String) exp as String? else null
   s != null
  } || s!!.length == 2) {
   return
  }
  if (run {
   exp_1 = Any()
   i = if (exp_1 is Int) exp_1 as Int? else null
   i != null
  } && i!!.toInt() == 2) {
   val l: Int = i!!.toInt()
  }
  if (!run {
   exp_2 = Any()
   n = if (exp_2 is Number) exp_2 as Number? else null
   n != null
  }) {
   val j: Int = s!!.length
  } else {
   val k: Int = n!!.toByte().toInt()
  }
 }
}
