JS: prohibit external fun interface

This commit is contained in:
Anton Bannykh
2020-02-18 14:54:35 +03:00
parent f20ed39b92
commit 2742e643c1
4 changed files with 17 additions and 0 deletions
@@ -0,0 +1,3 @@
external fun interface <!WRONG_EXTERNAL_DECLARATION!>I<!> {
fun f()
}
@@ -0,0 +1,8 @@
package
public external fun interface I {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public abstract fun f(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -681,6 +681,11 @@ public class DiagnosticsTestWithJsStdLibGenerated extends AbstractDiagnosticsTes
runTest("compiler/testData/diagnostics/testsWithJsStdLib/native/extensionFunctionArgumentOrReturnType.kt"); runTest("compiler/testData/diagnostics/testsWithJsStdLib/native/extensionFunctionArgumentOrReturnType.kt");
} }
@TestMetadata("externalFunInterface.kt")
public void testExternalFunInterface() throws Exception {
runTest("compiler/testData/diagnostics/testsWithJsStdLib/native/externalFunInterface.kt");
}
@TestMetadata("externalInterfaceNested.kt") @TestMetadata("externalInterfaceNested.kt")
public void testExternalInterfaceNested() throws Exception { public void testExternalInterfaceNested() throws Exception {
runTest("compiler/testData/diagnostics/testsWithJsStdLib/native/externalInterfaceNested.kt"); runTest("compiler/testData/diagnostics/testsWithJsStdLib/native/externalInterfaceNested.kt");
@@ -44,6 +44,7 @@ object JsExternalChecker : DeclarationChecker {
descriptor.isData -> "data class" descriptor.isData -> "data class"
descriptor.isInner -> "inner class" descriptor.isInner -> "inner class"
descriptor.isInline -> "inline class" descriptor.isInline -> "inline class"
descriptor.isFun -> "fun interface"
DescriptorUtils.isAnnotationClass(descriptor) -> "annotation class" DescriptorUtils.isAnnotationClass(descriptor) -> "annotation class"
else -> null else -> null
} }