diff --git a/plugins/kotlin/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt b/plugins/kotlin/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt index b0759939e00f..030dc54d3cfb 100644 --- a/plugins/kotlin/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt +++ b/plugins/kotlin/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt @@ -387,7 +387,7 @@ fun main(args: Array) { } testClass(javaClass()) { - model("resolve/references") + model("resolve/references", pattern = """^([^\.]+)\.kt$""") } testClass(javaClass()) { diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/jet/resolve/AbstractReferenceResolveTest.java b/plugins/kotlin/idea/tests/test/org/jetbrains/jet/resolve/AbstractReferenceResolveTest.java index e9561d50ea53..fbb3de969f07 100644 --- a/plugins/kotlin/idea/tests/test/org/jetbrains/jet/resolve/AbstractReferenceResolveTest.java +++ b/plugins/kotlin/idea/tests/test/org/jetbrains/jet/resolve/AbstractReferenceResolveTest.java @@ -32,6 +32,7 @@ import org.jetbrains.jet.InTextDirectivesUtils; import org.jetbrains.jet.plugin.JetWithJdkAndRuntimeLightProjectDescriptor; import org.jetbrains.jet.testing.ReferenceUtils; +import java.io.File; import java.util.List; public abstract class AbstractReferenceResolveTest extends LightPlatformCodeInsightFixtureTestCase { @@ -63,7 +64,14 @@ public abstract class AbstractReferenceResolveTest extends LightPlatformCodeInsi } protected void doTest(String path) { - myFixture.configureByFile(path); + assert path.endsWith(".kt") : path; + String extraFile = path.replace(".kt", ".Data.kt"); + if (new File(extraFile).exists()) { + myFixture.configureByFiles(path, extraFile); + } + else { + myFixture.configureByFile(path); + } if (InTextDirectivesUtils.isDirectiveDefined(myFixture.getFile().getText(), MULTIRESOLVE)) { doMultiResolveTest(); diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/jet/resolve/ReferenceResolveTestGenerated.java b/plugins/kotlin/idea/tests/test/org/jetbrains/jet/resolve/ReferenceResolveTestGenerated.java index d44f1adb0698..aff6279f2c70 100644 --- a/plugins/kotlin/idea/tests/test/org/jetbrains/jet/resolve/ReferenceResolveTestGenerated.java +++ b/plugins/kotlin/idea/tests/test/org/jetbrains/jet/resolve/ReferenceResolveTestGenerated.java @@ -34,7 +34,7 @@ import org.jetbrains.jet.resolve.AbstractReferenceResolveTest; @InnerTestClasses({ReferenceResolveTestGenerated.DelegatedPropertyAccessors.class, ReferenceResolveTestGenerated.ForLoopIn.class, ReferenceResolveTestGenerated.Invoke.class}) public class ReferenceResolveTestGenerated extends AbstractReferenceResolveTest { public void testAllFilesPresentInReferences() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/resolve/references"), Pattern.compile("^(.+)\\.kt$"), true); + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/resolve/references"), Pattern.compile("^([^\\.]+)\\.kt$"), true); } @TestMetadata("AnnotationForClass.kt") @@ -72,6 +72,31 @@ public class ReferenceResolveTestGenerated extends AbstractReferenceResolveTest doTest("idea/testData/resolve/references/CtrlClickResolve.kt"); } + @TestMetadata("DontImportRootScope.kt") + public void testDontImportRootScope() throws Exception { + doTest("idea/testData/resolve/references/DontImportRootScope.kt"); + } + + @TestMetadata("FakeJavaLang1.kt") + public void testFakeJavaLang1() throws Exception { + doTest("idea/testData/resolve/references/FakeJavaLang1.kt"); + } + + @TestMetadata("FakeJavaLang2.kt") + public void testFakeJavaLang2() throws Exception { + doTest("idea/testData/resolve/references/FakeJavaLang2.kt"); + } + + @TestMetadata("FakeJavaLang3.kt") + public void testFakeJavaLang3() throws Exception { + doTest("idea/testData/resolve/references/FakeJavaLang3.kt"); + } + + @TestMetadata("FakeJavaLang4.kt") + public void testFakeJavaLang4() throws Exception { + doTest("idea/testData/resolve/references/FakeJavaLang4.kt"); + } + @TestMetadata("GenericFunctionParameter.kt") public void testGenericFunctionParameter() throws Exception { doTest("idea/testData/resolve/references/GenericFunctionParameter.kt"); @@ -176,7 +201,7 @@ public class ReferenceResolveTestGenerated extends AbstractReferenceResolveTest @InnerTestClasses({DelegatedPropertyAccessors.InSource.class, DelegatedPropertyAccessors.InStandardLibrary.class}) public static class DelegatedPropertyAccessors extends AbstractReferenceResolveTest { public void testAllFilesPresentInDelegatedPropertyAccessors() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/resolve/references/delegatedPropertyAccessors"), Pattern.compile("^(.+)\\.kt$"), true); + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/resolve/references/delegatedPropertyAccessors"), Pattern.compile("^([^\\.]+)\\.kt$"), true); } @TestMetadata("unresolved.kt") @@ -187,7 +212,7 @@ public class ReferenceResolveTestGenerated extends AbstractReferenceResolveTest @TestMetadata("idea/testData/resolve/references/delegatedPropertyAccessors/inSource") public static class InSource extends AbstractReferenceResolveTest { public void testAllFilesPresentInInSource() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/resolve/references/delegatedPropertyAccessors/inSource"), Pattern.compile("^(.+)\\.kt$"), true); + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/resolve/references/delegatedPropertyAccessors/inSource"), Pattern.compile("^([^\\.]+)\\.kt$"), true); } @TestMetadata("getExtension.kt") @@ -225,7 +250,7 @@ public class ReferenceResolveTestGenerated extends AbstractReferenceResolveTest @TestMetadata("idea/testData/resolve/references/delegatedPropertyAccessors/inStandardLibrary") public static class InStandardLibrary extends AbstractReferenceResolveTest { public void testAllFilesPresentInInStandardLibrary() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/resolve/references/delegatedPropertyAccessors/inStandardLibrary"), Pattern.compile("^(.+)\\.kt$"), true); + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/resolve/references/delegatedPropertyAccessors/inStandardLibrary"), Pattern.compile("^([^\\.]+)\\.kt$"), true); } @TestMetadata("lazy.kt") @@ -253,7 +278,7 @@ public class ReferenceResolveTestGenerated extends AbstractReferenceResolveTest @InnerTestClasses({ForLoopIn.InBuiltIns.class, ForLoopIn.InLibrary.class, ForLoopIn.InSource.class}) public static class ForLoopIn extends AbstractReferenceResolveTest { public void testAllFilesPresentInForLoopIn() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/resolve/references/forLoopIn"), Pattern.compile("^(.+)\\.kt$"), true); + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/resolve/references/forLoopIn"), Pattern.compile("^([^\\.]+)\\.kt$"), true); } @TestMetadata("unresolvedIterator.kt") @@ -264,7 +289,7 @@ public class ReferenceResolveTestGenerated extends AbstractReferenceResolveTest @TestMetadata("idea/testData/resolve/references/forLoopIn/inBuiltIns") public static class InBuiltIns extends AbstractReferenceResolveTest { public void testAllFilesPresentInInBuiltIns() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/resolve/references/forLoopIn/inBuiltIns"), Pattern.compile("^(.+)\\.kt$"), true); + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/resolve/references/forLoopIn/inBuiltIns"), Pattern.compile("^([^\\.]+)\\.kt$"), true); } @TestMetadata("extension.kt") @@ -282,7 +307,7 @@ public class ReferenceResolveTestGenerated extends AbstractReferenceResolveTest @TestMetadata("idea/testData/resolve/references/forLoopIn/inLibrary") public static class InLibrary extends AbstractReferenceResolveTest { public void testAllFilesPresentInInLibrary() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/resolve/references/forLoopIn/inLibrary"), Pattern.compile("^(.+)\\.kt$"), true); + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/resolve/references/forLoopIn/inLibrary"), Pattern.compile("^([^\\.]+)\\.kt$"), true); } @TestMetadata("extension.kt") @@ -300,7 +325,7 @@ public class ReferenceResolveTestGenerated extends AbstractReferenceResolveTest } public void testAllFilesPresentInInSource() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/resolve/references/forLoopIn/inSource"), Pattern.compile("^(.+)\\.kt$"), true); + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/resolve/references/forLoopIn/inSource"), Pattern.compile("^([^\\.]+)\\.kt$"), true); } @TestMetadata("allMembers.kt") @@ -328,7 +353,7 @@ public class ReferenceResolveTestGenerated extends AbstractReferenceResolveTest @TestMetadata("idea/testData/resolve/references/invoke") public static class Invoke extends AbstractReferenceResolveTest { public void testAllFilesPresentInInvoke() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/resolve/references/invoke"), Pattern.compile("^(.+)\\.kt$"), true); + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/resolve/references/invoke"), Pattern.compile("^([^\\.]+)\\.kt$"), true); } @TestMetadata("lambdaAndParens.kt") diff --git a/plugins/kotlin/idea/tests/testData/navigation/implementations/multifile/ImplementJavaAbstractClassInKotlin/ImplementJavaAbstractClassInKotlin.kt b/plugins/kotlin/idea/tests/testData/navigation/implementations/multifile/ImplementJavaAbstractClassInKotlin/ImplementJavaAbstractClassInKotlin.kt index 21d907963bd7..d3fdeedd6877 100644 --- a/plugins/kotlin/idea/tests/testData/navigation/implementations/multifile/ImplementJavaAbstractClassInKotlin/ImplementJavaAbstractClassInKotlin.kt +++ b/plugins/kotlin/idea/tests/testData/navigation/implementations/multifile/ImplementJavaAbstractClassInKotlin/ImplementJavaAbstractClassInKotlin.kt @@ -1,5 +1,3 @@ -package testing.kt - class KotlinImpl : JavaBase() -// REF: (testing.kt).KotlinImpl \ No newline at end of file +// REF: ().KotlinImpl \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/navigation/implementations/multifile/ImplementJavaClassInKotlin/ImplementJavaClassInKotlin.kt b/plugins/kotlin/idea/tests/testData/navigation/implementations/multifile/ImplementJavaClassInKotlin/ImplementJavaClassInKotlin.kt index 7116ff654fab..2cd806aaf0c5 100644 --- a/plugins/kotlin/idea/tests/testData/navigation/implementations/multifile/ImplementJavaClassInKotlin/ImplementJavaClassInKotlin.kt +++ b/plugins/kotlin/idea/tests/testData/navigation/implementations/multifile/ImplementJavaClassInKotlin/ImplementJavaClassInKotlin.kt @@ -1,6 +1,4 @@ -package testing.kt - class KotlinImpl : JavaBase() -// REF: (testing.kt).KotlinImpl +// REF: ().KotlinImpl // REF: JavaBase diff --git a/plugins/kotlin/idea/tests/testData/navigation/implementations/multifile/ImplementJavaInterfaceInKotlin/ImplementJavaInterfaceInKotlin.kt b/plugins/kotlin/idea/tests/testData/navigation/implementations/multifile/ImplementJavaInterfaceInKotlin/ImplementJavaInterfaceInKotlin.kt index 23ba8de37998..f838bd56236b 100644 --- a/plugins/kotlin/idea/tests/testData/navigation/implementations/multifile/ImplementJavaInterfaceInKotlin/ImplementJavaInterfaceInKotlin.kt +++ b/plugins/kotlin/idea/tests/testData/navigation/implementations/multifile/ImplementJavaInterfaceInKotlin/ImplementJavaInterfaceInKotlin.kt @@ -1,8 +1,6 @@ -package testing.kt - trait KotlinTrait: JavaBase class KotlinClass : JavaBase -// REF: (testing.kt).KotlinClass -// REF: (testing.kt).KotlinTrait \ No newline at end of file +// REF: ().KotlinClass +// REF: ().KotlinTrait \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/navigation/implementations/multifile/ImplementMethodInKotlin/ImplementMethodInKotlin.kt b/plugins/kotlin/idea/tests/testData/navigation/implementations/multifile/ImplementMethodInKotlin/ImplementMethodInKotlin.kt index d965c46c475e..93fc1c179c5d 100644 --- a/plugins/kotlin/idea/tests/testData/navigation/implementations/multifile/ImplementMethodInKotlin/ImplementMethodInKotlin.kt +++ b/plugins/kotlin/idea/tests/testData/navigation/implementations/multifile/ImplementMethodInKotlin/ImplementMethodInKotlin.kt @@ -1,5 +1,3 @@ -package testing.kt - class TestFromJava() : BaseJava() { override fun testMethod() { } @@ -9,5 +7,5 @@ fun test() { BaseJava().testMethod() } -// REF: (in testing.kt.TestFromJava).testMethod() +// REF: (in TestFromJava).testMethod() // REF: (in BaseJava).testMethod() diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/divOperator.after.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/divOperator.after.kt index 2f89d418e44d..2143938a0b41 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/divOperator.after.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/divOperator.after.kt @@ -1,6 +1,8 @@ // "Import" "true" // ERROR: Unresolved reference: / +package h + import util.div trait H diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/divOperator.before.Main.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/divOperator.before.Main.kt index 66c033fcf116..4c1866501ef2 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/divOperator.before.Main.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/divOperator.before.Main.kt @@ -1,6 +1,8 @@ // "Import" "true" // ERROR: Unresolved reference: / +package h + trait H fun f(h: H) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/divOperator.before.data.Sample.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/divOperator.before.data.Sample.kt index dad0485091e7..1f4325100504 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/divOperator.before.data.Sample.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/divOperator.before.data.Sample.kt @@ -1,3 +1,3 @@ package util -fun H.div(i: Int) = 3 \ No newline at end of file +fun h.H.div(i: Int) = 3 \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/infixCall.after.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/infixCall.after.kt index 90bfb4bdaf0b..878c6d59211a 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/infixCall.after.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/infixCall.after.kt @@ -1,6 +1,8 @@ // "Import" "true" // ERROR: Unresolved reference: foo +package h + import util.foo trait H diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/infixCall.before.Main.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/infixCall.before.Main.kt index 02a99243605f..10edb71f9f9c 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/infixCall.before.Main.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/infixCall.before.Main.kt @@ -1,6 +1,8 @@ // "Import" "true" // ERROR: Unresolved reference: foo +package h + trait H fun f(h: H) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/infixCall.before.data.Sample.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/infixCall.before.data.Sample.kt index a07e13b8e7aa..f315b6e2c1f9 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/infixCall.before.data.Sample.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/infixCall.before.data.Sample.kt @@ -1,3 +1,3 @@ package util -fun H.foo(other: H) = "" \ No newline at end of file +fun h.H.foo(other: h.H) = "" \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/minusOperator.after.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/minusOperator.after.kt index 55f647f430ec..06644b267f08 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/minusOperator.after.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/minusOperator.after.kt @@ -1,5 +1,7 @@ // "Import" "true" -// ERROR: Unresolved reference.
None of the following candidates is applicable because of receiver type mismatch:
  • internal fun jet.String.minus(str: jet.String): jet.String defined in root package
  • internal fun jet.String.minus(i: java.lang.Integer): jet.String defined in root package
+// ERROR: Unresolved reference.
None of the following candidates is applicable because of receiver type mismatch:
  • internal fun jet.String.minus(str: jet.String): jet.String defined in h
  • internal fun jet.String.minus(i: java.lang.Integer): jet.String defined in h
+ +package h import util.minus diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/minusOperator.before.Main.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/minusOperator.before.Main.kt index bc69cfe76aad..1801014d50c6 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/minusOperator.before.Main.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/minusOperator.before.Main.kt @@ -1,5 +1,7 @@ // "Import" "true" -// ERROR: Unresolved reference.
None of the following candidates is applicable because of receiver type mismatch:
  • internal fun jet.String.minus(str: jet.String): jet.String defined in root package
  • internal fun jet.String.minus(i: java.lang.Integer): jet.String defined in root package
+// ERROR: Unresolved reference.
None of the following candidates is applicable because of receiver type mismatch:
  • internal fun jet.String.minus(str: jet.String): jet.String defined in h
  • internal fun jet.String.minus(i: java.lang.Integer): jet.String defined in h
+ +package h trait H diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/minusOperator.before.data.Sample.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/minusOperator.before.data.Sample.kt index a885949583ee..d52b85c02d57 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/minusOperator.before.data.Sample.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/minusOperator.before.data.Sample.kt @@ -1,3 +1,3 @@ package util -fun H?.minus(s: String) = "" \ No newline at end of file +fun h.H?.minus(s: String) = "" \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/plusOperator.after.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/plusOperator.after.kt index 010b6e9720ed..f586caaf65c0 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/plusOperator.after.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/plusOperator.after.kt @@ -1,6 +1,8 @@ // "Import" "true" // ERROR: Unresolved reference.
None of the following candidates is applicable because of receiver type mismatch:
  • public fun jet.String?.plus(other: jet.Any?): jet.String defined in jet
+package h + import util.plus trait H diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/plusOperator.before.Main.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/plusOperator.before.Main.kt index d2812f539569..e7b2ac252127 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/plusOperator.before.Main.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/plusOperator.before.Main.kt @@ -1,6 +1,8 @@ // "Import" "true" // ERROR: Unresolved reference.
None of the following candidates is applicable because of receiver type mismatch:
  • public fun jet.String?.plus(other: jet.Any?): jet.String defined in jet
+package h + trait H fun f(h: H?) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/plusOperator.before.data.Sample.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/plusOperator.before.data.Sample.kt index 4c575cdd8e20..df27b9061942 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/plusOperator.before.data.Sample.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/plusOperator.before.data.Sample.kt @@ -1,3 +1,3 @@ package util -fun H?.plus(s: String) = "" \ No newline at end of file +fun h.H?.plus(s: String) = "" \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/postfixOperator.after.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/postfixOperator.after.kt index 6aff9e317ddf..4cd807644abd 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/postfixOperator.after.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/postfixOperator.after.kt @@ -1,6 +1,8 @@ // "Import" "true" // ERROR: Unresolved reference: ++ +package h + import util.inc trait H diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/postfixOperator.before.Main.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/postfixOperator.before.Main.kt index 0b31c90d0d6f..9e5696144a26 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/postfixOperator.before.Main.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/postfixOperator.before.Main.kt @@ -1,6 +1,8 @@ // "Import" "true" // ERROR: Unresolved reference: ++ +package h + trait H fun f(h: H?) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/postfixOperator.before.data.Sample.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/postfixOperator.before.data.Sample.kt index 71f7baaccb43..a57f74ac91ef 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/postfixOperator.before.data.Sample.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/postfixOperator.before.data.Sample.kt @@ -1,4 +1,4 @@ package util -fun H.inc(): H { +fun h.H.inc(): h.H { } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/timesAssign.after.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/timesAssign.after.kt index 982cd4ad81cc..065592f1a649 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/timesAssign.after.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/timesAssign.after.kt @@ -1,6 +1,8 @@ // "Import" "true" // ERROR: Unresolved reference: *= +package h + import util.timesAssign trait H diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/timesAssign.before.Main.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/timesAssign.before.Main.kt index ce9d24e23faa..e58dc0399ed9 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/timesAssign.before.Main.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/timesAssign.before.Main.kt @@ -1,6 +1,8 @@ // "Import" "true" // ERROR: Unresolved reference: *= +package h + trait H fun f(h: H) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/timesAssign.before.data.Sample.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/timesAssign.before.data.Sample.kt index 601c7802d9bb..31a360111a3c 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/timesAssign.before.data.Sample.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/timesAssign.before.data.Sample.kt @@ -1,4 +1,4 @@ package util -fun H.div(i: Int) = 3 -fun H.timesAssign(i: Int) {} \ No newline at end of file +fun h.H.div(i: Int) = 3 +fun h.H.timesAssign(i: Int) {} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryMinusOperator.after.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryMinusOperator.after.kt index 195999026d01..5d4fccc55fd7 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryMinusOperator.after.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryMinusOperator.after.kt @@ -1,6 +1,8 @@ // "Import" "true" // ERROR: Unresolved reference: - +package h + import util.minus trait H diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryMinusOperator.before.Main.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryMinusOperator.before.Main.kt index 74b574ae1dc8..f8ea7f7a7a26 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryMinusOperator.before.Main.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryMinusOperator.before.Main.kt @@ -1,6 +1,8 @@ // "Import" "true" // ERROR: Unresolved reference: - +package h + trait H fun f(h: H?) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryMinusOperator.before.data.Sample.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryMinusOperator.before.data.Sample.kt index 818830a15414..55b6c6746b68 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryMinusOperator.before.data.Sample.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryMinusOperator.before.data.Sample.kt @@ -1,3 +1,3 @@ package util -fun H?.minus() = "" \ No newline at end of file +fun h.H?.minus() = "" \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryPlusOperator.after.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryPlusOperator.after.kt index d7e09f592d77..253edac50abc 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryPlusOperator.after.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryPlusOperator.after.kt @@ -1,5 +1,7 @@ // "Import" "true" -// ERROR: Unresolved reference.
None of the following candidates is applicable because of receiver type mismatch:
  • internal fun A.plus(): jet.Int defined in root package
  • public fun jet.String?.plus(other: jet.Any?): jet.String defined in jet
+// ERROR: Unresolved reference.
None of the following candidates is applicable because of receiver type mismatch:
  • internal fun h.A.plus(): jet.Int defined in h
  • public fun jet.String?.plus(other: jet.Any?): jet.String defined in jet
+ +package h import util.plus diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryPlusOperator.before.Main.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryPlusOperator.before.Main.kt index 67f41c87e1b2..b4336cf348d4 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryPlusOperator.before.Main.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryPlusOperator.before.Main.kt @@ -1,5 +1,7 @@ // "Import" "true" -// ERROR: Unresolved reference.
None of the following candidates is applicable because of receiver type mismatch:
  • internal fun A.plus(): jet.Int defined in root package
  • public fun jet.String?.plus(other: jet.Any?): jet.String defined in jet
+// ERROR: Unresolved reference.
None of the following candidates is applicable because of receiver type mismatch:
  • internal fun h.A.plus(): jet.Int defined in h
  • public fun jet.String?.plus(other: jet.Any?): jet.String defined in jet
+ +package h trait H diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryPlusOperator.before.data.Sample.kt b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryPlusOperator.before.data.Sample.kt index fdc33392a435..336a1ff68bdc 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryPlusOperator.before.data.Sample.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/unaryPlusOperator.before.data.Sample.kt @@ -1,3 +1,3 @@ package util -fun H.plus() = "" \ No newline at end of file +fun h.H.plus() = "" \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/resolve/references/DontImportRootScope.Data.kt b/plugins/kotlin/idea/tests/testData/resolve/references/DontImportRootScope.Data.kt new file mode 100644 index 000000000000..1d21fb6f2325 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/resolve/references/DontImportRootScope.Data.kt @@ -0,0 +1,2 @@ +class Klass { +} diff --git a/plugins/kotlin/idea/tests/testData/resolve/references/DontImportRootScope.kt b/plugins/kotlin/idea/tests/testData/resolve/references/DontImportRootScope.kt new file mode 100644 index 000000000000..734699a9d8db --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/resolve/references/DontImportRootScope.kt @@ -0,0 +1,5 @@ +package test + +import Klass + +//REF_EMPTY \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang1.Data.kt b/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang1.Data.kt new file mode 100644 index 000000000000..bbebec4ce568 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang1.Data.kt @@ -0,0 +1,5 @@ +class java { + class lang { + class Fake() + } +} diff --git a/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang1.kt b/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang1.kt new file mode 100644 index 000000000000..233d4462a0d5 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang1.kt @@ -0,0 +1,7 @@ +import java.lang.* // will import Fake + +fun foo() { + Fake() +} + +//REF: (java.lang).Fake \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang2.Data.kt b/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang2.Data.kt new file mode 100644 index 000000000000..bbebec4ce568 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang2.Data.kt @@ -0,0 +1,5 @@ +class java { + class lang { + class Fake() + } +} diff --git a/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang2.kt b/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang2.kt new file mode 100644 index 000000000000..4e08c47d6c2c --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang2.kt @@ -0,0 +1,5 @@ +fun foo() { + Fake() // not imported within "java.lang.*" default import +} + +//REF_EMPTY \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang3.Data.kt b/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang3.Data.kt new file mode 100644 index 000000000000..bbebec4ce568 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang3.Data.kt @@ -0,0 +1,5 @@ +class java { + class lang { + class Fake() + } +} diff --git a/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang3.kt b/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang3.kt new file mode 100644 index 000000000000..a395295197e0 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang3.kt @@ -0,0 +1,8 @@ +package nonRoot +import java.lang.* // will not import Fake + +fun foo() { + Fake() +} + +//REF_EMPTY \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang4.Data.kt b/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang4.Data.kt new file mode 100644 index 000000000000..bbebec4ce568 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang4.Data.kt @@ -0,0 +1,5 @@ +class java { + class lang { + class Fake() + } +} diff --git a/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang4.kt b/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang4.kt new file mode 100644 index 000000000000..8a564901dd29 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/resolve/references/FakeJavaLang4.kt @@ -0,0 +1,7 @@ +package nonRoot + +fun foo() { + java.lang.Fake() // qualification doesn't help, because we are in other package +} + +//REF_EMPTY \ No newline at end of file