Support synthetic java properties in REPL
Use brand new iterable injection
This commit is contained in:
@@ -66,6 +66,7 @@ public fun StorageComponentContainer.configureJavaTopDownAnalysis(moduleContentS
|
||||
useImpl<JavaSourceElementFactoryImpl>()
|
||||
useImpl<JavaLazyAnalyzerPostConstruct>()
|
||||
useImpl<JavaFlexibleTypeCapabilitiesProvider>()
|
||||
useImpl<AdditionalScopesWithJavaSyntheticExtensions>()
|
||||
}
|
||||
|
||||
public fun createContainerForLazyResolveWithJava(
|
||||
@@ -75,7 +76,6 @@ public fun createContainerForLazyResolveWithJava(
|
||||
configureModule(moduleContext, KotlinJvmCheckerProvider(moduleContext.module), bindingTrace)
|
||||
configureJavaTopDownAnalysis(moduleContentScope, moduleContext.project)
|
||||
|
||||
useImpl<AdditionalScopesWithJavaSyntheticExtensions>()
|
||||
useInstance(moduleClassResolver)
|
||||
|
||||
useInstance(declarationProviderFactory)
|
||||
@@ -97,7 +97,6 @@ public fun createContainerForTopDownAnalyzerForJvm(
|
||||
configureModule(moduleContext, KotlinJvmCheckerProvider(moduleContext.module), bindingTrace)
|
||||
configureJavaTopDownAnalysis(moduleContentScope, moduleContext.project)
|
||||
|
||||
useImpl<AdditionalScopesWithJavaSyntheticExtensions>()
|
||||
useInstance(declarationProviderFactory)
|
||||
useInstance(BodyResolveCache.ThrowException)
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.storage.get
|
||||
|
||||
public class FileScopeProviderImpl(
|
||||
private val resolveSession: ResolveSession,
|
||||
private val additionalScopes: FileScopeProvider.AdditionalScopes
|
||||
private val additionalScopes: Iterable<FileScopeProvider.AdditionalScopes>
|
||||
) : FileScopeProvider {
|
||||
|
||||
private val defaultImports by resolveSession.getStorageManager().createLazyValue {
|
||||
@@ -37,7 +37,7 @@ public class FileScopeProviderImpl(
|
||||
private fun createFileScope(file: JetFile): LazyFileScope {
|
||||
val tempTrace = TemporaryBindingTrace.create(resolveSession.getTrace(), "Transient trace for default imports lazy resolve")
|
||||
return LazyFileScope.create(
|
||||
resolveSession, file, defaultImports, additionalScopes.scopes(file),
|
||||
resolveSession, file, defaultImports, additionalScopes.flatMap { it.scopes(file) },
|
||||
resolveSession.getTrace(), tempTrace, "LazyFileScope for file " + file.getName()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
>>> java.util.Date(0).time
|
||||
0
|
||||
@@ -286,4 +286,19 @@ public class ReplInterpreterTestGenerated extends AbstractReplInterpreterTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/repl/useJava")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class UseJava extends AbstractReplInterpreterTest {
|
||||
public void testAllFilesPresentInUseJava() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/repl/useJava"), Pattern.compile("^(.+)\\.repl$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("syntheticProperty.repl")
|
||||
public void testSyntheticProperty() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/repl/useJava/syntheticProperty.repl");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user