Workaround copied kotlin element happened to be outside the KtFile
Can be reproduced after revert with IdeLightClassTestGenerated$Local.testDollarsInNameLocal test.
This commit is contained in:
committed by
Nikolay Krasko
parent
5614afed14
commit
83e422fc3b
+6
-3
@@ -35,9 +35,12 @@ open class KtLightClassForLocalDeclaration(
|
||||
KotlinClassInnerStuffCache(
|
||||
this,
|
||||
with(KotlinModificationTrackerService.getInstance(classOrObject.project)) {
|
||||
listOf(
|
||||
outOfBlockModificationTracker, fileModificationTracker(classOrObject.containingKtFile)
|
||||
)
|
||||
val file = classOrObject.containingFile
|
||||
if (file is KtFile) {
|
||||
listOf(outOfBlockModificationTracker, fileModificationTracker(file))
|
||||
} else {
|
||||
listOf(outOfBlockModificationTracker)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -67,7 +67,8 @@ public class KtElementImplStub<T extends StubElement<?>> extends StubBasedPsiEle
|
||||
@Override
|
||||
public KtFile getContainingKtFile() {
|
||||
PsiFile file = getContainingFile();
|
||||
if(!(file instanceof KtFile)) {
|
||||
if (!(file instanceof KtFile)) {
|
||||
// KtElementImpl.copy() might be the reason for this exception
|
||||
String fileString = file.isValid() ? file.getText() : "";
|
||||
throw new IllegalStateException("KtElement not inside KtFile: " + file + fileString +
|
||||
"for element " + this + " of type " + this.getClass() + " node = " + getNode());
|
||||
|
||||
Reference in New Issue
Block a user