[K/JS] Add warning for ES-modules on the klibgen stage on the uniqueness of the exported names from the module
This commit is contained in:
+13
@@ -356,6 +356,19 @@ class Kotlin2JsIrGradlePluginIT : KGPBaseTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("klib compilation with the declarations name clash")
|
||||
@GradleTest
|
||||
fun testProjectWithExportedNamesClash(gradleVersion: GradleVersion) {
|
||||
project("kotlin-js-invalid-project-with-exported-clash", gradleVersion) {
|
||||
build("compileKotlinJs") {
|
||||
assertOutputContains("""
|
||||
|There are clashes of declaration names that annotated with @JsExport in module 'kotlin-js-invalid-project-with-exported-clash'.
|
||||
| * Next files contain declarations with @JsExport and name 'best'
|
||||
""".trimMargin())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("per-file with the declarations validation")
|
||||
@GradleTest
|
||||
fun testPerFileProjectWithResultFilesClash(gradleVersion: GradleVersion) {
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
plugins {
|
||||
kotlin("js")
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
js(IR) {
|
||||
useEsModules()
|
||||
binaries.executable()
|
||||
nodejs()
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
kotlin.tests.individualTaskReports=true
|
||||
kotlin.incremental=false
|
||||
kotlin.incremental.js=false
|
||||
kotlin.incremental.js.ir=false
|
||||
kotlin.incremental.js.klib=false
|
||||
kotlin.incremental.multiplatform=false
|
||||
kotlin.incremental.useClasspathSnapshot=false
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Copyright 2010-2019 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.
|
||||
*/
|
||||
|
||||
package first
|
||||
|
||||
@JsExport
|
||||
fun best(): Int {
|
||||
return 42
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Copyright 2010-2019 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.
|
||||
*/
|
||||
|
||||
package second
|
||||
|
||||
@JsExport
|
||||
@JsName("best")
|
||||
public val foo = 44
|
||||
Reference in New Issue
Block a user