[FIR][checkers][Wasm] Refine WRONG_JS_INTEROP_TYPE reporting

This commit improves four aspects of WRONG_JS_INTEROP_TYPE error reporting:
1) more precise source code ranges are preferred when possible (e.g. value parameter type instead of the entire value parameter, explicit return type instead of the entire declaration, etc.)
2) only relevant parameter and return types of function types are reported as wrong (to prevent confusion with the "function types are supported" part of the error message)
3) WRONG_JS_INTEROP_TYPE errors are now deduplicated in cases where more than one such error was previously reported because of compiler-generated declarations
4) error messages were slightly proofread and contain slightly more information now
This commit is contained in:
Stanislav Ruban
2024-03-11 00:00:15 +02:00
committed by Space Team
parent a65ea2ce02
commit 4dd0a25eca
4 changed files with 193 additions and 215 deletions
@@ -57,7 +57,7 @@ object FirWasmErrorsDefaultMessages : BaseDiagnosticRendererFactory() {
map.put(CALL_TO_DEFINED_EXTERNALLY_FROM_NON_EXTERNAL_DECLARATION, "This property can only be used from external declarations.") map.put(CALL_TO_DEFINED_EXTERNALLY_FROM_NON_EXTERNAL_DECLARATION, "This property can only be used from external declarations.")
map.put( map.put(
WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE,
"Type ''{0}'' cannot be used in {1}. Only external, primitive, string and function types are supported in Kotlin/Wasm JS interop.", "Type ''{0}'' cannot be used as {1}. Only external, primitive, string, and function types are supported in Kotlin/Wasm JS interop.",
FirDiagnosticRenderers.RENDER_TYPE, TO_STRING FirDiagnosticRenderers.RENDER_TYPE, TO_STRING
) )
map.put( map.put(
@@ -5,10 +5,11 @@
package org.jetbrains.kotlin.fir.analysis.wasm.checkers.declaration package org.jetbrains.kotlin.fir.analysis.wasm.checkers.declaration
import org.jetbrains.kotlin.KtFakeSourceElement
import org.jetbrains.kotlin.KtSourceElement import org.jetbrains.kotlin.KtSourceElement
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
import org.jetbrains.kotlin.diagnostics.reportOn import org.jetbrains.kotlin.diagnostics.reportOn
import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.FirFunctionTypeParameter
import org.jetbrains.kotlin.fir.analysis.checkers.MppCheckerKind import org.jetbrains.kotlin.fir.analysis.checkers.MppCheckerKind
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
import org.jetbrains.kotlin.fir.analysis.checkers.declaration.FirBasicDeclarationChecker import org.jetbrains.kotlin.fir.analysis.checkers.declaration.FirBasicDeclarationChecker
@@ -17,7 +18,6 @@ import org.jetbrains.kotlin.fir.analysis.wasm.checkers.hasValidJsCodeBody
import org.jetbrains.kotlin.fir.analysis.wasm.checkers.isJsExportedDeclaration import org.jetbrains.kotlin.fir.analysis.wasm.checkers.isJsExportedDeclaration
import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.declarations.utils.isEffectivelyExternal import org.jetbrains.kotlin.fir.declarations.utils.isEffectivelyExternal
import org.jetbrains.kotlin.fir.declarations.utils.isEnumClass
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.*
import org.jetbrains.kotlin.name.WasmStandardClassIds import org.jetbrains.kotlin.name.WasmStandardClassIds
@@ -46,114 +46,92 @@ object FirWasmJsInteropTypesChecker : FirBasicDeclarationChecker(MppCheckerKind.
return return
} }
// Skip enums to avoid reporting errors for synthetic static members with unsupported interop types. // filter out compiler-generated declarations (data/enum methods, property accessors, primary constructors, etc.) to prevent
// External enums errors are reported in a separate checker. // 1) reporting excessive diagnostics
if (context.containingDeclarations.any { it is FirClass && it.isEnumClass }) { // (e.g. on generated methods of external enum classes (which are handled by another checker))
return // 2) reporting duplicate diagnostics
// (e.g. on properties with generated accessors and type parameters of classes with generated primary constructors)
if (declaration.source is KtFakeSourceElement) return
fun ConeKotlinType.isSupportedInJsInterop(position: Position): Boolean {
if (isUnit || isNothing) {
// Unit and Nothing are supported in return type positions and unsupported in other type positions
return position == Position.RETURN_TYPE || position == Position.FUNCTION_TYPE_RETURN_TYPE
}
// primitive types, unsigned types, and String are supported (regardless of nullability)
if (isPrimitiveOrNullablePrimitive) return true
if (isUnsignedTypeOrNullableUnsignedType) return true
if (isString || isNullableString) return true
// type parameters' upper bounds should be checked separately on declaration-site
if (this is ConeTypeParameterType) return true
// function types themselves are supported
// (and their parameter and return types should be checked separately)
if (isBasicFunctionType(session)) return true
// aside from the aforementioned cases, only external types are supported
return toRegularClassSymbol(session)?.isEffectivelyExternal(session) == true
} }
fun ConeKotlinType.checkJsInteropType( fun FirTypeRef.checkSupportInJsInterop(position: Position, fallbackSource: KtSourceElement?) {
typePositionDescription: String, val type = coneType.let {
source: KtSourceElement?, val unexpandedType = if (position == Position.VARARG_VALUE_PARAMETER_TYPE) it.varargElementType() else it
isInFunctionReturnPosition: Boolean = false, unexpandedType.fullyExpandedType(session)
) { }
if (!isTypeSupportedInJsInterop(this, isInFunctionReturnPosition, session)) {
if (!type.isSupportedInJsInterop(position)) {
reporter.reportOn( reporter.reportOn(
source, source ?: fallbackSource,
FirWasmErrors.WRONG_JS_INTEROP_TYPE, FirWasmErrors.WRONG_JS_INTEROP_TYPE,
this, type,
typePositionDescription, position.description,
context context
) )
return
}
// although function types themselves are supported, their parameter and return types should be checked separately
val functionTypeRef = (this as? FirResolvedTypeRef)?.delegatedTypeRef as? FirFunctionTypeRef ?: return
with(functionTypeRef) {
parameters.map(FirFunctionTypeParameter::returnTypeRef).forEach { parameterTypeRef ->
parameterTypeRef.checkSupportInJsInterop(Position.FUNCTION_TYPE_PARAMETER_TYPE, fallbackSource = functionTypeRef.source)
}
returnTypeRef.checkSupportInJsInterop(Position.FUNCTION_TYPE_RETURN_TYPE, fallbackSource = functionTypeRef.source)
} }
} }
fun FirTypeParameterRef.checkJsInteropTypeParameter() { if (declaration is FirTypeParameterRefsOwner) {
for (upperBound in this.symbol.resolvedBounds) {
upperBound.type.checkJsInteropType(
"JS interop type parameter upper bound",
upperBound.source ?: this.source
)
}
}
if (declaration is FirMemberDeclaration) {
for (typeParameter in declaration.typeParameters) { for (typeParameter in declaration.typeParameters) {
typeParameter.checkJsInteropTypeParameter() for (upperBound in typeParameter.symbol.resolvedBounds) {
upperBound.checkSupportInJsInterop(Position.TYPE_PARAMETER_UPPER_BOUND, fallbackSource = typeParameter.source)
}
} }
} }
when (declaration) { when (declaration) {
is FirProperty -> { is FirProperty -> {
declaration.returnTypeRef.coneType.checkJsInteropType( declaration.returnTypeRef.checkSupportInJsInterop(Position.PROPERTY_TYPE, fallbackSource = declaration.source)
"JS interop property",
declaration.source
)
} }
is FirFunction -> { is FirFunction -> {
for (parameter in declaration.valueParameters) { for (valueParameter in declaration.valueParameters) {
val type = parameter.returnTypeRef.coneType val position = if (valueParameter.isVararg) Position.VARARG_VALUE_PARAMETER_TYPE else Position.VALUE_PARAMETER_TYPE
val varargElementTypeOrType = if (parameter.isVararg) type.varargElementType() else type valueParameter.returnTypeRef.checkSupportInJsInterop(position, fallbackSource = valueParameter.source)
varargElementTypeOrType.checkJsInteropType(
"JS interop function parameter",
parameter.source
)
} }
declaration.returnTypeRef.coneType.checkJsInteropType( declaration.returnTypeRef.checkSupportInJsInterop(Position.RETURN_TYPE, fallbackSource = declaration.source)
"JS interop function return",
declaration.source,
isInFunctionReturnPosition = true
)
} }
else -> {} else -> Unit
} }
} }
}
private enum class Position(val description: String) {
private fun isTypeSupportedInJsInterop( TYPE_PARAMETER_UPPER_BOUND("upper bound of JS interop type parameter"),
unexpandedType: ConeKotlinType, PROPERTY_TYPE("type of JS interop property"),
isInFunctionReturnPosition: Boolean, VALUE_PARAMETER_TYPE("value parameter type of JS interop function"),
session: FirSession, VARARG_VALUE_PARAMETER_TYPE("value parameter type of JS interop function"),
): Boolean { RETURN_TYPE("return type of JS interop function"),
val type = unexpandedType.fullyExpandedType(session) FUNCTION_TYPE_PARAMETER_TYPE("parameter type of JS interop function type"),
FUNCTION_TYPE_RETURN_TYPE("return type of JS interop function type"),
if (type.isUnit || type.isNothing) { }
return isInFunctionReturnPosition
}
val nonNullable = type.withNullability(ConeNullability.NOT_NULL, session.typeContext)
if (nonNullable.isPrimitive || nonNullable.isUnsignedType || nonNullable.isString) {
return true
}
// Interop type parameters upper bounds should be checked
// on declaration site separately
if (nonNullable is ConeTypeParameterType) {
return true
}
val regularClassSymbol = nonNullable.toRegularClassSymbol(session)
if (regularClassSymbol?.isEffectivelyExternal(session) == true) {
return true
}
if (type.isBasicFunctionType(session)) {
val arguments = type.typeArguments
for (i in 0 until arguments.lastIndex) {
val argType = arguments[i].type ?: return false
if (!isTypeSupportedInJsInterop(argType, isInFunctionReturnPosition = false, session)) {
return false
}
}
val returnType = arguments.last().type ?: return false
return isTypeSupportedInJsInterop(
returnType,
isInFunctionReturnPosition = true,
session
)
}
return false
} }
@@ -17,12 +17,12 @@ external fun complexFunctionTypesWithNullableTypes(
) )
external fun complexFunctionTypesWithWrongTypes( external fun complexFunctionTypesWithWrongTypes(
<!WRONG_JS_INTEROP_TYPE!>f1: ((Any?, Byte?, Unit?, Int?, CharSequence?, Float?, IntArray?, Char?, String?, EI?, EC?, EO?) -> Unit)?<!>, f1: ((<!WRONG_JS_INTEROP_TYPE!>Any?<!>, Byte?, <!WRONG_JS_INTEROP_TYPE!>Unit?<!>, Int?, <!WRONG_JS_INTEROP_TYPE!>CharSequence?<!>, Float?, <!WRONG_JS_INTEROP_TYPE!>IntArray?<!>, Char?, String?, EI?, EC?, EO?) -> Unit)?,
<!WRONG_JS_INTEROP_TYPE!>f2: ((Boolean?) -> ((Any?) -> ((Float?) -> ((CharSequence?) -> EI)?)?)?)?<!>, f2: ((Boolean?) -> ((<!WRONG_JS_INTEROP_TYPE!>Any?<!>) -> ((Float?) -> ((<!WRONG_JS_INTEROP_TYPE!>CharSequence?<!>) -> EI)?)?)?)?,
<!WRONG_JS_INTEROP_TYPE!>f3: ((((((((Boolean?) -> Unit?)?) -> Float?)?) -> IntArray?)?) -> EI?)?<!>, f3: ((((((((Boolean?) -> <!WRONG_JS_INTEROP_TYPE!>Unit?<!>)?) -> Float?)?) -> <!WRONG_JS_INTEROP_TYPE!>IntArray?<!>)?) -> EI?)?,
) )
external fun <T> typeParameterWithUpperBoundsWithDifferentJsInteropCorrectness(arg: T): T where T : EI, T : <!WRONG_JS_INTEROP_TYPE!>Any<!> 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;") } fun jsCodeFunctionWithBlockBody(x: <!WRONG_JS_INTEROP_TYPE!>Any<!>): <!WRONG_JS_INTEROP_TYPE!>Any<!> { js("return x;") }
<!WRONG_JS_INTEROP_TYPE!>val jsCodeProperty: Any<!> = js("1") val jsCodeProperty: <!WRONG_JS_INTEROP_TYPE!>Any<!> = js("1")
@@ -9,76 +9,76 @@ object UserDefinedObject
external fun wrongJsInteropTypes( external fun wrongJsInteropTypes(
// Unit and Nothing // Unit and Nothing
<!WRONG_JS_INTEROP_TYPE!>unit: Unit<!>, unit: <!WRONG_JS_INTEROP_TYPE!>Unit<!>,
<!WRONG_JS_INTEROP_TYPE!>nothing: Nothing<!>, nothing: <!WRONG_JS_INTEROP_TYPE!>Nothing<!>,
// built-in types // built-in types
<!WRONG_JS_INTEROP_TYPE!>any: Any<!>, any: <!WRONG_JS_INTEROP_TYPE!>Any<!>,
<!WRONG_JS_INTEROP_TYPE!>number: Number<!>, number: <!WRONG_JS_INTEROP_TYPE!>Number<!>,
<!WRONG_JS_INTEROP_TYPE!>charSequence: CharSequence<!>, charSequence: <!WRONG_JS_INTEROP_TYPE!>CharSequence<!>,
<!WRONG_JS_INTEROP_TYPE!>specializedArray: IntArray<!>, specializedArray: <!WRONG_JS_INTEROP_TYPE!>IntArray<!>,
<!WRONG_JS_INTEROP_TYPE!>pair: Pair<Int, Int><!>, pair: <!WRONG_JS_INTEROP_TYPE!>Pair<Int, Int><!>,
<!WRONG_JS_INTEROP_TYPE!>list: List<Int><!>, list: <!WRONG_JS_INTEROP_TYPE!>List<Int><!>,
<!WRONG_JS_INTEROP_TYPE!>genericArray: Array<Int><!>, genericArray: <!WRONG_JS_INTEROP_TYPE!>Array<Int><!>,
// user-defined types // user-defined types
<!WRONG_JS_INTEROP_TYPE!>userDefinedInterface: UserDefinedInterface<!>, userDefinedInterface: <!WRONG_JS_INTEROP_TYPE!>UserDefinedInterface<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedOpenClass: UserDefinedOpenClass<!>, userDefinedOpenClass: <!WRONG_JS_INTEROP_TYPE!>UserDefinedOpenClass<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedObject: UserDefinedObject<!>, userDefinedObject: <!WRONG_JS_INTEROP_TYPE!>UserDefinedObject<!>,
) )
external fun wrongNullableJsInteropTypes( external fun wrongNullableJsInteropTypes(
// Unit and Nothing // Unit and Nothing
<!WRONG_JS_INTEROP_TYPE!>unit: Unit?<!>, unit: <!WRONG_JS_INTEROP_TYPE!>Unit?<!>,
<!WRONG_JS_INTEROP_TYPE!>nothing: Nothing?<!>, nothing: <!WRONG_JS_INTEROP_TYPE!>Nothing?<!>,
// built-in types // built-in types
<!WRONG_JS_INTEROP_TYPE!>any: Any?<!>, any: <!WRONG_JS_INTEROP_TYPE!>Any?<!>,
<!WRONG_JS_INTEROP_TYPE!>number: Number?<!>, number: <!WRONG_JS_INTEROP_TYPE!>Number?<!>,
<!WRONG_JS_INTEROP_TYPE!>charSequence: CharSequence?<!>, charSequence: <!WRONG_JS_INTEROP_TYPE!>CharSequence?<!>,
<!WRONG_JS_INTEROP_TYPE!>specializedArray: IntArray?<!>, specializedArray: <!WRONG_JS_INTEROP_TYPE!>IntArray?<!>,
<!WRONG_JS_INTEROP_TYPE!>pair: Pair<Int, Int>?<!>, pair: <!WRONG_JS_INTEROP_TYPE!>Pair<Int, Int>?<!>,
<!WRONG_JS_INTEROP_TYPE!>list: List<Int>?<!>, list: <!WRONG_JS_INTEROP_TYPE!>List<Int>?<!>,
<!WRONG_JS_INTEROP_TYPE!>genericArray: Array<Int>?<!>, genericArray: <!WRONG_JS_INTEROP_TYPE!>Array<Int>?<!>,
// user-defined types // user-defined types
<!WRONG_JS_INTEROP_TYPE!>userDefinedInterface: UserDefinedInterface?<!>, userDefinedInterface: <!WRONG_JS_INTEROP_TYPE!>UserDefinedInterface?<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedOpenClass: UserDefinedOpenClass?<!>, userDefinedOpenClass: <!WRONG_JS_INTEROP_TYPE!>UserDefinedOpenClass?<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedObject: UserDefinedObject?<!>, userDefinedObject: <!WRONG_JS_INTEROP_TYPE!>UserDefinedObject?<!>,
) )
// wrong JS interop types as return types // wrong JS interop types as return types
// built-in types // built-in types
<!WRONG_JS_INTEROP_TYPE!>external fun anyAsReturnType(): Any<!> external fun anyAsReturnType(): <!WRONG_JS_INTEROP_TYPE!>Any<!>
<!WRONG_JS_INTEROP_TYPE!>external fun numberAsReturnType(): Number<!> external fun numberAsReturnType(): <!WRONG_JS_INTEROP_TYPE!>Number<!>
<!WRONG_JS_INTEROP_TYPE!>external fun charSequenceAsReturnType(): CharSequence<!> external fun charSequenceAsReturnType(): <!WRONG_JS_INTEROP_TYPE!>CharSequence<!>
<!WRONG_JS_INTEROP_TYPE!>external fun specializedArrayAsReturnType(): IntArray<!> external fun specializedArrayAsReturnType(): <!WRONG_JS_INTEROP_TYPE!>IntArray<!>
<!WRONG_JS_INTEROP_TYPE!>external fun pairAsReturnType(): Pair<Int, Int><!> external fun pairAsReturnType(): <!WRONG_JS_INTEROP_TYPE!>Pair<Int, Int><!>
<!WRONG_JS_INTEROP_TYPE!>external fun listAsReturnType(): List<Int><!> external fun listAsReturnType(): <!WRONG_JS_INTEROP_TYPE!>List<Int><!>
<!WRONG_JS_INTEROP_TYPE!>external fun genericArrayAsReturnType(): Array<Int><!> external fun genericArrayAsReturnType(): <!WRONG_JS_INTEROP_TYPE!>Array<Int><!>
// user-defined types // user-defined types
<!WRONG_JS_INTEROP_TYPE!>external fun userDefinedInterfaceAsReturnType(): UserDefinedInterface<!> external fun userDefinedInterfaceAsReturnType(): <!WRONG_JS_INTEROP_TYPE!>UserDefinedInterface<!>
<!WRONG_JS_INTEROP_TYPE!>external fun userDefinedOpenClassAsReturnType(): UserDefinedOpenClass<!> external fun userDefinedOpenClassAsReturnType(): <!WRONG_JS_INTEROP_TYPE!>UserDefinedOpenClass<!>
<!WRONG_JS_INTEROP_TYPE!>external fun userDefinedObjectAsReturnType(): UserDefinedObject<!> external fun userDefinedObjectAsReturnType(): <!WRONG_JS_INTEROP_TYPE!>UserDefinedObject<!>
// wrong JS interop types as vararg parameter types // wrong JS interop types as vararg parameter types
// Unit (Nothing is not allowed in vararg parameters) // Unit (Nothing is not allowed in vararg parameters)
external fun unitAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: Unit<!>) external fun unitAsVarargParameterType(vararg args: <!WRONG_JS_INTEROP_TYPE!>Unit<!>)
// built-in types // built-in types
external fun anyAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: Any<!>) external fun anyAsVarargParameterType(vararg args: <!WRONG_JS_INTEROP_TYPE!>Any<!>)
external fun numberAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: Number<!>) external fun numberAsVarargParameterType(vararg args: <!WRONG_JS_INTEROP_TYPE!>Number<!>)
external fun charSequenceAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: CharSequence<!>) external fun charSequenceAsVarargParameterType(vararg args: <!WRONG_JS_INTEROP_TYPE!>CharSequence<!>)
external fun specializedArrayAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: IntArray<!>) external fun specializedArrayAsVarargParameterType(vararg args: <!WRONG_JS_INTEROP_TYPE!>IntArray<!>)
external fun pairAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: Pair<Int, Int><!>) external fun pairAsVarargParameterType(vararg args: <!WRONG_JS_INTEROP_TYPE!>Pair<Int, Int><!>)
external fun listAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: List<Int><!>) external fun listAsVarargParameterType(vararg args: <!WRONG_JS_INTEROP_TYPE!>List<Int><!>)
external fun genericArrayAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: Array<Int><!>) external fun genericArrayAsVarargParameterType(vararg args: <!WRONG_JS_INTEROP_TYPE!>Array<Int><!>)
// user-defined types // user-defined types
external fun userDefinedInterfaceAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: UserDefinedInterface<!>) external fun userDefinedInterfaceAsVarargParameterType(vararg args: <!WRONG_JS_INTEROP_TYPE!>UserDefinedInterface<!>)
external fun userDefinedOpenClassAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: UserDefinedOpenClass<!>) external fun userDefinedOpenClassAsVarargParameterType(vararg args: <!WRONG_JS_INTEROP_TYPE!>UserDefinedOpenClass<!>)
external fun userDefinedObjectAsVarargParameterType(<!WRONG_JS_INTEROP_TYPE!>vararg args: UserDefinedObject<!>) external fun userDefinedObjectAsVarargParameterType(vararg args: <!WRONG_JS_INTEROP_TYPE!>UserDefinedObject<!>)
external fun < external fun <
@@ -115,101 +115,101 @@ external fun <
external class WrongJsInteropTypesAsClassTypeParameterUpperBounds< external class WrongJsInteropTypesAsClassTypeParameterUpperBounds<
// Unit (Nothing as an upper bound results in an empty intersection type) // Unit (Nothing as an upper bound results in an empty intersection type)
TUnit: <!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>Unit<!>, TUnit: <!WRONG_JS_INTEROP_TYPE!>Unit<!>,
// built-in types // built-in types
TAny: <!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>Any<!>, TAny: <!WRONG_JS_INTEROP_TYPE!>Any<!>,
TNumber: <!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>Number<!>, TNumber: <!WRONG_JS_INTEROP_TYPE!>Number<!>,
TCharSequence: <!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>CharSequence<!>, TCharSequence: <!WRONG_JS_INTEROP_TYPE!>CharSequence<!>,
TSpecializedArray: <!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>IntArray<!>, TSpecializedArray: <!WRONG_JS_INTEROP_TYPE!>IntArray<!>,
TPair: <!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>Pair<Int, Int><!>, TPair: <!WRONG_JS_INTEROP_TYPE!>Pair<Int, Int><!>,
TList: <!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>List<Int><!>, TList: <!WRONG_JS_INTEROP_TYPE!>List<Int><!>,
TGenericArray: <!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>Array<Int><!>, TGenericArray: <!WRONG_JS_INTEROP_TYPE!>Array<Int><!>,
// user-defined types // user-defined types
TUserDefinedInterface: <!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>UserDefinedInterface<!>, TUserDefinedInterface: <!WRONG_JS_INTEROP_TYPE!>UserDefinedInterface<!>,
TUserDefinedOpenClass: <!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>UserDefinedOpenClass<!>, TUserDefinedOpenClass: <!WRONG_JS_INTEROP_TYPE!>UserDefinedOpenClass<!>,
TUserDefinedObject: <!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>UserDefinedObject<!>, TUserDefinedObject: <!WRONG_JS_INTEROP_TYPE!>UserDefinedObject<!>,
// type parameter with implicit upper bound // type parameter with implicit upper bound
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>TTypeParameterWithImplicitUpperBound<!> <!WRONG_JS_INTEROP_TYPE!>TTypeParameterWithImplicitUpperBound<!>
> >
// wrong JS interop types as property types // wrong JS interop types as property types
// Unit and Nothing // Unit and Nothing
<!WRONG_JS_INTEROP_TYPE!>external val unitProperty: Unit<!> external val unitProperty: <!WRONG_JS_INTEROP_TYPE!>Unit<!>
<!WRONG_JS_INTEROP_TYPE!>external val nothingProperty: Nothing<!> external val nothingProperty: <!WRONG_JS_INTEROP_TYPE!>Nothing<!>
// built-in types // built-in types
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val anyProperty: Any<!> external val anyProperty: <!WRONG_JS_INTEROP_TYPE!>Any<!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val numberProperty: Number<!> external val numberProperty: <!WRONG_JS_INTEROP_TYPE!>Number<!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val charSequenceProperty: CharSequence<!> external val charSequenceProperty: <!WRONG_JS_INTEROP_TYPE!>CharSequence<!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val specializedArrayProperty: IntArray<!> external val specializedArrayProperty: <!WRONG_JS_INTEROP_TYPE!>IntArray<!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val pairProperty: Pair<Int, Int><!> external val pairProperty: <!WRONG_JS_INTEROP_TYPE!>Pair<Int, Int><!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val listProperty: List<Int><!> external val listProperty: <!WRONG_JS_INTEROP_TYPE!>List<Int><!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val genericArrayProperty: Array<Int><!> external val genericArrayProperty: <!WRONG_JS_INTEROP_TYPE!>Array<Int><!>
// user-defined types // user-defined types
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val userDefinedInterfaceProperty: UserDefinedInterface<!> external val userDefinedInterfaceProperty: <!WRONG_JS_INTEROP_TYPE!>UserDefinedInterface<!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val userDefinedOpenClassProperty: UserDefinedOpenClass<!> external val userDefinedOpenClassProperty: <!WRONG_JS_INTEROP_TYPE!>UserDefinedOpenClass<!>
<!WRONG_JS_INTEROP_TYPE, WRONG_JS_INTEROP_TYPE!>external val userDefinedObjectProperty: UserDefinedObject<!> external val userDefinedObjectProperty: <!WRONG_JS_INTEROP_TYPE!>UserDefinedObject<!>
external fun wrongJsInteropTypesAsFunctionTypeParameterTypes( external fun wrongJsInteropTypesAsFunctionTypeParameterTypes(
<!WRONG_JS_INTEROP_TYPE!>unitAndNothing: (Unit, Nothing) -> Unit<!>, unitAndNothing: (<!WRONG_JS_INTEROP_TYPE!>Unit<!>, <!WRONG_JS_INTEROP_TYPE!>Nothing<!>) -> Unit,
<!WRONG_JS_INTEROP_TYPE!>builtInTypes: (Any, Number, CharSequence, IntArray, Pair<Int, Int>, List<Int>, Array<Int>) -> Unit<!>, builtInTypes: (<!WRONG_JS_INTEROP_TYPE!>Any<!>, <!WRONG_JS_INTEROP_TYPE!>Number<!>, <!WRONG_JS_INTEROP_TYPE!>CharSequence<!>, <!WRONG_JS_INTEROP_TYPE!>IntArray<!>, <!WRONG_JS_INTEROP_TYPE!>Pair<Int, Int><!>, <!WRONG_JS_INTEROP_TYPE!>List<Int><!>, <!WRONG_JS_INTEROP_TYPE!>Array<Int><!>) -> Unit,
<!WRONG_JS_INTEROP_TYPE!>userDefinedTypes: (UserDefinedInterface, UserDefinedOpenClass, UserDefinedObject) -> Unit<!>, userDefinedTypes: (<!WRONG_JS_INTEROP_TYPE!>UserDefinedInterface<!>, <!WRONG_JS_INTEROP_TYPE!>UserDefinedOpenClass<!>, <!WRONG_JS_INTEROP_TYPE!>UserDefinedObject<!>) -> Unit,
) )
external fun wrongJsInteropTypesAsFunctionTypeReturnTypes( external fun wrongJsInteropTypesAsFunctionTypeReturnTypes(
// built-in types // built-in types
<!WRONG_JS_INTEROP_TYPE!>any: () -> Any<!>, any: () -> <!WRONG_JS_INTEROP_TYPE!>Any<!>,
<!WRONG_JS_INTEROP_TYPE!>number: () -> Number<!>, number: () -> <!WRONG_JS_INTEROP_TYPE!>Number<!>,
<!WRONG_JS_INTEROP_TYPE!>charSequence: () -> CharSequence<!>, charSequence: () -> <!WRONG_JS_INTEROP_TYPE!>CharSequence<!>,
<!WRONG_JS_INTEROP_TYPE!>specializedArray: () -> IntArray<!>, specializedArray: () -> <!WRONG_JS_INTEROP_TYPE!>IntArray<!>,
<!WRONG_JS_INTEROP_TYPE!>pair: () -> Pair<Int, Int><!>, pair: () -> <!WRONG_JS_INTEROP_TYPE!>Pair<Int, Int><!>,
<!WRONG_JS_INTEROP_TYPE!>list: () -> List<Int><!>, list: () -> <!WRONG_JS_INTEROP_TYPE!>List<Int><!>,
<!WRONG_JS_INTEROP_TYPE!>genericArray: () -> Array<Int><!>, genericArray: () -> <!WRONG_JS_INTEROP_TYPE!>Array<Int><!>,
// user-defined types // user-defined types
<!WRONG_JS_INTEROP_TYPE!>userDefinedInterface: () -> UserDefinedInterface<!>, userDefinedInterface: () -> <!WRONG_JS_INTEROP_TYPE!>UserDefinedInterface<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedOpenClass: () -> UserDefinedOpenClass<!>, userDefinedOpenClass: () -> <!WRONG_JS_INTEROP_TYPE!>UserDefinedOpenClass<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedObject: () -> UserDefinedObject<!>, userDefinedObject: () -> <!WRONG_JS_INTEROP_TYPE!>UserDefinedObject<!>,
) )
fun wrongJsInteropTypesInJsCodeFunction( fun wrongJsInteropTypesInJsCodeFunction(
// Unit and Nothing // Unit and Nothing
<!WRONG_JS_INTEROP_TYPE!>unit: Unit<!>, unit: <!WRONG_JS_INTEROP_TYPE!>Unit<!>,
<!WRONG_JS_INTEROP_TYPE!>nothing: Nothing<!>, nothing: <!WRONG_JS_INTEROP_TYPE!>Nothing<!>,
// built-in types // built-in types
<!WRONG_JS_INTEROP_TYPE!>any: Any<!>, any: <!WRONG_JS_INTEROP_TYPE!>Any<!>,
<!WRONG_JS_INTEROP_TYPE!>number: Number<!>, number: <!WRONG_JS_INTEROP_TYPE!>Number<!>,
<!WRONG_JS_INTEROP_TYPE!>charSequence: CharSequence<!>, charSequence: <!WRONG_JS_INTEROP_TYPE!>CharSequence<!>,
<!WRONG_JS_INTEROP_TYPE!>specializedArray: IntArray<!>, specializedArray: <!WRONG_JS_INTEROP_TYPE!>IntArray<!>,
<!WRONG_JS_INTEROP_TYPE!>pair: Pair<Int, Int><!>, pair: <!WRONG_JS_INTEROP_TYPE!>Pair<Int, Int><!>,
<!WRONG_JS_INTEROP_TYPE!>list: List<Int><!>, list: <!WRONG_JS_INTEROP_TYPE!>List<Int><!>,
<!WRONG_JS_INTEROP_TYPE!>genericArray: Array<Int><!>, genericArray: <!WRONG_JS_INTEROP_TYPE!>Array<Int><!>,
// user-defined types // user-defined types
<!WRONG_JS_INTEROP_TYPE!>userDefinedInterface: UserDefinedInterface<!>, userDefinedInterface: <!WRONG_JS_INTEROP_TYPE!>UserDefinedInterface<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedOpenClass: UserDefinedOpenClass<!>, userDefinedOpenClass: <!WRONG_JS_INTEROP_TYPE!>UserDefinedOpenClass<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedObject: UserDefinedObject<!>, userDefinedObject: <!WRONG_JS_INTEROP_TYPE!>UserDefinedObject<!>,
): Nothing = js("42") ): Nothing = js("42")
@JsExport @JsExport
fun wrongJsInteropTypesInJsExportFunction( fun wrongJsInteropTypesInJsExportFunction(
// Unit and Nothing // Unit and Nothing
<!WRONG_JS_INTEROP_TYPE!>unit: Unit<!>, unit: <!WRONG_JS_INTEROP_TYPE!>Unit<!>,
<!WRONG_JS_INTEROP_TYPE!>nothing: Nothing<!>, nothing: <!WRONG_JS_INTEROP_TYPE!>Nothing<!>,
// built-in types // built-in types
<!WRONG_JS_INTEROP_TYPE!>any: Any<!>, any: <!WRONG_JS_INTEROP_TYPE!>Any<!>,
<!WRONG_JS_INTEROP_TYPE!>number: Number<!>, number: <!WRONG_JS_INTEROP_TYPE!>Number<!>,
<!WRONG_JS_INTEROP_TYPE!>charSequence: CharSequence<!>, charSequence: <!WRONG_JS_INTEROP_TYPE!>CharSequence<!>,
<!WRONG_JS_INTEROP_TYPE!>specializedArray: IntArray<!>, specializedArray: <!WRONG_JS_INTEROP_TYPE!>IntArray<!>,
<!WRONG_JS_INTEROP_TYPE!>pair: Pair<Int, Int><!>, pair: <!WRONG_JS_INTEROP_TYPE!>Pair<Int, Int><!>,
<!WRONG_JS_INTEROP_TYPE!>list: List<Int><!>, list: <!WRONG_JS_INTEROP_TYPE!>List<Int><!>,
<!WRONG_JS_INTEROP_TYPE!>genericArray: Array<Int><!>, genericArray: <!WRONG_JS_INTEROP_TYPE!>Array<Int><!>,
// user-defined types // user-defined types
<!WRONG_JS_INTEROP_TYPE!>userDefinedInterface: UserDefinedInterface<!>, userDefinedInterface: <!WRONG_JS_INTEROP_TYPE!>UserDefinedInterface<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedOpenClass: UserDefinedOpenClass<!>, userDefinedOpenClass: <!WRONG_JS_INTEROP_TYPE!>UserDefinedOpenClass<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedObject: UserDefinedObject<!>, userDefinedObject: <!WRONG_JS_INTEROP_TYPE!>UserDefinedObject<!>,
) {} ) {}
@@ -230,18 +230,18 @@ typealias AliasedUserDefinedObject = UserDefinedObject
external fun aliasedWrongJsInteropTypes( external fun aliasedWrongJsInteropTypes(
// Unit and Nothing // Unit and Nothing
<!WRONG_JS_INTEROP_TYPE!>unit: AliasedUnit<!>, unit: <!WRONG_JS_INTEROP_TYPE!>AliasedUnit<!>,
<!WRONG_JS_INTEROP_TYPE!>nothing: AliasedNothing<!>, nothing: <!WRONG_JS_INTEROP_TYPE!>AliasedNothing<!>,
// built-in types // built-in types
<!WRONG_JS_INTEROP_TYPE!>any: AliasedAny<!>, any: <!WRONG_JS_INTEROP_TYPE!>AliasedAny<!>,
<!WRONG_JS_INTEROP_TYPE!>number: AliasedNumber<!>, number: <!WRONG_JS_INTEROP_TYPE!>AliasedNumber<!>,
<!WRONG_JS_INTEROP_TYPE!>charSequence: AliasedCharSequence<!>, charSequence: <!WRONG_JS_INTEROP_TYPE!>AliasedCharSequence<!>,
<!WRONG_JS_INTEROP_TYPE!>specializedArray: AliasedSpecializedArray<!>, specializedArray: <!WRONG_JS_INTEROP_TYPE!>AliasedSpecializedArray<!>,
<!WRONG_JS_INTEROP_TYPE!>pair: AliasedPair<!>, pair: <!WRONG_JS_INTEROP_TYPE!>AliasedPair<!>,
<!WRONG_JS_INTEROP_TYPE!>list: AliasedList<!>, list: <!WRONG_JS_INTEROP_TYPE!>AliasedList<!>,
<!WRONG_JS_INTEROP_TYPE!>genericArray: AliasedGenericArray<!>, genericArray: <!WRONG_JS_INTEROP_TYPE!>AliasedGenericArray<!>,
// user-defined types // user-defined types
<!WRONG_JS_INTEROP_TYPE!>userDefinedInterface: AliasedUserDefinedInterface<!>, userDefinedInterface: <!WRONG_JS_INTEROP_TYPE!>AliasedUserDefinedInterface<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedOpenClass: AliasedUserDefinedOpenClass<!>, userDefinedOpenClass: <!WRONG_JS_INTEROP_TYPE!>AliasedUserDefinedOpenClass<!>,
<!WRONG_JS_INTEROP_TYPE!>userDefinedObject: AliasedUserDefinedObject<!>, userDefinedObject: <!WRONG_JS_INTEROP_TYPE!>AliasedUserDefinedObject<!>,
) )