[FIR JS] KT-57601: Get rid of the builtin provider
In this example we get 2 variants of `kotlin/toString()`: one coming from the KLib provider, and the other coming from the builtins provider. These are identical deserialized functions. ^KT-57601 Fixed
This commit is contained in:
committed by
Space Team
parent
2a391f7330
commit
360d236b7e
@@ -56,6 +56,7 @@ projectTest(
|
|||||||
defineJDKEnvVariables = listOf(JdkMajorVersion.JDK_1_8, JdkMajorVersion.JDK_11_0, JdkMajorVersion.JDK_17_0)
|
defineJDKEnvVariables = listOf(JdkMajorVersion.JDK_1_8, JdkMajorVersion.JDK_11_0, JdkMajorVersion.JDK_17_0)
|
||||||
) {
|
) {
|
||||||
dependsOn(":dist")
|
dependsOn(":dist")
|
||||||
|
useJsIrBoxTests(version = version, buildDir = "$buildDir/")
|
||||||
|
|
||||||
workingDir = rootDir
|
workingDir = rootDir
|
||||||
systemProperty("kotlin.test.script.classpath", testSourceSet.output.classesDirs.joinToString(File.pathSeparator))
|
systemProperty("kotlin.test.script.classpath", testSourceSet.output.classesDirs.joinToString(File.pathSeparator))
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ projectTest(
|
|||||||
dependsOn(":dist")
|
dependsOn(":dist")
|
||||||
workingDir = rootDir
|
workingDir = rootDir
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
|
useJsIrBoxTests(version = version, buildDir = "$buildDir/")
|
||||||
}
|
}
|
||||||
|
|
||||||
testsJar()
|
testsJar()
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.fir.deserialization.SingleModuleDataProvider
|
|||||||
import org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrar
|
import org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrar
|
||||||
import org.jetbrains.kotlin.fir.java.FirProjectSessionProvider
|
import org.jetbrains.kotlin.fir.java.FirProjectSessionProvider
|
||||||
import org.jetbrains.kotlin.fir.resolve.calls.ConeCallConflictResolverFactory
|
import org.jetbrains.kotlin.fir.resolve.calls.ConeCallConflictResolverFactory
|
||||||
import org.jetbrains.kotlin.fir.resolve.providers.impl.FirBuiltinSymbolProvider
|
import org.jetbrains.kotlin.fir.resolve.providers.impl.FirBuiltinSyntheticFunctionInterfaceProvider
|
||||||
import org.jetbrains.kotlin.fir.resolve.providers.impl.FirExtensionSyntheticFunctionInterfaceProvider
|
import org.jetbrains.kotlin.fir.resolve.providers.impl.FirExtensionSyntheticFunctionInterfaceProvider
|
||||||
import org.jetbrains.kotlin.fir.scopes.FirKotlinScopeProvider
|
import org.jetbrains.kotlin.fir.scopes.FirKotlinScopeProvider
|
||||||
import org.jetbrains.kotlin.fir.scopes.FirPlatformClassMapper
|
import org.jetbrains.kotlin.fir.scopes.FirPlatformClassMapper
|
||||||
@@ -95,10 +95,7 @@ object FirJsSessionFactory : FirAbstractSessionFactory() {
|
|||||||
createProviders = { session, builtinsModuleData, kotlinScopeProvider ->
|
createProviders = { session, builtinsModuleData, kotlinScopeProvider ->
|
||||||
listOfNotNull(
|
listOfNotNull(
|
||||||
KlibBasedSymbolProvider(session, moduleDataProvider, kotlinScopeProvider, resolvedLibraries),
|
KlibBasedSymbolProvider(session, moduleDataProvider, kotlinScopeProvider, resolvedLibraries),
|
||||||
// (Most) builtins should be taken from the dependencies in JS compilation, therefore builtins provider is the last one
|
FirBuiltinSyntheticFunctionInterfaceProvider(session, builtinsModuleData, kotlinScopeProvider),
|
||||||
// TODO: consider using "poisoning" provider for builtins to ensure that proper ones are taken from dependencies
|
|
||||||
// NOTE: it requires precise filtering for true builtins, like Function*
|
|
||||||
FirBuiltinSymbolProvider(session, builtinsModuleData, kotlinScopeProvider),
|
|
||||||
FirExtensionSyntheticFunctionInterfaceProvider.createIfNeeded(session, builtinsModuleData, kotlinScopeProvider),
|
FirExtensionSyntheticFunctionInterfaceProvider.createIfNeeded(session, builtinsModuleData, kotlinScopeProvider),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,10 +43,12 @@ sourceSets {
|
|||||||
projectTest(parallel = true) {
|
projectTest(parallel = true) {
|
||||||
workingDir = rootDir
|
workingDir = rootDir
|
||||||
dependsOn(":kotlin-stdlib-js-ir:packFullRuntimeKLib")
|
dependsOn(":kotlin-stdlib-js-ir:packFullRuntimeKLib")
|
||||||
|
useJsIrBoxTests(version = version, buildDir = "$buildDir/")
|
||||||
}
|
}
|
||||||
|
|
||||||
projectTest("testJvmICWithJdk11", parallel = true) {
|
projectTest("testJvmICWithJdk11", parallel = true) {
|
||||||
workingDir = rootDir
|
workingDir = rootDir
|
||||||
|
useJsIrBoxTests(version = version, buildDir = "$buildDir/")
|
||||||
filter {
|
filter {
|
||||||
includeTestsMatching("org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunnerTestGenerated*")
|
includeTestsMatching("org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunnerTestGenerated*")
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
@@ -5,3 +5,5 @@ $TESTDATA_DIR$/fir.kt
|
|||||||
$TEMP_DIR$
|
$TEMP_DIR$
|
||||||
-ir-output-name
|
-ir-output-name
|
||||||
fir
|
fir
|
||||||
|
-libraries
|
||||||
|
libraries/stdlib/js-ir/build/classes/kotlin/js/main
|
||||||
|
|||||||
Vendored
+2
@@ -8,3 +8,5 @@ $TEMP_DIR$
|
|||||||
-ir-output-name
|
-ir-output-name
|
||||||
firMpp
|
firMpp
|
||||||
-XXLanguage\:+MultiPlatformProjects
|
-XXLanguage\:+MultiPlatformProjects
|
||||||
|
-libraries
|
||||||
|
libraries/stdlib/js-ir/build/classes/kotlin/js/main
|
||||||
|
|||||||
@@ -9,3 +9,5 @@ $TEMP_DIR$
|
|||||||
firMppWithKlib
|
firMppWithKlib
|
||||||
-XXLanguage\:+MultiPlatformProjects
|
-XXLanguage\:+MultiPlatformProjects
|
||||||
-Xir-produce-klib-file=true
|
-Xir-produce-klib-file=true
|
||||||
|
-libraries
|
||||||
|
libraries/stdlib/js-ir/build/classes/kotlin/js/main
|
||||||
|
|||||||
@@ -14,3 +14,5 @@ fir-hmpp
|
|||||||
-Xfragment-sources=c\:$TESTDATA_DIR$/../jvm/hmpp/src/c.kt
|
-Xfragment-sources=c\:$TESTDATA_DIR$/../jvm/hmpp/src/c.kt
|
||||||
-Xfragment-refines=b\:a
|
-Xfragment-refines=b\:a
|
||||||
-Xfragment-refines=c\:b
|
-Xfragment-refines=c\:b
|
||||||
|
-libraries
|
||||||
|
libraries/stdlib/js-ir/build/classes/kotlin/js/main
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
import kotlin.Cloneable
|
import kotlin.<!UNRESOLVED_IMPORT!>Cloneable<!>
|
||||||
|
|
||||||
fun cloneable(): Cloneable = intArrayOf(42)
|
fun cloneable(): <!UNRESOLVED_REFERENCE!>Cloneable<!> = intArrayOf(42)
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
// SKIP_KLIB_TEST
|
// SKIP_KLIB_TEST
|
||||||
// IGNORE_BACKEND_K1: JS_IR
|
// IGNORE_BACKEND_K1: JS_IR
|
||||||
// IGNORE_BACKEND_K1: JS_IR_ES6
|
// IGNORE_BACKEND_K1: JS_IR_ES6
|
||||||
|
// IGNORE_BACKEND_K2: JS_IR
|
||||||
|
// IGNORE_BACKEND_K2: JS_IR_ES6
|
||||||
|
// STATUS: This should not work in JS, Cloneable is JVM-specific API
|
||||||
|
|
||||||
class A : Cloneable
|
class A : Cloneable
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_K2: JS_IR
|
|
||||||
// KJS_WITH_FULL_RUNTIME
|
// KJS_WITH_FULL_RUNTIME
|
||||||
// EXPECTED_REACHABLE_NODES: 1378
|
// EXPECTED_REACHABLE_NODES: 1378
|
||||||
package foo
|
package foo
|
||||||
|
|||||||
Reference in New Issue
Block a user