[tests][FIR][checkers][Wasm] Improve test coverage for WRONG_JS_INTEROP_TYPE

This commit is contained in:
Stanislav Ruban
2024-03-10 23:02:00 +02:00
committed by Space Team
parent eaa50fbf37
commit b165ff675b
9 changed files with 945 additions and 238 deletions
@@ -0,0 +1,28 @@
// OPT_IN: kotlin.js.ExperimentalJsExport
external interface EI
external open class EC
external object EO
external fun complexFunctionTypesWithNonNullTypes(
f1: (Boolean, Byte, Short, Int, Long, Float, Double, Char, String, EI, EC, EO) -> Unit,
f2: (Boolean) -> ((Int) -> ((Float) -> ((String) -> EI))),
f3: ((((Boolean) -> Int) -> Float) -> String) -> EI,
)
external fun complexFunctionTypesWithNullableTypes(
f1: ((Boolean?, Byte?, Short?, Int?, Long?, Float?, Double?, Char?, String?, EI?, EC?, EO?) -> Unit)?,
f2: ((Boolean?) -> ((Int?) -> ((Float?) -> ((String?) -> EI)?)?)?)?,
f3: ((((((((Boolean?) -> Int?)?) -> Float?)?) -> String?)?) -> EI?)?,
)
external fun complexFunctionTypesWithWrongTypes(
<!WRONG_JS_INTEROP_TYPE!>f1: ((Any?, Byte?, Unit?, Int?, CharSequence?, Float?, IntArray?, Char?, String?, EI?, EC?, EO?) -> Unit)?<!>,
<!WRONG_JS_INTEROP_TYPE!>f2: ((Boolean?) -> ((Any?) -> ((Float?) -> ((CharSequence?) -> EI)?)?)?)?<!>,
<!WRONG_JS_INTEROP_TYPE!>f3: ((((((((Boolean?) -> Unit?)?) -> Float?)?) -> IntArray?)?) -> EI?)?<!>,
)
external fun <T> typeParameterWithUpperBoundsWithDifferentJsInteropCorrectness(arg: T): T where T : EI, T : <!WRONG_JS_INTEROP_TYPE!>Any<!>
<!WRONG_JS_INTEROP_TYPE!>fun jsCodeFunctionWithBlockBody(<!WRONG_JS_INTEROP_TYPE!>x: Any<!>): Any<!> { js("return x;") }
<!WRONG_JS_INTEROP_TYPE!>val jsCodeProperty: Any<!> = js("1")
@@ -0,0 +1,28 @@
// OPT_IN: kotlin.js.ExperimentalJsExport
external interface EI
external open class EC
external object EO
external fun complexFunctionTypesWithNonNullTypes(
f1: (Boolean, Byte, Short, Int, Long, Float, Double, Char, String, EI, EC, EO) -> Unit,
f2: (Boolean) -> ((Int) -> ((Float) -> ((String) -> EI))),
f3: ((((Boolean) -> Int) -> Float) -> String) -> EI,
)
external fun complexFunctionTypesWithNullableTypes(
f1: ((Boolean?, Byte?, Short?, Int?, Long?, Float?, Double?, Char?, String?, EI?, EC?, EO?) -> Unit)?,
f2: ((Boolean?) -> ((Int?) -> ((Float?) -> ((String?) -> EI)?)?)?)?,
f3: ((((((((Boolean?) -> Int?)?) -> Float?)?) -> String?)?) -> EI?)?,
)
external fun complexFunctionTypesWithWrongTypes(
<!WRONG_JS_INTEROP_TYPE!>f1: ((Any?, Byte?, Unit?, Int?, CharSequence?, Float?, IntArray?, Char?, String?, EI?, EC?, EO?) -> Unit)?<!>,
<!WRONG_JS_INTEROP_TYPE!>f2: ((Boolean?) -> ((Any?) -> ((Float?) -> ((CharSequence?) -> EI)?)?)?)?<!>,
<!WRONG_JS_INTEROP_TYPE!>f3: ((((((((Boolean?) -> Unit?)?) -> Float?)?) -> IntArray?)?) -> EI?)?<!>,
)
external fun <<!WRONG_JS_INTEROP_TYPE!>T<!>> typeParameterWithUpperBoundsWithDifferentJsInteropCorrectness(arg: T): T where T : EI, T : Any
<!WRONG_JS_INTEROP_TYPE!>fun jsCodeFunctionWithBlockBody(<!WRONG_JS_INTEROP_TYPE!>x: Any<!>): Any<!> { js("return x;") }
<!WRONG_JS_INTEROP_TYPE!>val jsCodeProperty: Any<!> = js("1")
@@ -0,0 +1,365 @@
// FIR_IDENTICAL
// OPT_IN: kotlin.js.ExperimentalJsExport
// OPT_IN: kotlin.ExperimentalUnsignedTypes
// DIAGNOSTICS: -FINAL_UPPER_BOUND, -UNUSED_PARAMETER
// DIAGNOSTICS: -INLINE_CLASS_IN_EXTERNAL_DECLARATION, -NON_EXPORTABLE_TYPE
external interface ExternalInterface
external open class ExternalOpenClass
external object ExternalObject
external fun correctJsInteropTypes(
// primitive types
boolean: Boolean,
char: Char,
byte: Byte,
short: Short,
int: Int,
long: Long,
float: Float,
double: Double,
// unsigned integer types
uByte: UByte,
uShort: UShort,
uInt: UInt,
uLong: ULong,
// string types
string: String,
// function types
function: () -> Unit,
// external types
externalInterface: ExternalInterface,
externalOpenClass: ExternalOpenClass,
externalObject: ExternalObject,
)
external fun correctNullableJsInteropTypes(
// primitive types
boolean: Boolean?,
char: Char?,
byte: Byte?,
short: Short?,
int: Int?,
long: Long?,
float: Float?,
double: Double?,
// unsigned integer types
uByte: UByte?,
uShort: UShort?,
uInt: UInt?,
uLong: ULong?,
// string types
string: String?,
// function types
function: (() -> Unit)?,
// external types
externalInterface: ExternalInterface?,
externalOpenClass: ExternalOpenClass?,
externalObject: ExternalObject?,
)
// correct JS interop types as return types
// Unit and Nothing
external fun unitAsReturnType(): Unit
external fun nothingAsReturnType(): Nothing
// primitive types
external fun booleanAsReturnType(): Boolean
external fun charAsReturnType(): Char
external fun byteAsReturnType(): Byte
external fun shortAsReturnType(): Short
external fun intAsReturnType(): Int
external fun longAsReturnType(): Long
external fun floatAsReturnType(): Float
external fun doubleAsReturnType(): Double
// unsigned integer types
external fun uByteAsReturnType(): UByte
external fun uShortAsReturnType(): UShort
external fun uIntAsReturnType(): UInt
external fun uLongAsReturnType(): ULong
// string types
external fun stringAsReturnType(): String
// function types
external fun functionAsReturnType(): () -> Unit
// external types
external fun externalInterfaceAsReturnType(): ExternalInterface
external fun externalOpenClassAsReturnType(): ExternalOpenClass
external fun externalObjectAsReturnType(): ExternalObject
// correct JS interop types as vararg parameter types
// primitive types
external fun booleanAsVarargParameterType(vararg args: Boolean)
external fun charAsVarargParameterType(vararg args: Char)
external fun byteAsVarargParameterType(vararg args: Byte)
external fun shortAsVarargParameterType(vararg args: Short)
external fun intAsVarargParameterType(vararg args: Int)
external fun longAsVarargParameterType(vararg args: Long)
external fun floatAsVarargParameterType(vararg args: Float)
external fun doubleAsVarargParameterType(vararg args: Double)
// unsigned integer types
external fun uByteAsVarargParameterType(vararg args: UByte)
external fun uShortAsVarargParameterType(vararg args: UShort)
external fun uIntAsVarargParameterType(vararg args: UInt)
external fun uLongAsVarargParameterType(vararg args: ULong)
// string types
external fun stringAsVarargParameterType(vararg args: String)
// function types
external fun functionAsVarargParameterType(vararg args: () -> Unit)
// external types
external fun externalInterfaceAsVarargParameterType(vararg args: ExternalInterface)
external fun externalOpenClassAsVarargParameterType(vararg args: ExternalOpenClass)
external fun externalObjectAsVarargParameterType(vararg args: ExternalObject)
external fun <
// primitive types
TBoolean: Boolean,
TChar: Char,
TByte: Byte,
TShort: Short,
TInt: Int,
TLong: Long,
TFloat: Float,
TDouble: Double,
// unsigned integer types
TUByte: UByte,
TUShort: UShort,
TUInt: UInt,
TULong: ULong,
// string types
TString: String,
// function types
TFunction: () -> Unit,
// external types
TExternalInterface: ExternalInterface,
TExternalOpenClass: ExternalOpenClass,
TExternalObject: ExternalObject,
// correct type parameter
TCorrectTypeParameter: TExternalInterface
> correctJsInteropTypesAsFunctionTypeParameterUpperBounds(
boolean: TBoolean,
char: TChar,
byte: TByte,
short: TShort,
int: TInt,
long: TLong,
float: TFloat,
double: TDouble,
uByte: TUByte,
uShort: TUShort,
uInt: TUInt,
uLong: TULong,
string: TString,
function: TFunction,
externalInterface: TExternalInterface,
externalOpenClass: TExternalOpenClass,
externalObject: TExternalObject,
correctTypeParameter: TCorrectTypeParameter
)
external class CorrectJsInteropTypesAsClassTypeParameterUpperBounds<
// primitive types
TBoolean: Boolean,
TChar: Char,
TByte: Byte,
TShort: Short,
TInt: Int,
TLong: Long,
TFloat: Float,
TDouble: Double,
// unsigned integer types
TUByte: UByte,
TUShort: UShort,
TUInt: UInt,
TULong: ULong,
// string types
TString: String,
// function types
TFunction: () -> Unit,
// external types
TExternalInterface: ExternalInterface,
TExternalOpenClass: ExternalOpenClass,
TExternalObject: ExternalObject,
// correct type parameter
TCorrectTypeParameter: TExternalInterface
>
// correct JS interop types as property types
// primitive types
external val booleanProperty: Boolean
external val charProperty: Char
external val byteProperty: Byte
external val shortProperty: Short
external val intProperty: Int
external val longProperty: Long
external val floatProperty: Float
external val doubleProperty: Double
// unsigned integer types
external val uByteProperty: UByte
external val uShortProperty: UShort
external val uIntProperty: UInt
external val uLongProperty: ULong
// string types
external val stringProperty: String
// function types
external val functionProperty: () -> Unit
// external types
external val externalInterfaceProperty: ExternalInterface
external val externalOpenClassProperty: ExternalOpenClass
external val externalObjectProperty: ExternalObject
external fun correctJsInteropTypesAsFunctionTypeParameterTypes(
primitiveTypes: (Boolean, Char, Byte, Short, Int, Long, Float, Double) -> Unit,
unsignedIntegerTypes: (UByte, UShort, UInt, ULong) -> Unit,
string: (String) -> Unit,
function: (() -> Unit) -> Unit,
externalTypes: (ExternalInterface, ExternalOpenClass, ExternalObject) -> Unit,
)
external fun correctJsInteropTypesAsFunctionTypeReturnTypes(
// Unit and Nothing
unit: () -> Unit,
nothing: () -> Nothing,
// primitive types
boolean: () -> Boolean,
char: () -> Char,
byte: () -> Byte,
short: () -> Short,
int: () -> Int,
long: () -> Long,
float: () -> Float,
double: () -> Double,
// unsigned integer types
uByte: () -> UByte,
uShort: () -> UShort,
uInt: () -> UInt,
uLong: () -> ULong,
// string types
string: () -> String,
// function types
function: () -> (() -> Unit),
// external types
externalInterface: () -> ExternalInterface,
externalOpenClass: () -> ExternalOpenClass,
externalObject: () -> ExternalObject,
)
fun correctJsInteropTypesInJsCodeFunction(
// primitive types
boolean: Boolean,
char: Char,
byte: Byte,
short: Short,
int: Int,
long: Long,
float: Float,
double: Double,
// unsigned integer types
uByte: UByte,
uShort: UShort,
uInt: UInt,
uLong: ULong,
// string types
string: String,
// function types
function: () -> Unit,
// external types
externalInterface: ExternalInterface,
externalOpenClass: ExternalOpenClass,
externalObject: ExternalObject,
): Nothing = js("42")
@JsExport
fun correctJsInteropTypesInJsExportFunction(
// primitive types
boolean: Boolean,
char: Char,
byte: Byte,
short: Short,
int: Int,
long: Long,
float: Float,
double: Double,
// unsigned integer types
uByte: UByte,
uShort: UShort,
uInt: UInt,
uLong: ULong,
// string types
string: String,
// function types
function: () -> Unit,
// external types
externalInterface: ExternalInterface,
externalOpenClass: ExternalOpenClass,
externalObject: ExternalObject,
) {}
typealias AliasedBoolean = Boolean
typealias AliasedChar = Char
typealias AliasedByte = Byte
typealias AliasedShort = Short
typealias AliasedInt = Int
typealias AliasedLong = Long
typealias AliasedFloat = Float
typealias AliasedDouble = Double
typealias AliasedUByte = UByte
typealias AliasedUShort = UShort
typealias AliasedUInt = UInt
typealias AliasedULong = ULong
typealias AliasedString = String
typealias AliasedFunction = () -> Unit
typealias AliasedExternalInterface = ExternalInterface
typealias AliasedExternalOpenClass = ExternalOpenClass
typealias AliasedExternalObject = ExternalObject
external fun aliasedCorrectJsInteropTypes(
// primitive types
boolean: AliasedBoolean,
char: AliasedChar,
byte: AliasedByte,
short: AliasedShort,
int: AliasedInt,
long: AliasedLong,
float: AliasedFloat,
double: AliasedDouble,
// unsigned integer types
uByte: AliasedUByte,
uShort: AliasedUShort,
uInt: AliasedUInt,
uLong: AliasedULong,
// string types
string: AliasedString,
// function types
function: AliasedFunction,
// external types
externalInterface: AliasedExternalInterface,
externalOpenClass: AliasedExternalOpenClass,
externalObject: AliasedExternalObject,
)
@@ -1,116 +0,0 @@
// !OPT_IN: kotlin.js.ExperimentalJsExport
external interface EI
external open class EC
external object EO
external fun supportedTypes(
boolean: Boolean,
byte: Byte,
short: Short,
int: Int,
long: Long,
float: Float,
double: Double,
char: Char,
string: String,
ei: EI,
ec: EC,
eo: EO,
f1: (Boolean, Byte, Short, Int, Long, Float, Double, Char, String, EI, EC, EO) -> Unit,
f2: (Boolean) -> ((Int) -> ((Float) -> ((String) -> EI))),
f3: ((((Boolean) -> Int) -> Float) -> String) -> EI,
): Unit
external fun supportedNullableTypes(
boolean: Boolean?,
byte: Byte?,
short: Short?,
int: Int?,
long: Long?,
float: Float?,
double: Double?,
char: Char?,
string: String?,
ei: EI?,
ec: EC?,
eo: EO?,
f1: ((Boolean?, Byte?, Short?, Int?, Long?, Float?, Double?, Char?, String?, EI?, EC?, EO?) -> Unit)?,
f2: ((Boolean?) -> ((Int?) -> ((Float?) -> ((String?) -> EI)?)?)?)?,
f3: ((((((((Boolean?) -> Int?)?) -> Float?)?) -> String?)?) -> EI?)?,
): Unit
external fun supportedReturnTypeUnit(): Unit
external fun supportedReturnTypeNothing(): Nothing
external fun supportedReturnTypeBoolean(): Boolean
external fun supportedReturnTypeNullableInt(): Int?
external fun supportedReturnTypeEI(): EI
external fun supportedReturnTypeNullableEC(): EC?
external fun <
T1 : EI,
T2 : EC?,
T3 : T1?
> supportedTypeParamtersUpperBounds(p1: T1, p2: T2): T3
external fun supportedVararg(vararg p: Int)
external fun wrongExternalTypes(
<!WRONG_JS_INTEROP_TYPE!>any: Any<!>,
<!WRONG_JS_INTEROP_TYPE!>nany: Any?<!>,
<!WRONG_JS_INTEROP_TYPE!>unit: Unit<!>,
<!WRONG_JS_INTEROP_TYPE!>nunit: Unit?<!>,
<!WRONG_JS_INTEROP_TYPE!>nothing: Nothing<!>,
<!WRONG_JS_INTEROP_TYPE!>nnothing: Nothing?<!>,
<!WRONG_JS_INTEROP_TYPE!>charSequence: CharSequence<!>,
<!WRONG_JS_INTEROP_TYPE!>list: List<Int><!>,
<!WRONG_JS_INTEROP_TYPE!>array: Array<Int><!>,
<!WRONG_JS_INTEROP_TYPE!>intArray: IntArray<!>,
<!WRONG_JS_INTEROP_TYPE!>pair: Pair<Int, Int><!>,
<!WRONG_JS_INTEROP_TYPE!>number: Number<!>,
)
external fun wrongVararg(<!WRONG_JS_INTEROP_TYPE!>vararg p: Any<!>)
external fun <T> supportedTypeParamtersUpperBounds(p: T): T where T : EI, T : <!WRONG_JS_INTEROP_TYPE!>Any<!>
external fun <
<!WRONG_JS_INTEROP_TYPE!>T1<!>,
T2 : <!WRONG_JS_INTEROP_TYPE!>Number<!>,
T3: <!WRONG_JS_INTEROP_TYPE!>List<Int><!>,
> supportedTypeParamtersUpperBounds(
p1: T1,
p2: T2
): T3
<!WRONG_JS_INTEROP_TYPE!>fun jsCode1(<!WRONG_JS_INTEROP_TYPE!>x: Any<!>): Any<!> = js("x")
<!WRONG_JS_INTEROP_TYPE!>fun jsCode2(<!WRONG_JS_INTEROP_TYPE!>x: Any<!>): Any<!> {
js("return x;")
}
<!WRONG_JS_INTEROP_TYPE!>val jsProp: Any<!> = js("1")
<!WRONG_JS_INTEROP_TYPE!>@JsExport
fun exported(<!WRONG_JS_INTEROP_TYPE!>x: Any<!>): Any<!> = x
typealias EI_alias = EI
typealias Any_alias = Any
typealias Function_alias = (Int) -> Int
external fun fooAlias(
ei: EI_alias,
<!WRONG_JS_INTEROP_TYPE!>any: Any_alias<!>,
function: Function_alias,
)
@@ -1,116 +0,0 @@
// !OPT_IN: kotlin.js.ExperimentalJsExport
external interface EI
external open class EC
external object EO
external fun supportedTypes(
boolean: Boolean,
byte: Byte,
short: Short,
int: Int,
long: Long,
float: Float,
double: Double,
char: Char,
string: String,
ei: EI,
ec: EC,
eo: EO,
f1: (Boolean, Byte, Short, Int, Long, Float, Double, Char, String, EI, EC, EO) -> Unit,
f2: (Boolean) -> ((Int) -> ((Float) -> ((String) -> EI))),
f3: ((((Boolean) -> Int) -> Float) -> String) -> EI,
): Unit
external fun supportedNullableTypes(
boolean: Boolean?,
byte: Byte?,
short: Short?,
int: Int?,
long: Long?,
float: Float?,
double: Double?,
char: Char?,
string: String?,
ei: EI?,
ec: EC?,
eo: EO?,
f1: ((Boolean?, Byte?, Short?, Int?, Long?, Float?, Double?, Char?, String?, EI?, EC?, EO?) -> Unit)?,
f2: ((Boolean?) -> ((Int?) -> ((Float?) -> ((String?) -> EI)?)?)?)?,
f3: ((((((((Boolean?) -> Int?)?) -> Float?)?) -> String?)?) -> EI?)?,
): Unit
external fun supportedReturnTypeUnit(): Unit
external fun supportedReturnTypeNothing(): Nothing
external fun supportedReturnTypeBoolean(): Boolean
external fun supportedReturnTypeNullableInt(): Int?
external fun supportedReturnTypeEI(): EI
external fun supportedReturnTypeNullableEC(): EC?
external fun <
T1 : EI,
T2 : EC?,
T3 : T1?
> supportedTypeParamtersUpperBounds(p1: T1, p2: T2): T3
external fun supportedVararg(vararg p: Int)
external fun wrongExternalTypes(
<!WRONG_JS_INTEROP_TYPE!>any: Any<!>,
<!WRONG_JS_INTEROP_TYPE!>nany: Any?<!>,
<!WRONG_JS_INTEROP_TYPE!>unit: Unit<!>,
<!WRONG_JS_INTEROP_TYPE!>nunit: Unit?<!>,
<!WRONG_JS_INTEROP_TYPE!>nothing: Nothing<!>,
<!WRONG_JS_INTEROP_TYPE!>nnothing: Nothing?<!>,
<!WRONG_JS_INTEROP_TYPE!>charSequence: CharSequence<!>,
<!WRONG_JS_INTEROP_TYPE!>list: List<Int><!>,
<!WRONG_JS_INTEROP_TYPE!>array: Array<Int><!>,
<!WRONG_JS_INTEROP_TYPE!>intArray: IntArray<!>,
<!WRONG_JS_INTEROP_TYPE!>pair: Pair<Int, Int><!>,
<!WRONG_JS_INTEROP_TYPE!>number: Number<!>,
)
external fun wrongVararg(<!WRONG_JS_INTEROP_TYPE!>vararg p: Any<!>)
external fun <<!WRONG_JS_INTEROP_TYPE!>T<!>> supportedTypeParamtersUpperBounds(p: T): T where T : EI, T : Any
external fun <
<!WRONG_JS_INTEROP_TYPE!>T1<!>,
<!WRONG_JS_INTEROP_TYPE!>T2 : Number<!>,
<!WRONG_JS_INTEROP_TYPE!>T3: List<Int><!>,
> supportedTypeParamtersUpperBounds(
p1: T1,
p2: T2
): T3
<!WRONG_JS_INTEROP_TYPE!>fun jsCode1(<!WRONG_JS_INTEROP_TYPE!>x: Any<!>): Any<!> = js("x")
<!WRONG_JS_INTEROP_TYPE!>fun jsCode2(<!WRONG_JS_INTEROP_TYPE!>x: Any<!>): Any<!> {
js("return x;")
}
<!WRONG_JS_INTEROP_TYPE!>val jsProp: Any<!> = js("1")
<!WRONG_JS_INTEROP_TYPE!>@JsExport
fun exported(<!WRONG_JS_INTEROP_TYPE!>x: Any<!>): Any<!> = x
typealias EI_alias = EI
typealias Any_alias = Any
typealias Function_alias = (Int) -> Int
external fun fooAlias(
ei: EI_alias,
<!WRONG_JS_INTEROP_TYPE!>any: Any_alias<!>,
function: Function_alias,
)
@@ -0,0 +1,247 @@
// OPT_IN: kotlin.js.ExperimentalJsExport
// DIAGNOSTICS: -FINAL_UPPER_BOUND, -UNUSED_PARAMETER
// DIAGNOSTICS: -NON_EXPORTABLE_TYPE
interface UserDefinedInterface
open class UserDefinedOpenClass
object UserDefinedObject
external fun wrongJsInteropTypes(
// Unit and Nothing
<!WRONG_JS_INTEROP_TYPE!>unit: Unit<!>,
<!WRONG_JS_INTEROP_TYPE!>nothing: Nothing<!>,
// built-in types
<!WRONG_JS_INTEROP_TYPE!>any: Any<!>,
<!WRONG_JS_INTEROP_TYPE!>number: Number<!>,
<!WRONG_JS_INTEROP_TYPE!>charSequence: CharSequence<!>,
<!WRONG_JS_INTEROP_TYPE!>specializedArray: IntArray<!>,
<!WRONG_JS_INTEROP_TYPE!>pair: Pair<Int, Int><!>,
<!WRONG_JS_INTEROP_TYPE!>list: List<Int><!>,
<!WRONG_JS_INTEROP_TYPE!>genericArray: Array<Int><!>,
// user-defined types
<!WRONG_JS_INTEROP_TYPE!>userDefinedInterface: UserDefinedInterface<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedOpenClass: UserDefinedOpenClass<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedObject: UserDefinedObject<!>,
)
external fun wrongNullableJsInteropTypes(
// Unit and Nothing
<!WRONG_JS_INTEROP_TYPE!>unit: Unit?<!>,
<!WRONG_JS_INTEROP_TYPE!>nothing: Nothing?<!>,
// built-in types
<!WRONG_JS_INTEROP_TYPE!>any: Any?<!>,
<!WRONG_JS_INTEROP_TYPE!>number: Number?<!>,
<!WRONG_JS_INTEROP_TYPE!>charSequence: CharSequence?<!>,
<!WRONG_JS_INTEROP_TYPE!>specializedArray: IntArray?<!>,
<!WRONG_JS_INTEROP_TYPE!>pair: Pair<Int, Int>?<!>,
<!WRONG_JS_INTEROP_TYPE!>list: List<Int>?<!>,
<!WRONG_JS_INTEROP_TYPE!>genericArray: Array<Int>?<!>,
// user-defined types
<!WRONG_JS_INTEROP_TYPE!>userDefinedInterface: UserDefinedInterface?<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedOpenClass: UserDefinedOpenClass?<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedObject: UserDefinedObject?<!>,
)
// wrong JS interop types as return types
// built-in types
<!WRONG_JS_INTEROP_TYPE!>external fun anyAsReturnType(): Any<!>
<!WRONG_JS_INTEROP_TYPE!>external fun numberAsReturnType(): Number<!>
<!WRONG_JS_INTEROP_TYPE!>external fun charSequenceAsReturnType(): CharSequence<!>
<!WRONG_JS_INTEROP_TYPE!>external fun specializedArrayAsReturnType(): IntArray<!>
<!WRONG_JS_INTEROP_TYPE!>external fun pairAsReturnType(): Pair<Int, Int><!>
<!WRONG_JS_INTEROP_TYPE!>external fun listAsReturnType(): List<Int><!>
<!WRONG_JS_INTEROP_TYPE!>external fun genericArrayAsReturnType(): Array<Int><!>
// user-defined types
<!WRONG_JS_INTEROP_TYPE!>external fun userDefinedInterfaceAsReturnType(): UserDefinedInterface<!>
<!WRONG_JS_INTEROP_TYPE!>external fun userDefinedOpenClassAsReturnType(): UserDefinedOpenClass<!>
<!WRONG_JS_INTEROP_TYPE!>external fun userDefinedObjectAsReturnType(): UserDefinedObject<!>
// wrong JS interop types as vararg parameter types
// Unit (Nothing is not allowed in vararg parameters)
external fun unitAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: Unit<!>)
// built-in types
external fun anyAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: Any<!>)
external fun numberAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: Number<!>)
external fun charSequenceAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: CharSequence<!>)
external fun specializedArrayAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: IntArray<!>)
external fun pairAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: Pair<Int, Int><!>)
external fun listAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: List<Int><!>)
external fun genericArrayAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: Array<Int><!>)
// user-defined types
external fun userDefinedInterfaceAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: UserDefinedInterface<!>)
external fun userDefinedOpenClassAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: UserDefinedOpenClass<!>)
external fun userDefinedObjectAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: UserDefinedObject<!>)
external fun <
// Unit (Nothing as an upper bound results in an empty intersection type)
TUnit: <!WRONG_JS_INTEROP_TYPE!>Unit<!>,
// built-in types
TAny: <!WRONG_JS_INTEROP_TYPE!>Any<!>,
TNumber: <!WRONG_JS_INTEROP_TYPE!>Number<!>,
TCharSequence: <!WRONG_JS_INTEROP_TYPE!>CharSequence<!>,
TSpecializedArray: <!WRONG_JS_INTEROP_TYPE!>IntArray<!>,
TPair: <!WRONG_JS_INTEROP_TYPE!>Pair<Int, Int><!>,
TList: <!WRONG_JS_INTEROP_TYPE!>List<Int><!>,
TGenericArray: <!WRONG_JS_INTEROP_TYPE!>Array<Int><!>,
// user-defined types
TUserDefinedInterface: <!WRONG_JS_INTEROP_TYPE!>UserDefinedInterface<!>,
TUserDefinedOpenClass: <!WRONG_JS_INTEROP_TYPE!>UserDefinedOpenClass<!>,
TUserDefinedObject: <!WRONG_JS_INTEROP_TYPE!>UserDefinedObject<!>,
// type parameter with implicit upper bound
<!WRONG_JS_INTEROP_TYPE!>TTypeParameterWithImplicitUpperBound<!>
> wrongJsInteropTypesAsFunctionTypeParameterUpperBounds(
unit: TUnit,
any: TAny,
number: TNumber,
charSequence: TCharSequence,
specializedArray: TSpecializedArray,
pair: TPair,
list: TList,
genericArray: TGenericArray,
userDefinedInterface: TUserDefinedInterface,
userDefinedOpenClass: TUserDefinedOpenClass,
userDefinedObject: TUserDefinedObject,
typeParameterWithImplicitUpperBound: TTypeParameterWithImplicitUpperBound
)
external class WrongJsInteropTypesAsClassTypeParameterUpperBounds<
// Unit (Nothing as an upper bound results in an empty intersection type)
TUnit: <!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>Unit<!>,
// built-in types
TAny: <!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>Any<!>,
TNumber: <!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>Number<!>,
TCharSequence: <!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>CharSequence<!>,
TSpecializedArray: <!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>IntArray<!>,
TPair: <!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>Pair<Int, Int><!>,
TList: <!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>List<Int><!>,
TGenericArray: <!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>Array<Int><!>,
// user-defined types
TUserDefinedInterface: <!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>UserDefinedInterface<!>,
TUserDefinedOpenClass: <!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>UserDefinedOpenClass<!>,
TUserDefinedObject: <!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>UserDefinedObject<!>,
// type parameter with implicit upper bound
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>TTypeParameterWithImplicitUpperBound<!>
>
// wrong JS interop types as property types
// Unit and Nothing
<!WRONG_JS_INTEROP_TYPE!>external val unitProperty: Unit<!>
<!WRONG_JS_INTEROP_TYPE!>external val nothingProperty: Nothing<!>
// built-in types
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val anyProperty: Any<!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val numberProperty: Number<!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val charSequenceProperty: CharSequence<!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val specializedArrayProperty: IntArray<!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val pairProperty: Pair<Int, Int><!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val listProperty: List<Int><!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val genericArrayProperty: Array<Int><!>
// user-defined types
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val userDefinedInterfaceProperty: UserDefinedInterface<!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val userDefinedOpenClassProperty: UserDefinedOpenClass<!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val userDefinedObjectProperty: UserDefinedObject<!>
external fun wrongJsInteropTypesAsFunctionTypeParameterTypes(
<!WRONG_JS_INTEROP_TYPE!>unitAndNothing: (Unit, Nothing) -> Unit<!>,
<!WRONG_JS_INTEROP_TYPE!>builtInTypes: (Any, Number, CharSequence, IntArray, Pair<Int, Int>, List<Int>, Array<Int>) -> Unit<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedTypes: (UserDefinedInterface, UserDefinedOpenClass, UserDefinedObject) -> Unit<!>,
)
external fun wrongJsInteropTypesAsFunctionTypeReturnTypes(
// built-in types
<!WRONG_JS_INTEROP_TYPE!>any: () -> Any<!>,
<!WRONG_JS_INTEROP_TYPE!>number: () -> Number<!>,
<!WRONG_JS_INTEROP_TYPE!>charSequence: () -> CharSequence<!>,
<!WRONG_JS_INTEROP_TYPE!>specializedArray: () -> IntArray<!>,
<!WRONG_JS_INTEROP_TYPE!>pair: () -> Pair<Int, Int><!>,
<!WRONG_JS_INTEROP_TYPE!>list: () -> List<Int><!>,
<!WRONG_JS_INTEROP_TYPE!>genericArray: () -> Array<Int><!>,
// user-defined types
<!WRONG_JS_INTEROP_TYPE!>userDefinedInterface: () -> UserDefinedInterface<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedOpenClass: () -> UserDefinedOpenClass<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedObject: () -> UserDefinedObject<!>,
)
fun wrongJsInteropTypesInJsCodeFunction(
// Unit and Nothing
<!WRONG_JS_INTEROP_TYPE!>unit: Unit<!>,
<!WRONG_JS_INTEROP_TYPE!>nothing: Nothing<!>,
// built-in types
<!WRONG_JS_INTEROP_TYPE!>any: Any<!>,
<!WRONG_JS_INTEROP_TYPE!>number: Number<!>,
<!WRONG_JS_INTEROP_TYPE!>charSequence: CharSequence<!>,
<!WRONG_JS_INTEROP_TYPE!>specializedArray: IntArray<!>,
<!WRONG_JS_INTEROP_TYPE!>pair: Pair<Int, Int><!>,
<!WRONG_JS_INTEROP_TYPE!>list: List<Int><!>,
<!WRONG_JS_INTEROP_TYPE!>genericArray: Array<Int><!>,
// user-defined types
<!WRONG_JS_INTEROP_TYPE!>userDefinedInterface: UserDefinedInterface<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedOpenClass: UserDefinedOpenClass<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedObject: UserDefinedObject<!>,
): Nothing = js("42")
@JsExport
fun wrongJsInteropTypesInJsExportFunction(
// Unit and Nothing
<!WRONG_JS_INTEROP_TYPE!>unit: Unit<!>,
<!WRONG_JS_INTEROP_TYPE!>nothing: Nothing<!>,
// built-in types
<!WRONG_JS_INTEROP_TYPE!>any: Any<!>,
<!WRONG_JS_INTEROP_TYPE!>number: Number<!>,
<!WRONG_JS_INTEROP_TYPE!>charSequence: CharSequence<!>,
<!WRONG_JS_INTEROP_TYPE!>specializedArray: IntArray<!>,
<!WRONG_JS_INTEROP_TYPE!>pair: Pair<Int, Int><!>,
<!WRONG_JS_INTEROP_TYPE!>list: List<Int><!>,
<!WRONG_JS_INTEROP_TYPE!>genericArray: Array<Int><!>,
// user-defined types
<!WRONG_JS_INTEROP_TYPE!>userDefinedInterface: UserDefinedInterface<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedOpenClass: UserDefinedOpenClass<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedObject: UserDefinedObject<!>,
) {}
typealias AliasedUnit = Unit
typealias AliasedNothing = Nothing
typealias AliasedAny = Any
typealias AliasedNumber = Number
typealias AliasedCharSequence = CharSequence
typealias AliasedSpecializedArray = IntArray
typealias AliasedPair = Pair<Int, Int>
typealias AliasedList = List<Int>
typealias AliasedGenericArray = Array<Int>
typealias AliasedUserDefinedInterface = UserDefinedInterface
typealias AliasedUserDefinedOpenClass = UserDefinedOpenClass
typealias AliasedUserDefinedObject = UserDefinedObject
external fun aliasedWrongJsInteropTypes(
// Unit and Nothing
<!WRONG_JS_INTEROP_TYPE!>unit: AliasedUnit<!>,
<!WRONG_JS_INTEROP_TYPE!>nothing: AliasedNothing<!>,
// built-in types
<!WRONG_JS_INTEROP_TYPE!>any: AliasedAny<!>,
<!WRONG_JS_INTEROP_TYPE!>number: AliasedNumber<!>,
<!WRONG_JS_INTEROP_TYPE!>charSequence: AliasedCharSequence<!>,
<!WRONG_JS_INTEROP_TYPE!>specializedArray: AliasedSpecializedArray<!>,
<!WRONG_JS_INTEROP_TYPE!>pair: AliasedPair<!>,
<!WRONG_JS_INTEROP_TYPE!>list: AliasedList<!>,
<!WRONG_JS_INTEROP_TYPE!>genericArray: AliasedGenericArray<!>,
// user-defined types
<!WRONG_JS_INTEROP_TYPE!>userDefinedInterface: AliasedUserDefinedInterface<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedOpenClass: AliasedUserDefinedOpenClass<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedObject: AliasedUserDefinedObject<!>,
)
@@ -0,0 +1,247 @@
// OPT_IN: kotlin.js.ExperimentalJsExport
// DIAGNOSTICS: -FINAL_UPPER_BOUND, -UNUSED_PARAMETER
// DIAGNOSTICS: -NON_EXPORTABLE_TYPE
interface UserDefinedInterface
open class UserDefinedOpenClass
object UserDefinedObject
external fun wrongJsInteropTypes(
// Unit and Nothing
<!WRONG_JS_INTEROP_TYPE!>unit: Unit<!>,
<!WRONG_JS_INTEROP_TYPE!>nothing: Nothing<!>,
// built-in types
<!WRONG_JS_INTEROP_TYPE!>any: Any<!>,
<!WRONG_JS_INTEROP_TYPE!>number: Number<!>,
<!WRONG_JS_INTEROP_TYPE!>charSequence: CharSequence<!>,
<!WRONG_JS_INTEROP_TYPE!>specializedArray: IntArray<!>,
<!WRONG_JS_INTEROP_TYPE!>pair: Pair<Int, Int><!>,
<!WRONG_JS_INTEROP_TYPE!>list: List<Int><!>,
<!WRONG_JS_INTEROP_TYPE!>genericArray: Array<Int><!>,
// user-defined types
<!WRONG_JS_INTEROP_TYPE!>userDefinedInterface: UserDefinedInterface<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedOpenClass: UserDefinedOpenClass<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedObject: UserDefinedObject<!>,
)
external fun wrongNullableJsInteropTypes(
// Unit and Nothing
<!WRONG_JS_INTEROP_TYPE!>unit: Unit?<!>,
<!WRONG_JS_INTEROP_TYPE!>nothing: Nothing?<!>,
// built-in types
<!WRONG_JS_INTEROP_TYPE!>any: Any?<!>,
<!WRONG_JS_INTEROP_TYPE!>number: Number?<!>,
<!WRONG_JS_INTEROP_TYPE!>charSequence: CharSequence?<!>,
<!WRONG_JS_INTEROP_TYPE!>specializedArray: IntArray?<!>,
<!WRONG_JS_INTEROP_TYPE!>pair: Pair<Int, Int>?<!>,
<!WRONG_JS_INTEROP_TYPE!>list: List<Int>?<!>,
<!WRONG_JS_INTEROP_TYPE!>genericArray: Array<Int>?<!>,
// user-defined types
<!WRONG_JS_INTEROP_TYPE!>userDefinedInterface: UserDefinedInterface?<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedOpenClass: UserDefinedOpenClass?<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedObject: UserDefinedObject?<!>,
)
// wrong JS interop types as return types
// built-in types
<!WRONG_JS_INTEROP_TYPE!>external fun anyAsReturnType(): Any<!>
<!WRONG_JS_INTEROP_TYPE!>external fun numberAsReturnType(): Number<!>
<!WRONG_JS_INTEROP_TYPE!>external fun charSequenceAsReturnType(): CharSequence<!>
<!WRONG_JS_INTEROP_TYPE!>external fun specializedArrayAsReturnType(): IntArray<!>
<!WRONG_JS_INTEROP_TYPE!>external fun pairAsReturnType(): Pair<Int, Int><!>
<!WRONG_JS_INTEROP_TYPE!>external fun listAsReturnType(): List<Int><!>
<!WRONG_JS_INTEROP_TYPE!>external fun genericArrayAsReturnType(): Array<Int><!>
// user-defined types
<!WRONG_JS_INTEROP_TYPE!>external fun userDefinedInterfaceAsReturnType(): UserDefinedInterface<!>
<!WRONG_JS_INTEROP_TYPE!>external fun userDefinedOpenClassAsReturnType(): UserDefinedOpenClass<!>
<!WRONG_JS_INTEROP_TYPE!>external fun userDefinedObjectAsReturnType(): UserDefinedObject<!>
// wrong JS interop types as vararg parameter types
// Unit (Nothing is not allowed in vararg parameters)
external fun unitAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: Unit<!>)
// built-in types
external fun anyAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: Any<!>)
external fun numberAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: Number<!>)
external fun charSequenceAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: CharSequence<!>)
external fun specializedArrayAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: IntArray<!>)
external fun pairAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: Pair<Int, Int><!>)
external fun listAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: List<Int><!>)
external fun genericArrayAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: Array<Int><!>)
// user-defined types
external fun userDefinedInterfaceAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: UserDefinedInterface<!>)
external fun userDefinedOpenClassAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: UserDefinedOpenClass<!>)
external fun userDefinedObjectAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: UserDefinedObject<!>)
external fun <
// Unit (Nothing as an upper bound results in an empty intersection type)
<!WRONG_JS_INTEROP_TYPE!>TUnit: Unit<!>,
// built-in types
<!WRONG_JS_INTEROP_TYPE!>TAny: Any<!>,
<!WRONG_JS_INTEROP_TYPE!>TNumber: Number<!>,
<!WRONG_JS_INTEROP_TYPE!>TCharSequence: CharSequence<!>,
<!WRONG_JS_INTEROP_TYPE!>TSpecializedArray: IntArray<!>,
<!WRONG_JS_INTEROP_TYPE!>TPair: Pair<Int, Int><!>,
<!WRONG_JS_INTEROP_TYPE!>TList: List<Int><!>,
<!WRONG_JS_INTEROP_TYPE!>TGenericArray: Array<Int><!>,
// user-defined types
<!WRONG_JS_INTEROP_TYPE!>TUserDefinedInterface: UserDefinedInterface<!>,
<!WRONG_JS_INTEROP_TYPE!>TUserDefinedOpenClass: UserDefinedOpenClass<!>,
<!WRONG_JS_INTEROP_TYPE!>TUserDefinedObject: UserDefinedObject<!>,
// type parameter with implicit upper bound
<!WRONG_JS_INTEROP_TYPE!>TTypeParameterWithImplicitUpperBound<!>
> wrongJsInteropTypesAsFunctionTypeParameterUpperBounds(
unit: TUnit,
any: TAny,
number: TNumber,
charSequence: TCharSequence,
specializedArray: TSpecializedArray,
pair: TPair,
list: TList,
genericArray: TGenericArray,
userDefinedInterface: TUserDefinedInterface,
userDefinedOpenClass: TUserDefinedOpenClass,
userDefinedObject: TUserDefinedObject,
typeParameterWithImplicitUpperBound: TTypeParameterWithImplicitUpperBound
)
external class WrongJsInteropTypesAsClassTypeParameterUpperBounds<
// Unit (Nothing as an upper bound results in an empty intersection type)
<!WRONG_JS_INTEROP_TYPE!>TUnit: Unit<!>,
// built-in types
<!WRONG_JS_INTEROP_TYPE!>TAny: Any<!>,
<!WRONG_JS_INTEROP_TYPE!>TNumber: Number<!>,
<!WRONG_JS_INTEROP_TYPE!>TCharSequence: CharSequence<!>,
<!WRONG_JS_INTEROP_TYPE!>TSpecializedArray: IntArray<!>,
<!WRONG_JS_INTEROP_TYPE!>TPair: Pair<Int, Int><!>,
<!WRONG_JS_INTEROP_TYPE!>TList: List<Int><!>,
<!WRONG_JS_INTEROP_TYPE!>TGenericArray: Array<Int><!>,
// user-defined types
<!WRONG_JS_INTEROP_TYPE!>TUserDefinedInterface: UserDefinedInterface<!>,
<!WRONG_JS_INTEROP_TYPE!>TUserDefinedOpenClass: UserDefinedOpenClass<!>,
<!WRONG_JS_INTEROP_TYPE!>TUserDefinedObject: UserDefinedObject<!>,
// type parameter with implicit upper bound
<!WRONG_JS_INTEROP_TYPE!>TTypeParameterWithImplicitUpperBound<!>
>
// wrong JS interop types as property types
// Unit and Nothing
<!WRONG_JS_INTEROP_TYPE!>external val unitProperty: Unit<!>
<!WRONG_JS_INTEROP_TYPE!>external val nothingProperty: Nothing<!>
// built-in types
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val anyProperty: Any<!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val numberProperty: Number<!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val charSequenceProperty: CharSequence<!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val specializedArrayProperty: IntArray<!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val pairProperty: Pair<Int, Int><!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val listProperty: List<Int><!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val genericArrayProperty: Array<Int><!>
// user-defined types
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val userDefinedInterfaceProperty: UserDefinedInterface<!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val userDefinedOpenClassProperty: UserDefinedOpenClass<!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val userDefinedObjectProperty: UserDefinedObject<!>
external fun wrongJsInteropTypesAsFunctionTypeParameterTypes(
<!WRONG_JS_INTEROP_TYPE!>unitAndNothing: (Unit, Nothing) -> Unit<!>,
<!WRONG_JS_INTEROP_TYPE!>builtInTypes: (Any, Number, CharSequence, IntArray, Pair<Int, Int>, List<Int>, Array<Int>) -> Unit<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedTypes: (UserDefinedInterface, UserDefinedOpenClass, UserDefinedObject) -> Unit<!>,
)
external fun wrongJsInteropTypesAsFunctionTypeReturnTypes(
// built-in types
<!WRONG_JS_INTEROP_TYPE!>any: () -> Any<!>,
<!WRONG_JS_INTEROP_TYPE!>number: () -> Number<!>,
<!WRONG_JS_INTEROP_TYPE!>charSequence: () -> CharSequence<!>,
<!WRONG_JS_INTEROP_TYPE!>specializedArray: () -> IntArray<!>,
<!WRONG_JS_INTEROP_TYPE!>pair: () -> Pair<Int, Int><!>,
<!WRONG_JS_INTEROP_TYPE!>list: () -> List<Int><!>,
<!WRONG_JS_INTEROP_TYPE!>genericArray: () -> Array<Int><!>,
// user-defined types
<!WRONG_JS_INTEROP_TYPE!>userDefinedInterface: () -> UserDefinedInterface<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedOpenClass: () -> UserDefinedOpenClass<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedObject: () -> UserDefinedObject<!>,
)
fun wrongJsInteropTypesInJsCodeFunction(
// Unit and Nothing
<!WRONG_JS_INTEROP_TYPE!>unit: Unit<!>,
<!WRONG_JS_INTEROP_TYPE!>nothing: Nothing<!>,
// built-in types
<!WRONG_JS_INTEROP_TYPE!>any: Any<!>,
<!WRONG_JS_INTEROP_TYPE!>number: Number<!>,
<!WRONG_JS_INTEROP_TYPE!>charSequence: CharSequence<!>,
<!WRONG_JS_INTEROP_TYPE!>specializedArray: IntArray<!>,
<!WRONG_JS_INTEROP_TYPE!>pair: Pair<Int, Int><!>,
<!WRONG_JS_INTEROP_TYPE!>list: List<Int><!>,
<!WRONG_JS_INTEROP_TYPE!>genericArray: Array<Int><!>,
// user-defined types
<!WRONG_JS_INTEROP_TYPE!>userDefinedInterface: UserDefinedInterface<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedOpenClass: UserDefinedOpenClass<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedObject: UserDefinedObject<!>,
): Nothing = js("42")
@JsExport
fun wrongJsInteropTypesInJsExportFunction(
// Unit and Nothing
<!WRONG_JS_INTEROP_TYPE!>unit: Unit<!>,
<!WRONG_JS_INTEROP_TYPE!>nothing: Nothing<!>,
// built-in types
<!WRONG_JS_INTEROP_TYPE!>any: Any<!>,
<!WRONG_JS_INTEROP_TYPE!>number: Number<!>,
<!WRONG_JS_INTEROP_TYPE!>charSequence: CharSequence<!>,
<!WRONG_JS_INTEROP_TYPE!>specializedArray: IntArray<!>,
<!WRONG_JS_INTEROP_TYPE!>pair: Pair<Int, Int><!>,
<!WRONG_JS_INTEROP_TYPE!>list: List<Int><!>,
<!WRONG_JS_INTEROP_TYPE!>genericArray: Array<Int><!>,
// user-defined types
<!WRONG_JS_INTEROP_TYPE!>userDefinedInterface: UserDefinedInterface<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedOpenClass: UserDefinedOpenClass<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedObject: UserDefinedObject<!>,
) {}
typealias AliasedUnit = Unit
typealias AliasedNothing = Nothing
typealias AliasedAny = Any
typealias AliasedNumber = Number
typealias AliasedCharSequence = CharSequence
typealias AliasedSpecializedArray = IntArray
typealias AliasedPair = Pair<Int, Int>
typealias AliasedList = List<Int>
typealias AliasedGenericArray = Array<Int>
typealias AliasedUserDefinedInterface = UserDefinedInterface
typealias AliasedUserDefinedOpenClass = UserDefinedOpenClass
typealias AliasedUserDefinedObject = UserDefinedObject
external fun aliasedWrongJsInteropTypes(
// Unit and Nothing
<!WRONG_JS_INTEROP_TYPE!>unit: AliasedUnit<!>,
<!WRONG_JS_INTEROP_TYPE!>nothing: AliasedNothing<!>,
// built-in types
<!WRONG_JS_INTEROP_TYPE!>any: AliasedAny<!>,
<!WRONG_JS_INTEROP_TYPE!>number: AliasedNumber<!>,
<!WRONG_JS_INTEROP_TYPE!>charSequence: AliasedCharSequence<!>,
<!WRONG_JS_INTEROP_TYPE!>specializedArray: AliasedSpecializedArray<!>,
<!WRONG_JS_INTEROP_TYPE!>pair: AliasedPair<!>,
<!WRONG_JS_INTEROP_TYPE!>list: AliasedList<!>,
<!WRONG_JS_INTEROP_TYPE!>genericArray: AliasedGenericArray<!>,
// user-defined types
<!WRONG_JS_INTEROP_TYPE!>userDefinedInterface: AliasedUserDefinedInterface<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedOpenClass: AliasedUserDefinedOpenClass<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedObject: AliasedUserDefinedObject<!>,
)
@@ -51,6 +51,18 @@ public class DiagnosticsFirWasmTestGenerated extends AbstractDiagnosticsFirWasmT
runTest("compiler/testData/diagnostics/wasmTests/jsInterop/body.kt");
}
@Test
@TestMetadata("complexCasesWithJsInteropTypes.kt")
public void testComplexCasesWithJsInteropTypes() {
runTest("compiler/testData/diagnostics/wasmTests/jsInterop/complexCasesWithJsInteropTypes.kt");
}
@Test
@TestMetadata("correctJsInteropTypes.kt")
public void testCorrectJsInteropTypes() {
runTest("compiler/testData/diagnostics/wasmTests/jsInterop/correctJsInteropTypes.kt");
}
@Test
@TestMetadata("definedExternally.kt")
public void testDefinedExternally() {
@@ -124,9 +136,9 @@ public class DiagnosticsFirWasmTestGenerated extends AbstractDiagnosticsFirWasmT
}
@Test
@TestMetadata("types.kt")
public void testTypes() {
runTest("compiler/testData/diagnostics/wasmTests/jsInterop/types.kt");
@TestMetadata("wrongJsInteropTypes.kt")
public void testWrongJsInteropTypes() {
runTest("compiler/testData/diagnostics/wasmTests/jsInterop/wrongJsInteropTypes.kt");
}
@Test
@@ -51,6 +51,18 @@ public class DiagnosticsWasmTestGenerated extends AbstractDiagnosticsWasmTest {
runTest("compiler/testData/diagnostics/wasmTests/jsInterop/body.kt");
}
@Test
@TestMetadata("complexCasesWithJsInteropTypes.kt")
public void testComplexCasesWithJsInteropTypes() {
runTest("compiler/testData/diagnostics/wasmTests/jsInterop/complexCasesWithJsInteropTypes.kt");
}
@Test
@TestMetadata("correctJsInteropTypes.kt")
public void testCorrectJsInteropTypes() {
runTest("compiler/testData/diagnostics/wasmTests/jsInterop/correctJsInteropTypes.kt");
}
@Test
@TestMetadata("definedExternally.kt")
public void testDefinedExternally() {
@@ -124,9 +136,9 @@ public class DiagnosticsWasmTestGenerated extends AbstractDiagnosticsWasmTest {
}
@Test
@TestMetadata("types.kt")
public void testTypes() {
runTest("compiler/testData/diagnostics/wasmTests/jsInterop/types.kt");
@TestMetadata("wrongJsInteropTypes.kt")
public void testWrongJsInteropTypes() {
runTest("compiler/testData/diagnostics/wasmTests/jsInterop/wrongJsInteropTypes.kt");
}
@Test