PackageDirectoryMismatchInspection: fix exception from empty script file
#KT-33437 Fixed
This commit is contained in:
+1
-1
@@ -35,7 +35,7 @@ import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||
class PackageDirectoryMismatchInspection : AbstractKotlinInspection() {
|
||||
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean) = packageDirectiveVisitor(fun(directive: KtPackageDirective) {
|
||||
val file = directive.containingKtFile
|
||||
if (file.isInjectedFragment || file.packageMatchesDirectoryOrImplicit()) return
|
||||
if (file.textLength == 0 || file.isInjectedFragment || file.packageMatchesDirectoryOrImplicit()) return
|
||||
|
||||
val fixes = mutableListOf<LocalQuickFix>()
|
||||
val qualifiedName = directive.qualifiedName
|
||||
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
<problems>
|
||||
</problems>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"inspectionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.PackageDirectoryMismatchInspection"
|
||||
}
|
||||
+5
@@ -49,6 +49,11 @@ public class MultiFileInspectionTestGenerated extends AbstractMultiFileInspectio
|
||||
runTest("idea/testData/multiFileInspections/mainInTwoModules/mainInTwoModules.test");
|
||||
}
|
||||
|
||||
@TestMetadata("mismatchedPackageDirectoryWithEmptyKts/mismatchedPackageDirectoryWithEmptyKts.test")
|
||||
public void testMismatchedPackageDirectoryWithEmptyKts_MismatchedPackageDirectoryWithEmptyKts() throws Exception {
|
||||
runTest("idea/testData/multiFileInspections/mismatchedPackageDirectoryWithEmptyKts/mismatchedPackageDirectoryWithEmptyKts.test");
|
||||
}
|
||||
|
||||
@TestMetadata("mismatchedProjectAndDirectory/mismatchedProjectAndDirectory.test")
|
||||
public void testMismatchedProjectAndDirectory_MismatchedProjectAndDirectory() throws Exception {
|
||||
runTest("idea/testData/multiFileInspections/mismatchedProjectAndDirectory/mismatchedProjectAndDirectory.test");
|
||||
|
||||
Reference in New Issue
Block a user