Fix test on unused import suppression

Before the fix for KT-7185, the file looked like:
package suppression
@file:Suppress("UnusedImport")

import java.io.* // unused

And it was parsed incorrectly, because @file: annotations
should come before package directive
But after fix, import directives started being parsed that lead
to wrong unused import (because suppression wasn't parsed still)
This commit is contained in:
Denis Zharkov
2019-01-09 15:24:02 +03:00
parent db53c4bea4
commit 37614254d7
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -1,3 +1,4 @@
@file:Suppress("UnusedImport")
package suppression
import java.io.* // unused
import java.io.* // unused
@@ -94,7 +94,7 @@ abstract class AbstractInspectionTest : KotlinLightCodeInsightFixtureTestCase()
file.extension == "kt" -> {
val text = FileUtil.loadFile(file, true)
val fileText =
if (text.startsWith("package"))
if (text.lines().any { it.startsWith("package") })
text
else
"package ${file.nameWithoutExtension};$text"