Process imports for functioncs and properties in creating scope for file

during lazy resolve

Fix for "KT-3096 No completion in function literal" and "KT-3102 No
completion/auto-import for an extension method"

 #KT-3102 Fixed
 #KT-3096 Fixed
This commit is contained in:
Nikolay Krasko
2012-11-30 15:29:38 +04:00
parent c9921a3699
commit 5368e8cef3
10 changed files with 150 additions and 38 deletions
@@ -0,0 +1,9 @@
package first
import second.testFun
fun test() {
testFun().<caret>
}
// EXIST: testMethod
@@ -0,0 +1,9 @@
package second
class TestSecond {
fun testMethod() {
}
}
fun testFun() : TestSecond = TestSecond()
@@ -0,0 +1,9 @@
package first
// For KT-3102
import second.foo
fun test() = foo().ext<caret>
// EXIST: extensionFunction1, extensionFunction2
@@ -0,0 +1,9 @@
package second
class Some
// Two function to prevent automatic insert
fun Some.extensionFunction1() = 12
fun Some.extensionFunction2() = 12
fun foo() = Some()
@@ -0,0 +1,11 @@
package first
// For KT-3096 No completion in function literal
import second.someWithLiteral
fun test() {
someWithLiteral({file -> file.testFu<caret>})
}
// EXIST: testFunction1, testFunction2
@@ -0,0 +1,9 @@
package second
class Some {
// Two function to prevent automatic insert
fun testFunction1() : Int = 12
fun testFunction2() : Int = 12
}
fun someWithLiteral(body: (Some) -> Unit) = 12
@@ -22,6 +22,9 @@ import org.jetbrains.jet.plugin.PluginTestCaseBase;
* @author Nikolay Krasko
*/
public class JetMultifileBasicCompletionTest extends JetCompletionMultiTestBase {
public void testCompletionOnImportedFunction() {
doFileTest();
}
public void testDoNotCompleteWithConstraints() {
doFileTest();
@@ -31,6 +34,10 @@ public class JetMultifileBasicCompletionTest extends JetCompletionMultiTestBase
doFileTest();
}
public void testExtensionFunctionOnImportedFunction() throws Exception {
doFileTest(2);
}
public void todotestExtensionFunctionOnUnresolved() throws Exception {
doFileTest();
}
@@ -43,6 +50,10 @@ public class JetMultifileBasicCompletionTest extends JetCompletionMultiTestBase
doFileTest();
}
public void testInImportedFunctionLiteralParameter() throws Exception {
doFileTest(2);
}
public void testJavaInnerClasses() throws Exception {
String fileName = getTestName(false);
doFileTest(1, new String[] {fileName + ".kt", fileName + ".java"});