diff options
author | Matthew Gharrity <gharrma@google.com> | 2022-11-30 17:13:01 -0800 |
---|---|---|
committer | Matthew Gharrity <gharrma@google.com> | 2022-12-05 18:01:29 +0000 |
commit | 1cb88390dfdb56cd3e0895e00233b3aa37e99fcd (patch) | |
tree | b8361a198a432a340042b10779c1ed5d72562cfa | |
parent | e4bf4e247a69ae07ac17998027bb3eb3ad5a713a (diff) | |
download | intellij-kotlin-1cb88390dfdb56cd3e0895e00233b3aa37e99fcd.tar.gz |
KTIJ-22046: Fix J2K import resolve scope
Previously, PlainTextPasteImportResolver computed a resolve scope
using the temporary file that holds pasted text. Instead it should
compute a resolve scope using the target file, since that is where
import statements will be inserted.
After this change, both 'scope' and 'resolutionFacade' are constructed
from the same target file. Thus we should no longer see issues like
KTIJ-22046 [in which the resolution facade was being queried for
descriptors outside its domain].
closes https://github.com/JetBrains/intellij-community/pull/2260
(cherry picked from commit 97bf0e2632421631ff843663b6ff0752c5ca78f7)
Bug: 259362596
Test: manual, using repro scenario from b/259362596
Change-Id: If3d34dbd722fc245b9479b6c8426fa4f5ffce37d
-rw-r--r-- | plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/conversion/copy/PlainTextPasteImportResolver.kt | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/conversion/copy/PlainTextPasteImportResolver.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/conversion/copy/PlainTextPasteImportResolver.kt index 982520cecbb3..f934a78e4714 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/conversion/copy/PlainTextPasteImportResolver.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/conversion/copy/PlainTextPasteImportResolver.kt @@ -44,7 +44,7 @@ class PlainTextPasteImportResolver(private val dataForConversion: DataForConvers private val resolutionFacade = targetFile.getResolutionFacade() private val shortNameCache = PsiShortNamesCache.getInstance(project) - private val scope = file.resolveScope + private val scope = targetFile.resolveScope private val failedToResolveReferenceNames = HashSet<String>() private var ambiguityInResolution = false |