FE: don't create KtFile stubs on virtual files without ids

This commit is kinda revert of the change in platform 203:
https://github.com/JetBrains/intellij-community/commit/5d91f7bf2e5718d715c0d90ed1a212ea845fb2a3

#KT-49833 Fixed
This commit is contained in:
Mikhail Glukhikh
2021-11-26 15:08:37 +03:00
parent 4482c393b6
commit cebe25ff39
5 changed files with 13 additions and 0 deletions
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.psi
import com.intellij.extapi.psi.PsiFileBase
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.fileTypes.FileType
import com.intellij.openapi.vfs.VirtualFileWithId
import com.intellij.psi.*
import com.intellij.psi.stubs.StubElement
import com.intellij.psi.tree.TokenSet
@@ -189,6 +190,7 @@ open class KtFile(viewProvider: FileViewProvider, val isCompiled: Boolean) :
}
override fun getStub(): KotlinFileStub? {
if (virtualFile !is VirtualFileWithId) return null
val stub = super.getStub()
if (stub is KotlinFileStub?) {
return stub
+3
View File
@@ -0,0 +1,3 @@
$TESTDATA_DIR$/newLineInPackage.kt
-d
$TEMP_DIR$
+2
View File
@@ -0,0 +1,2 @@
package com.some
.name
+1
View File
@@ -0,0 +1 @@
OK
@@ -686,6 +686,11 @@ public class CliTestGenerated extends AbstractCliTest {
runTest("compiler/testData/cli/jvm/newInferenceWithOldFlagImpliesSamConversions.args");
}
@TestMetadata("newLineInPackage.args")
public void testNewLineInPackage() throws Exception {
runTest("compiler/testData/cli/jvm/newLineInPackage.args");
}
@TestMetadata("noReflect.args")
public void testNoReflect() throws Exception {
runTest("compiler/testData/cli/jvm/noReflect.args");