[LL FIR] reuse the same function for registering K/N FIR session components as in the compiler
So, if a new component is registered in the compiler, it's not forgotten for the LL FIR This registers `FirDelegatedMembersFilter` for K/N modules and fixes KT-64528 ^KT-64528 fixed
This commit is contained in:
committed by
Space Team
parent
9f3c093072
commit
3a90cb00c7
+6
@@ -80,6 +80,12 @@ public class LLFirNativeTestGenerated extends AbstractLLFirNativeTest {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/objCRefinement.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("resolveToDelegatedProperty.kt")
|
||||
public void testResolveToDelegatedProperty() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/resolveToDelegatedProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sharedImmutable.kt")
|
||||
public void testSharedImmutable() throws Exception {
|
||||
|
||||
+6
@@ -80,6 +80,12 @@ public class LLFirReversedNativeTestGenerated extends AbstractLLFirReversedNativ
|
||||
runTest("compiler/testData/diagnostics/nativeTests/objCRefinement.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("resolveToDelegatedProperty.kt")
|
||||
public void testResolveToDelegatedProperty() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/resolveToDelegatedProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sharedImmutable.kt")
|
||||
public void testSharedImmutable() throws Exception {
|
||||
|
||||
+10
-17
@@ -16,24 +16,21 @@ import org.jetbrains.kotlin.analysis.project.structure.KtModule
|
||||
import org.jetbrains.kotlin.analysis.project.structure.KtSourceModule
|
||||
import org.jetbrains.kotlin.analysis.providers.createPackagePartProvider
|
||||
import org.jetbrains.kotlin.fir.BuiltinTypes
|
||||
import org.jetbrains.kotlin.fir.FirVisibilityChecker
|
||||
import org.jetbrains.kotlin.fir.SessionConfiguration
|
||||
import org.jetbrains.kotlin.fir.analysis.FirDefaultOverridesBackwardCompatibilityHelper
|
||||
import org.jetbrains.kotlin.fir.analysis.FirOverridesBackwardCompatibilityHelper
|
||||
import org.jetbrains.kotlin.fir.deserialization.SingleModuleDataProvider
|
||||
import org.jetbrains.kotlin.fir.java.deserialization.OptionalAnnotationClassesProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.ConeCallConflictResolverFactory
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolProvider
|
||||
import org.jetbrains.kotlin.fir.scopes.FirKotlinScopeProvider
|
||||
import org.jetbrains.kotlin.fir.scopes.FirPlatformClassMapper
|
||||
import org.jetbrains.kotlin.fir.session.DefaultCallConflictResolverFactory
|
||||
import org.jetbrains.kotlin.fir.session.FirNativeSessionFactory.registerNativeComponents
|
||||
import org.jetbrains.kotlin.fir.session.FirSessionFactoryHelper.registerDefaultComponents
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
|
||||
@OptIn(SessionConfiguration::class)
|
||||
internal class LLFirNativeSessionFactory(project: Project) : LLFirAbstractSessionFactory(project) {
|
||||
override fun createSourcesSession(module: KtSourceModule): LLFirSourcesSession {
|
||||
return doCreateSourcesSession(module) { context ->
|
||||
registerModuleIndependentNativeComponents()
|
||||
registerDefaultComponents()
|
||||
registerNativeComponents()
|
||||
|
||||
register(
|
||||
FirSymbolProvider::class,
|
||||
@@ -52,7 +49,8 @@ internal class LLFirNativeSessionFactory(project: Project) : LLFirAbstractSessio
|
||||
|
||||
override fun createLibrarySession(module: KtModule): LLFirLibraryOrLibrarySourceResolvableModuleSession {
|
||||
return doCreateLibrarySession(module) { context ->
|
||||
registerModuleIndependentNativeComponents()
|
||||
registerDefaultComponents()
|
||||
registerNativeComponents()
|
||||
register(
|
||||
FirSymbolProvider::class,
|
||||
LLFirModuleWithDependenciesSymbolProvider(
|
||||
@@ -68,13 +66,15 @@ internal class LLFirNativeSessionFactory(project: Project) : LLFirAbstractSessio
|
||||
|
||||
override fun createBinaryLibrarySession(module: KtBinaryModule): LLFirLibrarySession {
|
||||
return doCreateBinaryLibrarySession(module) {
|
||||
registerModuleIndependentNativeComponents()
|
||||
registerDefaultComponents()
|
||||
registerNativeComponents()
|
||||
}
|
||||
}
|
||||
|
||||
override fun createDanglingFileSession(module: KtDanglingFileModule, contextSession: LLFirSession): LLFirSession {
|
||||
return doCreateDanglingFileSession(module, contextSession) {
|
||||
registerModuleIndependentNativeComponents()
|
||||
registerDefaultComponents()
|
||||
registerNativeComponents()
|
||||
|
||||
register(
|
||||
FirSymbolProvider::class,
|
||||
@@ -123,11 +123,4 @@ internal class LLFirNativeSessionFactory(project: Project) : LLFirAbstractSessio
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun LLFirSession.registerModuleIndependentNativeComponents() {
|
||||
register(FirVisibilityChecker::class, FirVisibilityChecker.Default)
|
||||
register(ConeCallConflictResolverFactory::class, DefaultCallConflictResolverFactory)
|
||||
register(FirPlatformClassMapper::class, FirPlatformClassMapper.Default)
|
||||
register(FirOverridesBackwardCompatibilityHelper::class, FirDefaultOverridesBackwardCompatibilityHelper)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,15 +95,15 @@ fun testInline4() {
|
||||
val c : (objcnames.protocols.FwdProtocol) -> Unit = ::inlineF
|
||||
}
|
||||
|
||||
fun testCheckedAs1(x : lib.FwdStruct) = x <!CAST_NEVER_SUCCEEDS!>as<!> cnames.structs.FwdStruct
|
||||
fun testCheckedAs2(x : lib.FwdObjcClass) = x <!CAST_NEVER_SUCCEEDS!>as<!> objcnames.classes.FwdObjcClass
|
||||
fun testCheckedAs1(x : lib.FwdStruct) = x as cnames.structs.FwdStruct
|
||||
fun testCheckedAs2(x : lib.FwdObjcClass) = x as objcnames.classes.FwdObjcClass
|
||||
fun testCheckedAs3(x : lib.FwdProtocol) = x as objcnames.protocols.FwdProtocol
|
||||
fun testCheckedSafeAs4(x : lib.FwdStruct) = x <!CAST_NEVER_SUCCEEDS!>as?<!> cnames.structs.FwdStruct
|
||||
fun testCheckedSafeAs5(x : lib.FwdObjcClass) = x <!CAST_NEVER_SUCCEEDS!>as?<!> objcnames.classes.FwdObjcClass
|
||||
fun testCheckedSafeAs4(x : lib.FwdStruct) = x as? cnames.structs.FwdStruct
|
||||
fun testCheckedSafeAs5(x : lib.FwdObjcClass) = x as? objcnames.classes.FwdObjcClass
|
||||
fun testCheckedSafeAs6(x : lib.FwdProtocol) = x as? objcnames.protocols.FwdProtocol
|
||||
|
||||
fun testUnCheckedAs1(x : lib2.FwdStruct) = x <!CAST_NEVER_SUCCEEDS!>as<!> cnames.structs.FwdStruct
|
||||
fun testUnCheckedAs2(x : lib2.FwdObjcClass) = x <!CAST_NEVER_SUCCEEDS!>as<!> objcnames.classes.FwdObjcClass
|
||||
fun testUnCheckedAs1(x : lib2.FwdStruct) = x as cnames.structs.FwdStruct
|
||||
fun testUnCheckedAs2(x : lib2.FwdObjcClass) = x as objcnames.classes.FwdObjcClass
|
||||
fun testUnCheckedAs3(x : lib2.FwdProtocol) = x as objcnames.protocols.FwdProtocol
|
||||
|
||||
fun testUnCheckedAs4(x : lib.FwdStruct) = x <!CAST_NEVER_SUCCEEDS!>as<!> objcnames.classes.FwdObjcClass
|
||||
fun testUnCheckedAs4(x : lib.FwdStruct) = x as objcnames.classes.FwdObjcClass
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
interface A {
|
||||
val bar: String
|
||||
}
|
||||
|
||||
interface B : A {
|
||||
override val bar: String
|
||||
}
|
||||
|
||||
abstract class C(a: A) : B, A by a
|
||||
|
||||
fun foo(c: C) {
|
||||
c.bar
|
||||
}
|
||||
+6
@@ -78,6 +78,12 @@ public class DiagnosticsNativeTestGenerated extends AbstractDiagnosticsNativeTes
|
||||
runTest("compiler/testData/diagnostics/nativeTests/objCRefinement.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("resolveToDelegatedProperty.kt")
|
||||
public void testResolveToDelegatedProperty() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/resolveToDelegatedProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sharedImmutable.kt")
|
||||
public void testSharedImmutable() throws Exception {
|
||||
|
||||
+6
@@ -82,6 +82,12 @@ public class FirLightTreeOldFrontendNativeDiagnosticsTestGenerated extends Abstr
|
||||
runTest("compiler/testData/diagnostics/nativeTests/objCRefinement.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("resolveToDelegatedProperty.kt")
|
||||
public void testResolveToDelegatedProperty() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/resolveToDelegatedProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sharedImmutable.kt")
|
||||
public void testSharedImmutable() throws Exception {
|
||||
|
||||
+6
@@ -82,6 +82,12 @@ public class FirPsiOldFrontendNativeDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/nativeTests/objCRefinement.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("resolveToDelegatedProperty.kt")
|
||||
public void testResolveToDelegatedProperty() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/resolveToDelegatedProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sharedImmutable.kt")
|
||||
public void testSharedImmutable() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user