Resolve invoke on any kind of expressions, not only on simple name expressions
This commit is contained in:
@@ -5081,6 +5081,11 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
doTest("compiler/testData/diagnostics/tests/operatorsOverloading/kt1028.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt3450.kt")
|
||||
public void testKt3450() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/operatorsOverloading/kt3450.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/overload")
|
||||
@@ -6041,6 +6046,7 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/resolve/invoke")
|
||||
@InnerTestClasses({Invoke.Errors.class})
|
||||
public static class Invoke extends AbstractJetDiagnosticsTest {
|
||||
public void testAllFilesPresentInInvoke() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/diagnostics/tests/resolve/invoke"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
@@ -6091,6 +6097,50 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
doTest("compiler/testData/diagnostics/tests/resolve/invoke/valNamedInvoke.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/resolve/invoke/errors")
|
||||
public static class Errors extends AbstractJetDiagnosticsTest {
|
||||
public void testAllFilesPresentInErrors() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/diagnostics/tests/resolve/invoke/errors"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("ambiguityForInvoke.kt")
|
||||
public void testAmbiguityForInvoke() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/resolve/invoke/errors/ambiguityForInvoke.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("invisibleInvoke.kt")
|
||||
public void testInvisibleInvoke() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/resolve/invoke/errors/invisibleInvoke.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeInferenceErrorForInvoke.kt")
|
||||
public void testTypeInferenceErrorForInvoke() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/resolve/invoke/errors/typeInferenceErrorForInvoke.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unresolvedInvoke.kt")
|
||||
public void testUnresolvedInvoke() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/resolve/invoke/errors/unresolvedInvoke.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unsafeCallWithInvoke.kt")
|
||||
public void testUnsafeCallWithInvoke() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/resolve/invoke/errors/unsafeCallWithInvoke.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("wrongReceiverTypeForInvoke.kt")
|
||||
public void testWrongReceiverTypeForInvoke() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/resolve/invoke/errors/wrongReceiverTypeForInvoke.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Test innerSuite() {
|
||||
TestSuite suite = new TestSuite("Invoke");
|
||||
suite.addTestSuite(Invoke.class);
|
||||
suite.addTestSuite(Errors.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/resolve/nestedCalls")
|
||||
@@ -6142,7 +6192,7 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
public static Test innerSuite() {
|
||||
TestSuite suite = new TestSuite("Resolve");
|
||||
suite.addTestSuite(Resolve.class);
|
||||
suite.addTestSuite(Invoke.class);
|
||||
suite.addTest(Invoke.innerSuite());
|
||||
suite.addTestSuite(NestedCalls.class);
|
||||
suite.addTestSuite(SpecialConstructions.class);
|
||||
return suite;
|
||||
|
||||
@@ -2878,11 +2878,21 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/box/functions/invoke"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionInvokeOnExpr.kt")
|
||||
public void testExtensionInvokeOnExpr() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/functions/invoke/extensionInvokeOnExpr.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("invoke.kt")
|
||||
public void testInvoke() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/functions/invoke/invoke.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("invokeOnExprByConvention.kt")
|
||||
public void testInvokeOnExprByConvention() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/functions/invoke/invokeOnExprByConvention.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt3189.kt")
|
||||
public void testKt3189() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/functions/invoke/kt3189.kt");
|
||||
@@ -2898,6 +2908,31 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest("compiler/testData/codegen/box/functions/invoke/kt3297.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt3450getAndInvoke.kt")
|
||||
public void testKt3450getAndInvoke() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/functions/invoke/kt3450getAndInvoke.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt3631invokeOnString.kt")
|
||||
public void testKt3631invokeOnString() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/functions/invoke/kt3631invokeOnString.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt3772.kt")
|
||||
public void testKt3772() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/functions/invoke/kt3772.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt3821invokeOnThis.kt")
|
||||
public void testKt3821invokeOnThis() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/functions/invoke/kt3821invokeOnThis.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt3822invokeOnThis.kt")
|
||||
public void testKt3822invokeOnThis() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/functions/invoke/kt3822invokeOnThis.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/functions/localFunctions")
|
||||
|
||||
@@ -34,6 +34,7 @@ import java.io.File
|
||||
import java.util.Collections
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertTrue
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.VariableAsFunctionResolvedCall
|
||||
|
||||
public abstract class AbstractResolvedCallsTest() : JetLiteFixture() {
|
||||
override fun createEnvironment(): JetCoreEnvironment = createEnvironmentWithMockJdk(ConfigurationKind.JDK_ONLY)
|
||||
@@ -72,12 +73,22 @@ public abstract class AbstractResolvedCallsTest() : JetLiteFixture() {
|
||||
|
||||
var callFound = false
|
||||
for ((element, resolvedCall) in analyzeFileAndGetResolvedCallEntries()) {
|
||||
if (callName.equals(element.getText())) {
|
||||
|
||||
fun tryCall(resolvedCall: ResolvedCall<*>, actualName: String? = element.getText()) {
|
||||
if (callName == null || callName != actualName) return
|
||||
callFound = true
|
||||
checkResolvedCall(resolvedCall, element)
|
||||
}
|
||||
|
||||
if (resolvedCall is VariableAsFunctionResolvedCall) {
|
||||
tryCall(resolvedCall.getFunctionCall(), "invoke")
|
||||
tryCall(resolvedCall.getVariableCall())
|
||||
}
|
||||
else {
|
||||
tryCall(resolvedCall)
|
||||
}
|
||||
}
|
||||
assertTrue(callFound, "Resolved call for $callName was not found.")
|
||||
assertTrue(callFound, "Resolved call for $callName was not found")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user