From ca740a4baf555a038f870d520548f75d2326c591 Mon Sep 17 00:00:00 2001 From: Vladimir Sukharev Date: Tue, 18 Apr 2023 03:37:47 +0000 Subject: [PATCH] [K2/N] Re-enable special backend checks ^KT-55598 Merge-request: KT-MR-9625 Merged-by: Vladimir Sukharev --- .../backend/konan/cgen/InteropIrUtils.kt | 2 - .../konan/driver/DynamicCompilerDriver.kt | 2 +- .../lower/SpecialBackendChecksTraversal.kt | 26 ++- .../tests/compilerChecks/README.md | 154 +++++++++++++++++- .../tests/compilerChecks/runtests.sh | 13 ++ .../tests/compilerChecks/t36.kt | 2 +- 6 files changed, 179 insertions(+), 20 deletions(-) create mode 100755 kotlin-native/backend.native/tests/compilerChecks/runtests.sh diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/cgen/InteropIrUtils.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/cgen/InteropIrUtils.kt index 6e35b210386..07d4b0c9fd2 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/cgen/InteropIrUtils.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/cgen/InteropIrUtils.kt @@ -6,7 +6,6 @@ package org.jetbrains.kotlin.backend.konan.cgen import org.jetbrains.kotlin.backend.jvm.ir.propertyIfAccessor -import org.jetbrains.kotlin.backend.konan.InteropFqNames import org.jetbrains.kotlin.backend.konan.KonanFqNames import org.jetbrains.kotlin.backend.konan.RuntimeNames import org.jetbrains.kotlin.backend.konan.ir.* @@ -20,7 +19,6 @@ import org.jetbrains.kotlin.ir.util.isUnsigned import org.jetbrains.kotlin.konan.target.KonanTarget import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.types.checker.SimpleClassicTypeSystemContext.getClassFqNameUnsafe internal fun IrType.isCEnumType(): Boolean { if (isNullable()) return false diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/driver/DynamicCompilerDriver.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/driver/DynamicCompilerDriver.kt index 5a2c981750e..981717f10c6 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/driver/DynamicCompilerDriver.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/driver/DynamicCompilerDriver.kt @@ -104,7 +104,7 @@ internal class DynamicCompilerDriver : CompilerDriver() { require(frontendOutput is FirOutput.Full) val fir2IrOutput = engine.runFir2Ir(frontendOutput) - //engine.runK2SpecialBackendChecks(fir2IrOutput) // TODO KT-55598 try uncommenting this line after getting rid of InteropBuiltins excessive usage + engine.runK2SpecialBackendChecks(fir2IrOutput) return engine.runFirSerializer(fir2IrOutput) } diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/SpecialBackendChecksTraversal.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/SpecialBackendChecksTraversal.kt index 8acfeb54bcd..fca251bd024 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/SpecialBackendChecksTraversal.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/SpecialBackendChecksTraversal.kt @@ -33,7 +33,6 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.types.Variance -import org.jetbrains.kotlin.types.checker.SimpleClassicTypeSystemContext.getClassFqNameUnsafe import org.jetbrains.kotlin.utils.fileUtils.descendantRelativeTo import java.io.File @@ -159,13 +158,13 @@ private class BackendChecker( function.valueParameters.forEach { val kotlinType = it.descriptor.type if (!kotlinType.isObjCObjectType()) - reportError(it, "Unexpected $action method parameter type: $kotlinType\n" + + reportError(it, "Unexpected $action method parameter type: ${it.type.classFqName}\n" + "Only Objective-C object types are supported here") } val returnType = function.returnType if (!returnType.isUnit()) - reportError(function, "Unexpected $action method return type: ${returnType.toKotlinType()}\n" + + reportError(function, "Unexpected $action method return type: ${returnType.classFqName}\n" + "Only 'Unit' is supported here") checkCanGenerateFunctionImp(function) @@ -185,7 +184,7 @@ private class BackendChecker( val type = descriptor.type if (!type.isObjCObjectType()) - reportError(property, "Unexpected $outlet type: $type\n" + + reportError(property, "Unexpected $outlet type: ${property.getter?.returnType?.classFqName}\n" + "Only Objective-C object types are supported here") checkCanGenerateFunctionImp(property.setter!!) @@ -340,8 +339,7 @@ private class BackendChecker( val parent = declaration.parent if (parent is IrClass && parent.defaultType.isNativePointed(symbols) && parent.symbol != symbols.nativePointed) { - val nativePointed = symbols.nativePointed.owner.name - reportError(declaration, "Subclasses of $nativePointed cannot have properties with backing fields") + reportError(declaration, "Subclasses of ${InteropFqNames.nativePointed} cannot have properties with backing fields") } } @@ -419,7 +417,8 @@ private class BackendChecker( if (typeArgument.constructor != signatureType.constructor || typeArgument.isMarkedNullable != signatureType.isMarkedNullable ) { - reportError(expression, "C function signature element mismatch: expected '$signatureType', got '$typeArgument'") + reportError(expression, "C function signature element mismatch: " + + "expected '${signatureTypes[index].classFqName}', got '${expression.getTypeArgument(index)!!.classFqName}'") } } @@ -436,25 +435,22 @@ private class BackendChecker( val receiver = expression.extensionReceiver!! val typeOperand = expression.getSingleTypeArgument() - val kotlinTypeOperand = typeOperand.toKotlinType() val receiverTypeIndex = integerTypePredicates.indexOfFirst { it(receiver.type) } val typeOperandIndex = integerTypePredicates.indexOfFirst { it(typeOperand) } - val receiverKotlinType = receiver.type.toKotlinType() - if (receiverTypeIndex == -1) - reportError(receiver, "Receiver's type $receiverKotlinType is not an integer type") + reportError(receiver, "Receiver's type ${receiver.type.classFqName} is not an integer type") if (typeOperandIndex == -1) - reportError(expression, "Type argument $kotlinTypeOperand is not an integer type") + reportError(expression, "Type argument ${typeOperand.classFqName} is not an integer type") when (intrinsicType) { IntrinsicType.INTEROP_SIGN_EXTEND -> if (receiverTypeIndex > typeOperandIndex) - reportError(expression, "unable to sign extend $receiverKotlinType to $kotlinTypeOperand") + reportError(expression, "unable to sign extend ${receiver.type.classFqName} to ${typeOperand.classFqName}") IntrinsicType.INTEROP_NARROW -> if (receiverTypeIndex < typeOperandIndex) - reportError(expression, "unable to narrow $receiverKotlinType to $kotlinTypeOperand") + reportError(expression, "unable to narrow ${receiver.type.classFqName} to ${typeOperand.classFqName}") else -> error(intrinsicType) } @@ -465,7 +461,7 @@ private class BackendChecker( val receiverType = expression.symbol.owner.extensionReceiverParameter!!.type if (typeOperand !is IrSimpleType || typeOperand.classifier !in integerClasses || typeOperand.isNullable()) - reportError(expression, "unable to convert ${receiverType.toKotlinType()} to ${typeOperand.toKotlinType()}") + reportError(expression, "unable to convert ${receiverType.classFqName} to ${typeOperand.classFqName}") } IntrinsicType.WORKER_EXECUTE -> { val (function, captures) = getUnboundReferencedFunction(expression.getValueArgument(2)!!) diff --git a/kotlin-native/backend.native/tests/compilerChecks/README.md b/kotlin-native/backend.native/tests/compilerChecks/README.md index d75d95ab9ee..18579637f79 100644 --- a/kotlin-native/backend.native/tests/compilerChecks/README.md +++ b/kotlin-native/backend.native/tests/compilerChecks/README.md @@ -1 +1,153 @@ -These tests aren't invoked so far because there is no mechanism of checking compilation errors yet. \ No newline at end of file +These tests aren't invoked so far because there is no mechanism of checking compilation errors yet. + +To run tests manually on MacOS, +- build platformLibs: `./gradlew :kotlin-native:platformLibs:macos_arm64Install` or `./gradlew :kotlin-native:platformLibs:macos_x64Install` +- run `runtests.sh` as described below. + +K1: `kotlin-native/backend.native/tests/compilerChecks/runtests.sh -language-version 1.9` +K2: `kotlin-native/backend.native/tests/compilerChecks/runtests.sh -language-version 2.0` + +Reference output: +```text +kotlin-native/backend.native/tests/compilerChecks/t1.kt +kotlin-native/backend.native/tests/compilerChecks/t1.kt:10:5: error: variadic function pointers are not supported +kotlin-native/backend.native/tests/compilerChecks/t10.kt +kotlin-native/backend.native/tests/compilerChecks/t10.kt:6:5: error: type kotlin.Function1<*, kotlin.Int> of callback parameter 1 is not supported here: * as 1 parameter type +kotlin-native/backend.native/tests/compilerChecks/t11.kt +kotlin-native/backend.native/tests/compilerChecks/t11.kt:6:5: error: type kotlin.Function1 of callback parameter 1 is not supported here: in-variance of 1 parameter type +kotlin-native/backend.native/tests/compilerChecks/t12.kt +kotlin-native/backend.native/tests/compilerChecks/t12.kt:6:5: error: type kotlinx.cinterop.CValue<*>? of callback parameter 1 is not supported here: must not be nullable +kotlin-native/backend.native/tests/compilerChecks/t13.kt +kotlin-native/backend.native/tests/compilerChecks/t13.kt:7:5: error: type kotlinx.cinterop.CValue.bar> of callback parameter 1 is not supported here: must be parameterized with concrete class +kotlin-native/backend.native/tests/compilerChecks/t14.kt +kotlin-native/backend.native/tests/compilerChecks/t14.kt:8:5: error: type kotlinx.cinterop.CValue<.Z> of callback parameter 1 is not supported here: not a structure or too complex +kotlin-native/backend.native/tests/compilerChecks/t15.kt +kotlin-native/backend.native/tests/compilerChecks/t15.kt:4:26: error: type kotlin.Function0 is not supported here: not supported as variadic argument +kotlin-native/backend.native/tests/compilerChecks/t16.kt +kotlin-native/backend.native/tests/compilerChecks/t16.kt:6:26: error: type .Z is not supported here: doesn't correspond to any C type +kotlin-native/backend.native/tests/compilerChecks/t17.kt +kotlin-native/backend.native/tests/compilerChecks/t17.kt:6:15: error: super calls to Objective-C protocols are not allowed +kotlin-native/backend.native/tests/compilerChecks/t18.kt +kotlin-native/backend.native/tests/compilerChecks/t18.kt:6:19: error: super calls to Objective-C meta classes are not supported yet +kotlin-native/backend.native/tests/compilerChecks/t2.kt +kotlin-native/backend.native/tests/compilerChecks/t2.kt:5:5: error: 'handleFailureInFunction' overrides nothing + override fun handleFailureInFunction(functionName: String, file: String, lineNumber: NSInteger /* = Long */, description: String?, vararg args: Any?) { } + ^ +kotlin-native/backend.native/tests/compilerChecks/t20.kt +kotlin-native/backend.native/tests/compilerChecks/t20.kt:4:1: error: only classes are supported as subtypes of Objective-C types +kotlin-native/backend.native/tests/compilerChecks/t21.kt +kotlin-native/backend.native/tests/compilerChecks/t21.kt:4:1: error: non-final Kotlin subclasses of Objective-C classes are not yet supported +kotlin-native/backend.native/tests/compilerChecks/t22.kt +kotlin-native/backend.native/tests/compilerChecks/t22.kt:4:1: error: fields are not supported for Companion of subclass of ObjC type +kotlin-native/backend.native/tests/compilerChecks/t23.kt +kotlin-native/backend.native/tests/compilerChecks/t23.kt:6:1: error: mixing Kotlin and Objective-C supertypes is not supported +kotlin-native/backend.native/tests/compilerChecks/t24.kt +kotlin-native/backend.native/tests/compilerChecks/t24.kt:4:1: error: only companion objects of subclasses of Objective-C classes can inherit from Objective-C metaclasses +kotlin-native/backend.native/tests/compilerChecks/t25.kt +kotlin-native/backend.native/tests/compilerChecks/t25.kt:5:14: error: can't override 'toString', override 'description' instead +kotlin-native/backend.native/tests/compilerChecks/t26.kt +kotlin-native/backend.native/tests/compilerChecks/t26.kt:7:9: error: @kotlinx.cinterop.ObjCAction method must not have extension receiver +kotlin-native/backend.native/tests/compilerChecks/t27.kt +kotlin-native/backend.native/tests/compilerChecks/t27.kt:7:13: error: unexpected @kotlinx.cinterop.ObjCAction method parameter type: kotlin.String +Only Objective-C object types are supported here +kotlin-native/backend.native/tests/compilerChecks/t28.kt +kotlin-native/backend.native/tests/compilerChecks/t28.kt:7:5: error: unexpected @kotlinx.cinterop.ObjCAction method return type: kotlin.Int +Only 'Unit' is supported here +kotlin-native/backend.native/tests/compilerChecks/t29.kt +kotlin-native/backend.native/tests/compilerChecks/t29.kt:6:5: error: @kotlinx.cinterop.ObjCOutlet property must be var +kotlin-native/backend.native/tests/compilerChecks/t3.kt +kotlin-native/backend.native/tests/compilerChecks/t3.kt:4:13: error: callable references to variadic C functions are not supported +kotlin-native/backend.native/tests/compilerChecks/t30.kt +kotlin-native/backend.native/tests/compilerChecks/t30.kt:7:9: error: @kotlinx.cinterop.ObjCOutlet must not have extension receiver +kotlin-native/backend.native/tests/compilerChecks/t31.kt +kotlin-native/backend.native/tests/compilerChecks/t31.kt:6:5: error: unexpected @kotlinx.cinterop.ObjCOutlet type: kotlin.String +Only Objective-C object types are supported here +kotlin-native/backend.native/tests/compilerChecks/t32.kt +kotlin-native/backend.native/tests/compilerChecks/t32.kt:7:5: error: constructor with @kotlinx.cinterop.ObjCObjectBase.OverrideInit doesn't override any super class constructor. +It must completely match by parameter names and types. +kotlin-native/backend.native/tests/compilerChecks/t33.kt +kotlin-native/backend.native/tests/compilerChecks/t33.kt:7:5: error: constructor with @kotlinx.cinterop.ObjCObjectBase.OverrideInit overrides initializer that is already overridden explicitly +kotlin-native/backend.native/tests/compilerChecks/t34.kt +kotlin-native/backend.native/tests/compilerChecks/t34.kt:7:5: error: only 0, 1 or 2 parameters are supported here +kotlin-native/backend.native/tests/compilerChecks/t35.kt +kotlin-native/backend.native/tests/compilerChecks/t35.kt:5:13: error: unable to call non-designated initializer as super constructor +kotlin-native/backend.native/tests/compilerChecks/t36.kt +kotlin-native/backend.native/tests/compilerChecks/t36.kt:4:13: error: native interop types constructors must not be called directly +kotlin-native/backend.native/tests/compilerChecks/t37.kt +kotlin-native/backend.native/tests/compilerChecks/t37.kt:5:5: error: subclasses of NativePointed cannot have properties with backing fields +kotlin-native/backend.native/tests/compilerChecks/t38.kt +kotlin-native/backend.native/tests/compilerChecks/t38.kt:5:5: error: subclasses of NativePointed cannot have properties with backing fields +kotlin-native/backend.native/tests/compilerChecks/t4.kt +kotlin-native/backend.native/tests/compilerChecks/t4.kt:4:21: error: callable references to variadic Objective-C methods are not supported +kotlin-native/backend.native/tests/compilerChecks/t40.kt +kotlin-native/backend.native/tests/compilerChecks/t40.kt:8:5: error: kotlinx.cinterop.staticCFunction must take an unbound, non-capturing function or lambda, but captures at: + kotlin-native/backend.native/tests/compilerChecks/t40.kt:8:21 +kotlin-native/backend.native/tests/compilerChecks/t41.kt +kotlin-native/backend.native/tests/compilerChecks/t41.kt:7:5: error: kotlinx.cinterop.staticCFunction must take an unbound, non-capturing function or lambda, but captures at: + kotlin-native/backend.native/tests/compilerChecks/t41.kt:5:17: x +kotlin-native/backend.native/tests/compilerChecks/t42.kt +kotlin-native/backend.native/tests/compilerChecks/t42.kt:6:5: error: c function signature element mismatch: expected 'kotlin.Any', got 'kotlin.String' +kotlin-native/backend.native/tests/compilerChecks/t43.kt +kotlin-native/backend.native/tests/compilerChecks/t43.kt:3:21: error: receiver's type kotlin.Float is not an integer type +kotlin-native/backend.native/tests/compilerChecks/t44.kt +kotlin-native/backend.native/tests/compilerChecks/t44.kt:3:21: error: type argument kotlin.Float is not an integer type +kotlin-native/backend.native/tests/compilerChecks/t45.kt +kotlin-native/backend.native/tests/compilerChecks/t45.kt:3:21: error: unable to sign extend kotlin.Int to kotlin.Short +kotlin-native/backend.native/tests/compilerChecks/t46.kt +kotlin-native/backend.native/tests/compilerChecks/t46.kt:3:21: error: unable to narrow kotlin.Int to kotlin.Long +kotlin-native/backend.native/tests/compilerChecks/t47.kt +kotlin-native/backend.native/tests/compilerChecks/t47.kt:3:21: error: unable to convert kotlin.Int to kotlin.String +kotlin-native/backend.native/tests/compilerChecks/t48.kt +kotlin-native/backend.native/tests/compilerChecks/t48.kt:9:12: error: kotlin.native.concurrent.Worker.execute must take an unbound, non-capturing function or lambda, but captures at: + kotlin-native/backend.native/tests/compilerChecks/t48.kt:9:50 +kotlin-native/backend.native/tests/compilerChecks/t49.kt +kotlin-native/backend.native/tests/compilerChecks/t49.kt:5:12: error: kotlin.native.concurrent.Worker.execute must take an unbound, non-capturing function or lambda, but captures at: + kotlin-native/backend.native/tests/compilerChecks/t49.kt:5:61: x +kotlin-native/backend.native/tests/compilerChecks/t5.kt +kotlin-native/backend.native/tests/compilerChecks/t5.kt:4:83: error: passing String as variadic Objective-C argument is ambiguous; cast it to NSString or pass with '.cstr' as C string +kotlin-native/backend.native/tests/compilerChecks/t50.kt +kotlin-native/backend.native/tests/compilerChecks/t50.kt:10:16: error: kotlin.native.concurrent.Worker.execute must take an unbound, non-capturing function or lambda, but captures at: + kotlin-native/backend.native/tests/compilerChecks/t50.kt:10:54 +kotlin-native/backend.native/tests/compilerChecks/t51.kt + MISSING EXPECTED ERROR FOR kotlin-native/backend.native/tests/compilerChecks/t51.kt +kotlin-native/backend.native/tests/compilerChecks/t52.kt +kotlin-native/backend.native/tests/compilerChecks/t52.kt:5:5: warning: 'createCleaner(T, (T) -> Unit): Cleaner' is deprecated. Use kotlin.native.ref.createCleaner instead. + createCleaner(42) { println(x) } + ^ + MISSING EXPECTED ERROR FOR kotlin-native/backend.native/tests/compilerChecks/t52.kt +kotlin-native/backend.native/tests/compilerChecks/t53.kt +kotlin-native/backend.native/tests/compilerChecks/t53.kt:9:5: warning: 'createCleaner(T, (T) -> Unit): Cleaner' is deprecated. Use kotlin.native.ref.createCleaner instead. + createCleaner(42, C(x)::bar) + ^ + MISSING EXPECTED ERROR FOR kotlin-native/backend.native/tests/compilerChecks/t53.kt +kotlin-native/backend.native/tests/compilerChecks/t54.kt +kotlin-native/backend.native/tests/compilerChecks/t54.kt:1:44: error: no spread elements allowed here +kotlin-native/backend.native/tests/compilerChecks/t55.kt +kotlin-native/backend.native/tests/compilerChecks/t55.kt:1:37: error: all elements of binary blob must be constants +kotlin-native/backend.native/tests/compilerChecks/t56.kt +kotlin-native/backend.native/tests/compilerChecks/t56.kt:1:29: error: incorrect value for binary data: 1000 +kotlin-native/backend.native/tests/compilerChecks/t57.kt +kotlin-native/backend.native/tests/compilerChecks/t57.kt:1:13: error: expected at least one element +kotlin-native/backend.native/tests/compilerChecks/t58.kt +kotlin-native/backend.native/tests/compilerChecks/t58.kt:5:5: error: non-reified type parameters with recursive bounds are not supported yet: TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Comparable.foo>] reified:false +kotlin-native/backend.native/tests/compilerChecks/t59.kt +kotlin-native/backend.native/tests/compilerChecks/t59.kt:5:5: error: non-reified type parameters with recursive bounds are not supported yet: TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Comparable.foo>] reified:false +kotlin-native/backend.native/tests/compilerChecks/t6.kt +kotlin-native/backend.native/tests/compilerChecks/t6.kt:4:97: error: when calling variadic Objective-C methods spread operator is supported only for *arrayOf(...) +kotlin-native/backend.native/tests/compilerChecks/t60.kt +kotlin-native/backend.native/tests/compilerChecks/t60.kt:4:5: error: subclasses of NativePointed cannot have properties with backing fields +kotlin-native/backend.native/tests/compilerChecks/t61.kt +kotlin-native/backend.native/tests/compilerChecks/t61.kt:8:5: error: only companion objects of subclasses of Objective-C classes can inherit from Objective-C metaclasses +kotlin-native/backend.native/tests/compilerChecks/t62.kt +kotlin-native/backend.native/tests/compilerChecks/t62.kt:7:1: error: only companion objects of subclasses of Objective-C classes can inherit from Objective-C metaclasses +kotlin-native/backend.native/tests/compilerChecks/t63.kt + MISSING EXPECTED ERROR FOR kotlin-native/backend.native/tests/compilerChecks/t63.kt +kotlin-native/backend.native/tests/compilerChecks/t64.kt + MISSING EXPECTED ERROR FOR kotlin-native/backend.native/tests/compilerChecks/t64.kt +kotlin-native/backend.native/tests/compilerChecks/t7.kt +kotlin-native/backend.native/tests/compilerChecks/t7.kt:4:41: error: when calling variadic C functions spread operator is supported only for *arrayOf(...) +kotlin-native/backend.native/tests/compilerChecks/t8.kt +kotlin-native/backend.native/tests/compilerChecks/t8.kt:6:5: error: type kotlin.Function0<*> of callback parameter 1 is not supported here: * as return type +kotlin-native/backend.native/tests/compilerChecks/t9.kt +kotlin-native/backend.native/tests/compilerChecks/t9.kt:6:5: error: type kotlin.Function0 of callback parameter 1 is not supported here: out-variance of return type +``` diff --git a/kotlin-native/backend.native/tests/compilerChecks/runtests.sh b/kotlin-native/backend.native/tests/compilerChecks/runtests.sh new file mode 100755 index 00000000000..48bc38ec501 --- /dev/null +++ b/kotlin-native/backend.native/tests/compilerChecks/runtests.sh @@ -0,0 +1,13 @@ +# +# Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. +# Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. +# + +for TEST in kotlin-native/backend.native/tests/compilerChecks/*.kt; do + echo "$TEST"; + konanc -p library -Xsuppress-version-warnings "$TEST" "$@"; + retVal=$? + if [ $retVal -eq 0 ]; then + echo " MISSING EXPECTED ERROR FOR $TEST" + fi +done diff --git a/kotlin-native/backend.native/tests/compilerChecks/t36.kt b/kotlin-native/backend.native/tests/compilerChecks/t36.kt index 2b71817f750..024836e1705 100644 --- a/kotlin-native/backend.native/tests/compilerChecks/t36.kt +++ b/kotlin-native/backend.native/tests/compilerChecks/t36.kt @@ -1,4 +1,4 @@ import kotlinx.cinterop.* import platform.posix.* -fun foo() = stat(malloc(42)!!.rawValue) +fun foo() = stat(malloc(42u)!!.rawValue)