Fix script resolver failing
Specifically the case where some lib is in project dependencies and script dependencies at the same time #EA-105435 at least partially fixed #KT-19458 Fixed #KT-19474 Fixed
This commit is contained in:
+2
-1
@@ -33,6 +33,7 @@ import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.lazy.AbsentDescriptorHandler
|
||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult
|
||||
|
||||
internal class ResolutionFacadeImpl(
|
||||
private val projectFacade: ProjectResolutionFacade,
|
||||
@@ -84,7 +85,7 @@ internal class ResolutionFacadeImpl(
|
||||
}
|
||||
|
||||
override fun <T : Any> tryGetFrontendService(element: PsiElement, serviceClass: Class<T>): T? {
|
||||
return projectFacade.resolverForModuleInfo(element.getModuleInfo()).componentProvider.tryGetService(serviceClass)
|
||||
return element.getModuleInfos().firstNotNullResult { projectFacade.tryGetResolverForModuleInfo(it)?.componentProvider?.tryGetService(serviceClass) }
|
||||
}
|
||||
|
||||
fun <T : Any> getFrontendService(ideaModuleInfo: IdeaModuleInfo, serviceClass: Class<T>): T {
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package test;
|
||||
|
||||
public class Utils {
|
||||
public static void foo(String str) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
fun f(g: <error>Utils</error>) {
|
||||
|
||||
}
|
||||
|
||||
// DEPENDENCIES: classpath:lib-classes
|
||||
// CONFLICTING_MODULE
|
||||
+6
@@ -54,6 +54,12 @@ public class ScriptConfigurationHighlightingTestGenerated extends AbstractScript
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("conflictingModule")
|
||||
public void testConflictingModule() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/script/definition/highlighting/conflictingModule/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("customBaseClass")
|
||||
public void testCustomBaseClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/script/definition/highlighting/customBaseClass/");
|
||||
|
||||
Reference in New Issue
Block a user