[K/Wasm] Allow to export unsigned numbers
This commit is contained in:
+1
-1
@@ -26,7 +26,6 @@ object WasmJsPlatformConfigurator : PlatformConfiguratorBase(
|
||||
JsExternalChecker, WasmExternalInheritanceChecker,
|
||||
JsRuntimeAnnotationChecker,
|
||||
JsExportAnnotationChecker,
|
||||
JsExportDeclarationChecker,
|
||||
WasmExternalDeclarationChecker,
|
||||
WasmImportAnnotationChecker,
|
||||
WasmJsFunAnnotationChecker,
|
||||
@@ -51,6 +50,7 @@ object WasmJsPlatformConfigurator : PlatformConfiguratorBase(
|
||||
container.useInstance(ExtensionFunctionToExternalIsInlinable)
|
||||
container.useInstance(JsQualifierChecker)
|
||||
container.useInstance(WasmDiagnosticSuppressor)
|
||||
container.useInstance(JsExportDeclarationChecker(includeUnsignedNumbers = true))
|
||||
}
|
||||
|
||||
override fun configureModuleDependentCheckers(container: StorageComponentContainer) {
|
||||
|
||||
+2
-1
@@ -31,6 +31,7 @@ import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.typeUtil.isBoolean
|
||||
import org.jetbrains.kotlin.types.typeUtil.isPrimitiveNumberType
|
||||
import org.jetbrains.kotlin.types.typeUtil.isUnit
|
||||
import org.jetbrains.kotlin.types.typeUtil.isUnsignedNumberType
|
||||
|
||||
object WasmImportAnnotationChecker : DeclarationChecker {
|
||||
private val wasmImportFqName = FqName("kotlin.wasm.WasmImport")
|
||||
@@ -54,7 +55,7 @@ object WasmImportAnnotationChecker : DeclarationChecker {
|
||||
}
|
||||
|
||||
private fun isParameterTypeSupported(type: KotlinType): Boolean =
|
||||
type.isPrimitiveNumberType() || type.isBoolean()
|
||||
type.isPrimitiveNumberType() || type.isUnsignedNumberType() || type.isBoolean()
|
||||
|
||||
private fun isReturnTypeSupported(type: KotlinType): Boolean =
|
||||
isParameterTypeSupported(type) || type.isUnit()
|
||||
|
||||
+1
@@ -113,6 +113,7 @@ private fun isTypeSupportedInJsInterop(
|
||||
val nonNullable = type.makeNotNullable()
|
||||
if (
|
||||
KotlinBuiltIns.isPrimitiveType(nonNullable) ||
|
||||
KotlinBuiltIns.isUnsignedNumber(nonNullable) ||
|
||||
KotlinBuiltIns.isString(nonNullable)
|
||||
) {
|
||||
return true
|
||||
|
||||
+6
@@ -49,6 +49,12 @@ public class FirWasmCodegenWasmJsInteropTestGenerated extends AbstractFirWasmCod
|
||||
runTest("compiler/testData/codegen/boxWasmJsInterop/externals.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("externalsWithUnsigned.kt")
|
||||
public void testExternalsWithUnsigned() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxWasmJsInterop/externalsWithUnsigned.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionTypes.kt")
|
||||
public void testFunctionTypes() throws Exception {
|
||||
|
||||
+6
@@ -49,6 +49,12 @@ public class K1WasmCodegenWasmJsInteropTestGenerated extends AbstractK1WasmCodeg
|
||||
runTest("compiler/testData/codegen/boxWasmJsInterop/externals.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("externalsWithUnsigned.kt")
|
||||
public void testExternalsWithUnsigned() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxWasmJsInterop/externalsWithUnsigned.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionTypes.kt")
|
||||
public void testFunctionTypes() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user