Fix import resolution for some cases of malformed imports ("import some.")
Fix parsing import directives in case of non-identifier after "import" Add diagnostics test for malformed imports
This commit is contained in:
@@ -6132,6 +6132,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("MalformedImports.kt")
|
||||
public void testMalformedImports() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/imports/MalformedImports.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("PackageLocalClassNotImported.kt")
|
||||
public void testPackageLocalClassNotImported() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/imports/PackageLocalClassNotImported.kt");
|
||||
|
||||
@@ -54,9 +54,9 @@ public class JetPsiUtilTest extends JetLiteFixture {
|
||||
|
||||
public void testConvertToImportPath() {
|
||||
Assert.assertEquals(null, getImportPathFromParsed("import "));
|
||||
Assert.assertEquals(null, getImportPathFromParsed("import some."));
|
||||
Assert.assertEquals(new ImportPath(new FqName("some"), false), getImportPathFromParsed("import some."));
|
||||
Assert.assertEquals(null, getImportPathFromParsed("import *"));
|
||||
Assert.assertEquals(null, getImportPathFromParsed("import some.test.* as SomeTest"));
|
||||
Assert.assertEquals(new ImportPath(new FqName("some.test"), true), getImportPathFromParsed("import some.test.* as SomeTest"));
|
||||
Assert.assertEquals(new ImportPath(new FqName("some"), false), getImportPathFromParsed("import some?.Test"));
|
||||
|
||||
Assert.assertEquals(new ImportPath(new FqName("some"), false), getImportPathFromParsed("import some"));
|
||||
|
||||
Reference in New Issue
Block a user