[JS, Frontend] Forbid @JsExporting inline/value classes
Previously the compiler would just crash. #KT-46202 Fixed
This commit is contained in:
+13
@@ -1,5 +1,6 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.js.ExperimentalJsExport
|
||||
// !RENDER_DIAGNOSTICS_MESSAGES
|
||||
// !DIAGNOSTICS: -INLINE_CLASS_DEPRECATED
|
||||
|
||||
package foo
|
||||
|
||||
@@ -24,3 +25,15 @@ interface <!WRONG_EXPORTED_DECLARATION("interface")!>SomeInterface<!>
|
||||
|
||||
@JsExport
|
||||
external interface GoodInterface
|
||||
|
||||
@JsExport
|
||||
value class <!WRONG_EXPORTED_DECLARATION("value class")!>A(val a: Int)<!>
|
||||
|
||||
@JsExport
|
||||
inline class <!WRONG_EXPORTED_DECLARATION("inline class")!>B(val b: Int)<!>
|
||||
|
||||
@JsExport
|
||||
inline value class <!WRONG_EXPORTED_DECLARATION("inline value class")!>C(val c: Int)<!>
|
||||
|
||||
@JsExport
|
||||
value inline class <!WRONG_EXPORTED_DECLARATION("inline value class")!>D(val d: Int)<!>
|
||||
|
||||
+32
@@ -5,6 +5,14 @@ package foo {
|
||||
@kotlin.js.JsExport public inline fun </*0*/ reified T> inlineReifiedFun(/*0*/ x: kotlin.Any): kotlin.Boolean
|
||||
@kotlin.js.JsExport public suspend fun suspendFun(): kotlin.Unit
|
||||
|
||||
@kotlin.js.JsExport public final value class A {
|
||||
public constructor A(/*0*/ a: kotlin.Int)
|
||||
public final val a: kotlin.Int
|
||||
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.js.JsExport public final annotation class AnnotationClass : kotlin.Annotation {
|
||||
public constructor AnnotationClass()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@@ -12,6 +20,30 @@ package foo {
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.js.JsExport public final inline class B {
|
||||
public constructor B(/*0*/ b: kotlin.Int)
|
||||
public final val b: kotlin.Int
|
||||
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.js.JsExport public final inline value class C {
|
||||
public constructor C(/*0*/ c: kotlin.Int)
|
||||
public final val c: kotlin.Int
|
||||
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.js.JsExport public final inline value class D {
|
||||
public constructor D(/*0*/ d: kotlin.Int)
|
||||
public final val d: kotlin.Int
|
||||
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.js.JsExport public final enum class EnumClass : kotlin.Enum<foo.EnumClass> {
|
||||
enum entry ENTRY1
|
||||
|
||||
|
||||
+4
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.resolve.checkers.DeclarationCheckerContext
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyExternal
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.isExtensionProperty
|
||||
import org.jetbrains.kotlin.resolve.inline.isInlineWithReified
|
||||
import org.jetbrains.kotlin.resolve.isInlineClass
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.isDynamic
|
||||
import org.jetbrains.kotlin.types.typeUtil.*
|
||||
@@ -111,6 +112,9 @@ object JsExportDeclarationChecker : DeclarationChecker {
|
||||
ENUM_CLASS -> "enum class"
|
||||
INTERFACE -> if (descriptor.isExternal) null else "interface"
|
||||
ANNOTATION_CLASS -> "annotation class"
|
||||
CLASS -> if (descriptor.isInlineClass()) {
|
||||
"${if (descriptor.isInline) "inline " else ""}${if (descriptor.isValue) "value " else ""}class"
|
||||
} else null
|
||||
else -> null
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user