// Generated from "typewildcards/TypeWildCards.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 typewildcards

import javaemul.lang.*
import kotlin.Any
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmField
import kotlin.jvm.JvmStatic

fun interface Function<I, O> {
 fun apply(i: I): O
}

interface List<I>

open class GenericType<T> internal constructor() {
 internal open fun get_pp_typewildcards(): T {
  return null as T
 }
}

open class Bar internal constructor()

open class RecursiveType<T: RecursiveType<T>?> {
 constructor(wildcardParameter: RecursiveType<*>?)
}

interface DeepRecursiveType<T: GenericType<in T>?>

open class RecursiveSubtype: RecursiveType<RecursiveSubtype?> {
 constructor(wildcardParameter: RecursiveType<*>?): super(wildcardParameter)
}

open class TypeWildCards {
 open fun unbounded(g: GenericType<*>?): Any? {
  return g!!.get_pp_typewildcards()
 }

 open fun upperBound(g: GenericType<out Bar?>?): Bar? {
  return g!!.get_pp_typewildcards()
 }

 open fun lowerBound(g: GenericType<in Bar?>?): Any? {
  return g!!.get_pp_typewildcards()
 }

 open fun unboundedRecursive(g: RecursiveType<*>?) {}

 open fun upperBoundRecursive(g: GenericType<out RecursiveType<*>?>?) {}

 open fun lowerBoundRecursive(g: GenericType<in RecursiveType<*>?>?) {}

 open fun deepRecursiveType(t: DeepRecursiveType<*>?) {}

 open fun test() {
  this.unbounded(
   GenericType<Bar?>(),
  )
  this.upperBound(
   GenericType<Bar?>(),
  )
  this.lowerBound(
   GenericType<Bar?>(),
  )
 }

 open fun testInferredGenericIntersection() {
  val elements: List<TypeWildCards.Element?>? = null
  val otherElements: List<TypeWildCards.SubOtherElement?>? = null
  val integers: List<Int?>? = TypeWildCards.transform(
   TypeWildCards.concat(elements, otherElements),
   Function { a ->
    a!!.getKey()
    return@Function a!!.get()
   },
  )
 }

 open fun testRecursiveGeneric() {
  TypeWildCards.takesRecursiveGeneric(
   Foo(),
  )
 }

 companion object {
  @JvmStatic
  fun <T: typewildcards.TypeWildCards.A?> testBoundedTypeMemberAccess(t: T) {
   val i: Int = t!!.f_pp_typewildcards
   t!!.m()
  }

  @JvmStatic
  fun <T> testIntersectionBoundedTypeMemberAccess(t: T) where T: typewildcards.TypeWildCards.A?, T: Y? {
   val i: Int = t!!.f_pp_typewildcards
   t!!.m()
   t!!.n()
  }

  @JvmStatic
  private fun <F, V> transform(from: List<F>?, function: Function<in F, out V>?): List<V>? {
   return null
  }

  @JvmStatic
  private fun <E> concat(a: List<out E>?, b: List<out E>?): List<E>? {
   return null
  }

  @JvmStatic
  private fun takesRecursiveGeneric(foo: GenericType<TypeWildCards.Foo?>?) {}

  @JvmStatic
  fun <C> testInferredIntersectionWithTypeVariable(ri: RecursiveInterface<out C, C>?): C {
   return ri!!.m()
  }

  @JvmStatic
  internal fun <D> createMultipleGenerics_pp_typewildcards(foo: List<D>?): MultipleGenerics<D, String?, List<D>?>? {
   return MultipleGenerics<D, String?, List<D>?>()
  }

  @JvmField
  internal var listWithWildcard_pp_typewildcards: List<*>? = null

  @JvmField
  internal var valMultipleGenerics_pp_typewildcards: MultipleGenerics<*, String?, *>? = TypeWildCards.createMultipleGenerics_pp_typewildcards(
   TypeWildCards.listWithWildcard_pp_typewildcards,
  )
 }

 fun interface X {
  fun m()
 }

 fun interface Y {
  fun n()
 }

 open class A internal constructor(): X {
  @JvmField
  internal var f_pp_typewildcards: Int = 0

  override fun m() {}
 }

 fun interface IntegerSupplier {
  fun get(): Int?
 }

 fun interface HasKey {
  fun getKey(): String?
 }

 abstract inner class Element: HasKey, IntegerSupplier

 abstract inner class OtherElement: IntegerSupplier, HasKey

 abstract inner class SubOtherElement: TypeWildCards.OtherElement(), HasKey

 open inner class Foo internal constructor(): GenericType<TypeWildCards.Foo?>()

 fun interface RecursiveInterface<T: RecursiveInterface<T, C>?, C> {
  fun m(): T
 }

 open class MultipleGenerics<A, B, C> internal constructor()
}
