From 15f8ba811b64f6f55b0e2898e0a205cdb540b0b1 Mon Sep 17 00:00:00 2001 From: Yan Zhulanow Date: Fri, 13 Mar 2015 19:32:38 +0300 Subject: [PATCH] Return moduleInfo UserDataProperty if it was explicitly set --- .../org/jetbrains/kotlin/idea/caches/resolve/getModuleInfo.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/getModuleInfo.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/getModuleInfo.kt index d3b1aa6d2a5..4082a9d15e3 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/getModuleInfo.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/getModuleInfo.kt @@ -48,6 +48,9 @@ fun PsiElement.getModuleInfo(): IdeaModuleInfo { ) } + val explicitModuleInfo = containingJetFile?.moduleInfo + if (explicitModuleInfo is IdeaModuleInfo) return explicitModuleInfo + if (containingJetFile is JetCodeFragment) { return containingJetFile.getContext()?.getModuleInfo() ?: logAndReturnDefault("Analyzing code fragment of type ${containingJetFile.javaClass} with no context element\nText:\n${containingJetFile.getText()}")