Dealing with infix calls in completion
#KT-4846 Fixed
This commit is contained in:
committed by
valentin
parent
9961a5ff16
commit
2bb553612c
@@ -30,6 +30,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.InTextDirectivesUtils;
|
||||
import org.jetbrains.jet.plugin.project.TargetPlatform;
|
||||
import org.jetbrains.jet.plugin.stubs.AstAccessControl;
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.util.*;
|
||||
@@ -126,7 +127,8 @@ public class ExpectedCompletionUtils {
|
||||
NUMBER_JS_LINE_PREFIX,
|
||||
NUMBER_JAVA_LINE_PREFIX,
|
||||
INVOCATION_COUNT_PREFIX,
|
||||
WITH_ORDER_PREFIX);
|
||||
WITH_ORDER_PREFIX,
|
||||
AstAccessControl.INSTANCE$.getALLOW_AST_ACCESS_DIRECTIVE());
|
||||
|
||||
@NotNull
|
||||
public static CompletionProposal[] itemsShouldExist(String fileText, @Nullable TargetPlatform platform) {
|
||||
|
||||
@@ -378,6 +378,12 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InfixCall.kt")
|
||||
public void testInfixCall() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/common/InfixCall.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("JavaPackage.kt")
|
||||
public void testJavaPackage() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/common/JavaPackage.kt");
|
||||
|
||||
@@ -378,6 +378,12 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InfixCall.kt")
|
||||
public void testInfixCall() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/common/InfixCall.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("JavaPackage.kt")
|
||||
public void testJavaPackage() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/common/JavaPackage.kt");
|
||||
|
||||
@@ -17,9 +17,13 @@
|
||||
package org.jetbrains.jet.completion;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.test.TestMetadata;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.test.InnerTestClasses;
|
||||
import org.jetbrains.jet.test.TestMetadata;
|
||||
import org.jetbrains.jet.JUnit3RunnerWithInners;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
+7
-5
@@ -17,13 +17,9 @@
|
||||
package org.jetbrains.jet.completion;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.test.InnerTestClasses;
|
||||
import org.jetbrains.jet.test.TestMetadata;
|
||||
import org.jetbrains.jet.JUnit3RunnerWithInners;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -134,6 +130,12 @@ public class MultiFileJvmBasicCompletionTestGenerated extends AbstractMultiFileJ
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("NotImportedInfixExtension")
|
||||
public void testNotImportedInfixExtension() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/multifile/NotImportedInfixExtension/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("NotImportedJavaClass")
|
||||
public void testNotImportedJavaClass() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/multifile/NotImportedJavaClass/");
|
||||
|
||||
@@ -150,4 +150,7 @@ public class BasicCompletionHandlerTest : CompletionHandlerTestBase(){
|
||||
|
||||
fun testKeywordClassName() = doTest(1, "class", null, '\n')
|
||||
fun testKeywordFunctionName() = doTest(1, "fun", "fun()", null, '\n')
|
||||
|
||||
fun testInfixCall() = doTest(1, "to", null, null, '\n')
|
||||
fun testInfixCallOnSpace() = doTest(1, "to", null, null, ' ')
|
||||
}
|
||||
@@ -58,6 +58,10 @@ public class CompletionMultifileHandlerTest extends KotlinCompletionTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInfixExtensionCallImport() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void doTest() throws Exception {
|
||||
String fileName = getTestName(false);
|
||||
|
||||
|
||||
@@ -23,15 +23,12 @@ import com.intellij.openapi.vfs.VirtualFile
|
||||
import org.jetbrains.jet.plugin.JetFileType
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.vfs.VfsUtil
|
||||
import com.intellij.openapi.vfs.VfsUtilCore
|
||||
import org.jetbrains.jet.InTextDirectivesUtils
|
||||
import junit.framework.TestCase
|
||||
import kotlin.test.fail
|
||||
|
||||
object AstAccessControl {
|
||||
private val ALLOW_AST_ACCESS_DIRECTIVE = "ALLOW_AST_ACCESS"
|
||||
public object AstAccessControl {
|
||||
public val ALLOW_AST_ACCESS_DIRECTIVE: String = "ALLOW_AST_ACCESS"
|
||||
|
||||
// Please provide at least one test that fails ast switch check (shouldFail should be true for at least one test)
|
||||
// This kind of inconvenience is justified by the fact that the check can be invalidated by slight misconfiguration of the test
|
||||
|
||||
Reference in New Issue
Block a user