[JS] JsExport diagnostics and legacy support

Account for JsExport in legacy backend namer. It means we
catch overloaded exported function conflicts for free!

Add error diagnostics:
* NESTED_JS_EXPORT (Fixes KT-36798)
* WRONG_EXPORTED_DECLARATION (Part of the fix for KT-37752)
* NON_EXPORTABLE_TYPE (Fixes KT-37771)
This commit is contained in:
Svyatoslav Kuzmich
2019-08-29 18:25:09 +03:00
parent 4076bf40a9
commit 6e3d3831c2
52 changed files with 972 additions and 72 deletions
+25 -4
View File
@@ -162,12 +162,33 @@ public annotation class JsNonModule
public annotation class JsQualifier(val value: String)
/**
* Exports top-level declaration.
* Exports top-level declaration on JS platform.
*
* Compiler exports from the module those top-level declarations that are marked with this annotation.
* There is no effect if this annotation is applied to a non-top-level declaration.
* Compiled module exposes declarations that are marked with this annotation without name mangling.
*
* This annotation has effect only on top-level declarations and only in IR-based JS backend.
* This annotation can be applied to either files or top-level declarations.
*
* It is currently prohibited to export the following kinds of declarations:
*
* * `expect` declarations
* * inline functions with reified type parameters
* * suspend functions
* * secondary constructors without `@JsName`
* * extension properties
* * enum classes
* * annotation classes
*
* Signatures of exported declarations must only contain "exportable" types:
*
* * `dynamic`, `Any`, `String`, `Boolean`, `Byte`, `Short`, `Int`, `Float`, `Double`
* * `BooleanArray`, `ByteArray`, `ShortArray`, `IntArray`, `FloatArray`, `DoubleArray`
* * `Array<exportable-type>`
* * Function types with exportable parameters and return types
* * `external` or `@JsExport` classes and interfaces
* * Nullable counterparts of types above
* * Unit return type. Must not be nullable
*
* This annotation is experimental, meaning that restrictions mentioned above are subject to change.
*/
@ExperimentalJsExport
@Retention(AnnotationRetention.BINARY)