Merge remote branch 'origin/master'

Conflicts:
	compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java
This commit is contained in:
Andrey Breslav
2011-12-06 14:44:39 +04:00
28 changed files with 450 additions and 78 deletions
@@ -79,7 +79,6 @@ class JetSimpleNameReference extends JetPsiReference {
private Object[] collectLookupElements(BindingContext bindingContext, JetScope scope) {
List<LookupElement> result = Lists.newArrayList();
for (final DeclarationDescriptor descriptor : scope.getAllDescriptors()) {
PsiElement declaration = bindingContext.get(BindingContext.DESCRIPTOR_TO_DECLARATION, descriptor.getOriginal());
LookupElementBuilder element = LookupElementBuilder.create(descriptor.getName());
String typeText = "";
String tailText = "";
@@ -108,9 +107,12 @@ class JetSimpleNameReference extends JetPsiReference {
typeText = DescriptorRenderer.TEXT.render(descriptor);
}
element = element.setTailText(tailText, tailTextGrayed).setTypeText(typeText);
PsiElement declaration = bindingContext.get(BindingContext.DESCRIPTOR_TO_DECLARATION, descriptor.getOriginal());
if (declaration != null) {
element = element.setIcon(declaration.getIcon(Iconable.ICON_FLAG_OPEN | Iconable.ICON_FLAG_VISIBILITY));
}
result.add(element);
}
return result.toArray();
@@ -0,0 +1,13 @@
open class MySecondClass() {
}
open class MyFirstClass<T> {
}
class A() : My<caret> {
public fun test() {
}
}
// EXIST: MySecondClass, MyFirstClass
@@ -0,0 +1,11 @@
namespace Test.SubTest.AnotherTest
open class TestClass {
}
class A() : Test.SubTest.AnotherTest.Te<caret> {
public fun test() {
}
}
// EXIST: TestClass
@@ -0,0 +1,10 @@
open class MyClass() {
}
class A() : My<caret> {
public fun test() {
val a : MyC<caret>
}
}
// EXIST: MyClass
@@ -0,0 +1,59 @@
package org.jetbrains.jet.completion;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.JetTestCaseBuilder;
import org.jetbrains.jet.plugin.PluginTestCaseBase;
import java.io.File;
/**
* @author Nikolay.Krasko
*/
public class JetBasicCompletionTest extends JetCompletionTestBase {
private final String myPath;
private final String myName;
public JetBasicCompletionTest(@NotNull String path, @NotNull String name) {
myPath = path;
myName = name;
// Set name explicitly because otherwise there will be "TestCase.fName cannot be null"
setName("testCompletionExecute");
}
public void testCompletionExecute() {
doTest();
}
@Override
protected String getTestDataPath() {
return new File(PluginTestCaseBase.getTestDataPathBase(), myPath).getPath() +
File.separator;
}
@NotNull
@Override
public String getName() {
return "test" + myName;
}
@NotNull
public static TestSuite suite() {
TestSuite suite = new TestSuite();
JetTestCaseBuilder.appendTestsInDirectory(
PluginTestCaseBase.getTestDataPathBase(), "/completion/basic/", false,
JetTestCaseBuilder.emptyFilter, new JetTestCaseBuilder.NamedTestFactory() {
@NotNull
@Override
public Test createTest(@NotNull String dataPath, @NotNull String name, @NotNull File file) {
return new JetBasicCompletionTest(dataPath, name);
}
}, suite);
return suite;
}
}
@@ -22,10 +22,10 @@ public class KeywordsCompletionTest extends JetCompletionTestBase {
myName = name;
// Set name explicitly because otherwise there will be "TestCase.fName cannot be null"
setName("testComletionExecute");
setName("testCompletionExecute");
}
public void testComletionExecute() {
public void testCompletionExecute() {
doTest();
}