Added tests for argument mapping
This commit is contained in:
@@ -58,6 +58,7 @@ import org.jetbrains.jet.lang.resolve.bindingContextUtil.getCorrespondingCall
|
||||
import org.jetbrains.jet.lang.psi.JetSafeQualifiedExpression
|
||||
import org.jetbrains.jet.lang.resolve.calls.CallResolverUtil.ResolveArgumentsMode.RESOLVE_FUNCTION_ARGUMENTS
|
||||
import org.jetbrains.jet.lang.resolve.TemporaryBindingTrace
|
||||
import org.jetbrains.jet.lang.resolve.calls.util.getAllValueArguments
|
||||
|
||||
public class CallCompleter(
|
||||
val argumentTypeResolver: ArgumentTypeResolver,
|
||||
@@ -203,11 +204,10 @@ public class CallCompleter(
|
||||
getDataFlowInfoForArgument = { context.dataFlowInfo }
|
||||
}
|
||||
|
||||
val arguments = ArrayList(context.call.getValueArguments())
|
||||
arguments.addAll(context.call.getFunctionLiteralArguments().map { functionLiteral -> CallMaker.makeValueArgument(functionLiteral) })
|
||||
val arguments = context.call.getAllValueArguments()
|
||||
|
||||
for (valueArgument in arguments) {
|
||||
val argumentMapping = getArgumentMapping(valueArgument!!)
|
||||
val argumentMapping = getArgumentMapping(valueArgument)
|
||||
val expectedType = when (argumentMapping) {
|
||||
is ArgumentMatch -> CandidateResolver.getEffectiveExpectedType(argumentMapping.valueParameter, valueArgument)
|
||||
else -> TypeUtils.NO_EXPECTED_TYPE
|
||||
|
||||
@@ -25,6 +25,9 @@ import org.jetbrains.jet.lang.resolve.calls.model.ArgumentMapping
|
||||
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.ArgumentMatch
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.ArgumentMatchStatus
|
||||
import java.util.ArrayList
|
||||
import org.jetbrains.jet.lang.psi.Call
|
||||
import org.jetbrains.jet.lang.psi.ValueArgument
|
||||
|
||||
public fun <D : CallableDescriptor> ResolvedCall<D>.noErrorsInValueArguments(): Boolean {
|
||||
return getCall().getValueArguments().all { argument -> !getArgumentMapping(argument!!).isError() }
|
||||
@@ -54,3 +57,10 @@ fun <D : CallableDescriptor> ResolvedCall<D>.isDirty(): Boolean {
|
||||
argumentMapping is ArgumentMatch && argumentMapping.status == ArgumentMatchStatus.ARGUMENT_HAS_NO_TYPE
|
||||
}
|
||||
}
|
||||
|
||||
fun Call.getAllValueArguments(): List<ValueArgument> {
|
||||
val arguments = getValueArguments() +
|
||||
getFunctionLiteralArguments().map { functionLiteral -> CallMaker.makeValueArgument(functionLiteral) }
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
return arguments as List<ValueArgument>
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
// !ONLY_ARGUMENTS
|
||||
// !CALL: foo
|
||||
// !ARG_1: ArgumentMatch(t : Int, SUCCESS)
|
||||
// !ARG_2: ArgumentMatch(f : (Int) -> String, SUCCESS)
|
||||
// !ARG_3: ArgumentMatch(g : (String) -> Int, SUCCESS)
|
||||
|
||||
fun <T, S, R> foo(t: T, f: (T) -> S, g: (S) -> R) {}
|
||||
|
||||
|
||||
fun test() {
|
||||
foo(1, { x -> "$x"}, { y -> y.length })
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// !ONLY_ARGUMENTS
|
||||
// !CALL: foo
|
||||
// !ARG_1: ArgumentMatch(f : () -> ???, SUCCESS)
|
||||
|
||||
fun <T> foo(f: () -> T) {}
|
||||
|
||||
|
||||
fun test() {
|
||||
foo { b }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// !ONLY_ARGUMENTS
|
||||
// !CALL: foo
|
||||
// !ARG_1: ArgumentMatch(f : (???) -> String, SUCCESS)
|
||||
|
||||
fun <T> foo(f: (T) -> String) {}
|
||||
|
||||
|
||||
fun test() {
|
||||
foo { x -> "$x"}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// !ONLY_ARGUMENTS
|
||||
// !CALL: foo
|
||||
// !ARG_1: ArgumentMatch(f : (Int) -> String, SUCCESS)
|
||||
|
||||
fun <T> foo(f: (T) -> String) {}
|
||||
|
||||
|
||||
fun test() {
|
||||
foo { (x: Int) -> "$x"}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// !ONLY_ARGUMENTS
|
||||
// !CALL: foo
|
||||
// !ARG_1: ArgumentMatch(f : (Int) -> String, SUCCESS)
|
||||
|
||||
fun foo(f: (Int) -> String) {}
|
||||
|
||||
|
||||
fun test() {
|
||||
foo { x -> "$x"}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// !ONLY_ARGUMENTS
|
||||
// !CALL: foo
|
||||
// !ARG_1: ArgumentUnmapped
|
||||
|
||||
fun foo() {}
|
||||
|
||||
fun test() {
|
||||
foo { x -> "$x"}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// !ONLY_ARGUMENTS
|
||||
// !CALL: foo
|
||||
// !ARG_1: 11 = ArgumentMatch(t : Comparable<out Any?>, SUCCESS)
|
||||
// !ARG_2: ls = ArgumentMatch(l : List<Comparable<out Any?>>, SUCCESS)
|
||||
|
||||
fun <T> foo(t: T, l: List<T>) {}
|
||||
|
||||
fun use(vararg a: Any?) = a
|
||||
|
||||
fun test(a: Any, ls: List<String>) {
|
||||
use(foo(11, ls))
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// !ONLY_ARGUMENTS
|
||||
// !CALL: foo
|
||||
// !ARG_1: A() = ArgumentMatch(t : A, SUCCESS)
|
||||
|
||||
class A {}
|
||||
|
||||
fun <T> foo(t: T) {}
|
||||
|
||||
fun bar() {
|
||||
foo(A())
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// !ONLY_ARGUMENTS
|
||||
// !CALL: foo
|
||||
// !ARG_1: 11 = ArgumentMatch(t : ???, SUCCESS)
|
||||
// !ARG_2: ls = ArgumentMatch(l : MutableList<???>, SUCCESS)
|
||||
|
||||
fun <T> foo(t: T, l: MutableList<T>) {}
|
||||
|
||||
fun use(vararg a: Any?) = a
|
||||
|
||||
fun test(ls: MutableList<String>) {
|
||||
use(foo(11, ls))
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// !ONLY_ARGUMENTS
|
||||
// !CALL: foo
|
||||
// !ARG_1: 11 = ArgumentMatch(l : List<???>, TYPE_MISMATCH)
|
||||
|
||||
fun <T> foo(l: List<T>) {}
|
||||
|
||||
fun test() {
|
||||
foo(11)
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// !ONLY_ARGUMENTS
|
||||
// !CALL: foo
|
||||
// !ARG_1: B() = ArgumentMatch(b : B, SUCCESS)
|
||||
// !ARG_2: A() = ArgumentUnmapped
|
||||
|
||||
class A {}
|
||||
class B {}
|
||||
|
||||
fun foo(a: A, b: B) {}
|
||||
|
||||
fun bar() {
|
||||
foo(b = B(), A())
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// !ONLY_ARGUMENTS
|
||||
// !CALL: foo
|
||||
// !ARG_1: B() = ArgumentMatch(b : B, SUCCESS)
|
||||
// !ARG_2: A() = ArgumentMatch(a : A, SUCCESS)
|
||||
|
||||
class A {}
|
||||
class B {}
|
||||
|
||||
fun foo(a: A, b: B) {}
|
||||
|
||||
fun bar() {
|
||||
foo(b = B(), a = A())
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// !ONLY_ARGUMENTS
|
||||
// !CALL: foo
|
||||
// !ARG_1: b = ArgumentMatch(a : A, ARGUMENT_HAS_NO_TYPE)
|
||||
|
||||
class A {}
|
||||
|
||||
fun foo(a: A) {}
|
||||
|
||||
fun bar() {
|
||||
foo(b)
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// !ONLY_ARGUMENTS
|
||||
// !CALL: foo
|
||||
// !ARG_1: A() = ArgumentMatch(a : A, SUCCESS)
|
||||
|
||||
class A {}
|
||||
|
||||
fun foo(a: A) {}
|
||||
|
||||
fun bar() {
|
||||
foo(A())
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// !ONLY_ARGUMENTS
|
||||
// !CALL: foo
|
||||
// !ARG_1: "" = ArgumentMatch(a : A, TYPE_MISMATCH)
|
||||
|
||||
class A {}
|
||||
|
||||
fun foo(a: A) {}
|
||||
|
||||
fun bar() {
|
||||
foo("")
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// !ONLY_ARGUMENTS
|
||||
// !CALL: foo
|
||||
// !ARG_1: "" = ArgumentUnmapped
|
||||
|
||||
fun foo() {}
|
||||
|
||||
fun bar() {
|
||||
foo("")
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// !ONLY_ARGUMENTS
|
||||
// !CALL: foo
|
||||
// !ARG_1: emptyList() = ArgumentMatch(t : List<???>, SUCCESS)
|
||||
|
||||
class A {}
|
||||
|
||||
fun <T> foo(t: T) {}
|
||||
|
||||
fun <T> emptyList(): List<T> = throw Exception()
|
||||
|
||||
fun bar() {
|
||||
foo(emptyList())
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// !ONLY_ARGUMENTS
|
||||
// !CALL: foo
|
||||
// !ARG_1: emptyList() = ArgumentMatch(t : MutableList<???>, SUCCESS)
|
||||
|
||||
class A {}
|
||||
|
||||
fun <T> foo(t: T) {}
|
||||
|
||||
fun <T> emptyList(): MutableList<T> = throw Exception()
|
||||
|
||||
fun bar() {
|
||||
foo(emptyList())
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// !ONLY_ARGUMENTS
|
||||
// !CALL: foo
|
||||
// !ARG_1: A() = ArgumentMatch(a : A, SUCCESS)
|
||||
// !ARG_2: "" = ArgumentMatch(s : String, SUCCESS)
|
||||
|
||||
class A {}
|
||||
|
||||
fun foo(a: A) {}
|
||||
fun foo(a: A, s: String) {}
|
||||
fun foo(a: A, any: Any) {}
|
||||
|
||||
fun bar() {
|
||||
foo(A(), "")
|
||||
}
|
||||
@@ -34,6 +34,12 @@ import kotlin.test.assertEquals
|
||||
import kotlin.test.assertTrue
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.VariableAsFunctionResolvedCall
|
||||
import org.jetbrains.jet.lang.resolve.lazy.JvmResolveUtil
|
||||
import java.util.ArrayList
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.ArgumentMapping
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.ArgumentMatch
|
||||
import org.jetbrains.jet.lang.diagnostics.rendering.Renderers
|
||||
import org.jetbrains.jet.lang.resolve.calls.util.getAllValueArguments
|
||||
import org.jetbrains.jet.renderer.DescriptorRenderer
|
||||
|
||||
public abstract class AbstractResolvedCallsTest() : JetLiteFixture() {
|
||||
override fun createEnvironment(): JetCoreEnvironment = createEnvironmentWithMockJdk(ConfigurationKind.JDK_ONLY)
|
||||
@@ -43,6 +49,7 @@ public abstract class AbstractResolvedCallsTest() : JetLiteFixture() {
|
||||
val text = JetTestUtils.doLoadFile(file)
|
||||
val directives = JetTestUtils.parseDirectives(text)
|
||||
|
||||
val onlyArguments = directives.onlyArguments()
|
||||
val (callName, thisObject, receiverArgument) = with (directives) {
|
||||
Triple(get("CALL"), get("THIS_OBJECT"), get("RECEIVER_ARGUMENT"))
|
||||
}
|
||||
@@ -50,12 +57,14 @@ public abstract class AbstractResolvedCallsTest() : JetLiteFixture() {
|
||||
|
||||
fun analyzeFileAndGetResolvedCallEntries(): Map<JetElement, ResolvedCall<*>> {
|
||||
val psiFile = JetTestUtils.loadJetFile(getProject(), file)!!
|
||||
val analyzeExhaust = JvmResolveUtil.analyzeOneFileWithJavaIntegrationAndCheckForErrors(psiFile)
|
||||
val analyzeExhaust = JvmResolveUtil.analyzeOneFileWithJavaIntegration(psiFile)
|
||||
val bindingContext = analyzeExhaust.getBindingContext()
|
||||
return bindingContext.getSliceContents(BindingContext.RESOLVED_CALL)
|
||||
}
|
||||
|
||||
fun checkResolvedCall(resolvedCall: ResolvedCall<*>, element: JetElement) {
|
||||
if (onlyArguments) return
|
||||
|
||||
val lineAndColumn = DiagnosticUtils.getLineAndColumnInPsiFile(element.getContainingFile(), element.getTextRange())
|
||||
|
||||
val (actualThisObject, actualReceiverArgument, actualExplicitReceiverKind) = with(resolvedCall) {
|
||||
@@ -66,10 +75,26 @@ public abstract class AbstractResolvedCallsTest() : JetLiteFixture() {
|
||||
|
||||
assertEquals(thisObject, actualThisObject, "${actualDataMessage}This object mismatch: ")
|
||||
assertEquals(receiverArgument, actualReceiverArgument, "${actualDataMessage}Receiver argument mismatch: ")
|
||||
assertEquals(explicitReceiverKind, actualExplicitReceiverKind, "$actualDataMessage" +
|
||||
assertEquals(explicitReceiverKind, actualExplicitReceiverKind,
|
||||
"$actualDataMessage" +
|
||||
"Explicit receiver kind for resolved call for '${element.getText()}'$lineAndColumn in not as expected")
|
||||
}
|
||||
|
||||
val argumentsExpectedData = directives.getArgumentsExpectedData()
|
||||
fun checkArguments(resolvedCall: ResolvedCall<*>) {
|
||||
if (argumentsExpectedData.isEmpty()) return
|
||||
|
||||
for ((index, valueArgument) in resolvedCall.getCall().getAllValueArguments().withIndices()) {
|
||||
val (argText, argumentMapping) = argumentsExpectedData[index]
|
||||
if (argText != null) {
|
||||
assertEquals(argText, valueArgument.getArgumentExpression()!!.getText(),
|
||||
"An argument expression is incorrect")
|
||||
}
|
||||
assertEquals(argumentMapping, resolvedCall.getArgumentMapping(valueArgument).print(),
|
||||
"Argument mapping is incorrect")
|
||||
}
|
||||
}
|
||||
|
||||
var callFound = false
|
||||
for ((element, resolvedCall) in analyzeFileAndGetResolvedCallEntries()) {
|
||||
|
||||
@@ -77,6 +102,7 @@ public abstract class AbstractResolvedCallsTest() : JetLiteFixture() {
|
||||
if (callName == null || callName != actualName) return
|
||||
callFound = true
|
||||
checkResolvedCall(resolvedCall, element)
|
||||
checkArguments(resolvedCall)
|
||||
}
|
||||
|
||||
if (resolvedCall is VariableAsFunctionResolvedCall) {
|
||||
@@ -101,11 +127,12 @@ private fun ReceiverValue.getText() =
|
||||
else toString()
|
||||
|
||||
private val EXPLICIT_RECEIVER_KIND_DIRECTIVE: String = "EXPLICIT_RECEIVER_KIND"
|
||||
private fun Map<String, String>.getExplicitReceiverKind(): ExplicitReceiverKind {
|
||||
private fun Map<String, String>.getExplicitReceiverKind(): ExplicitReceiverKind? {
|
||||
if (onlyArguments()) return null
|
||||
|
||||
val explicitReceiverKind = get(EXPLICIT_RECEIVER_KIND_DIRECTIVE)
|
||||
assert(explicitReceiverKind != null) { "$EXPLICIT_RECEIVER_KIND_DIRECTIVE should be present." }
|
||||
try
|
||||
{
|
||||
try {
|
||||
return ExplicitReceiverKind.valueOf(explicitReceiverKind!!)
|
||||
}
|
||||
catch (e: IllegalArgumentException) {
|
||||
@@ -117,4 +144,32 @@ private fun Map<String, String>.getExplicitReceiverKind(): ExplicitReceiverKind
|
||||
message.append("\nnot $explicitReceiverKind.")
|
||||
throw AssertionError(message)
|
||||
}
|
||||
}
|
||||
|
||||
private fun Map<String, String>.getArgumentsExpectedData(): List<Pair<String?, String>> {
|
||||
val result = ArrayList<Pair<String?, String>>()
|
||||
for (i in 1..7) {
|
||||
val argData = get("ARG_$i")
|
||||
if (argData == null) continue
|
||||
|
||||
if (argData.contains("=")) {
|
||||
val strings = argData.split("=")
|
||||
assert(strings.size == 2, "Incorrect input data for an argument ARG_$i : $argData")
|
||||
result.add(Pair(strings[0].trim(), strings[1].trim()))
|
||||
}
|
||||
else {
|
||||
result.add(Pair(null, argData))
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
private fun Map<String, String>.onlyArguments() = containsKey("ONLY_ARGUMENTS")
|
||||
|
||||
fun ArgumentMapping.print() = when (this) {
|
||||
is ArgumentMatch -> {
|
||||
val parameterType = DescriptorRenderer.SHORT_NAMES_IN_TYPES.renderType(valueParameter.getType())
|
||||
"ArgumentMatch(${valueParameter.getName()} : ${parameterType}, ${status.name()})"
|
||||
}
|
||||
else -> "ArgumentUnmapped"
|
||||
}
|
||||
@@ -31,7 +31,7 @@ import org.jetbrains.jet.resolve.calls.AbstractResolvedCallsTest;
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/resolvedCalls")
|
||||
@InnerTestClasses({ResolvedCallsTestGenerated.FunctionTypes.class, ResolvedCallsTestGenerated.Invoke.class, ResolvedCallsTestGenerated.RealExamples.class})
|
||||
@InnerTestClasses({ResolvedCallsTestGenerated.Arguments.class, ResolvedCallsTestGenerated.FunctionTypes.class, ResolvedCallsTestGenerated.Invoke.class, ResolvedCallsTestGenerated.RealExamples.class})
|
||||
public class ResolvedCallsTestGenerated extends AbstractResolvedCallsTest {
|
||||
public void testAllFilesPresentInResolvedCalls() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/resolvedCalls"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
@@ -77,6 +77,169 @@ public class ResolvedCallsTestGenerated extends AbstractResolvedCallsTest {
|
||||
doTest("compiler/testData/resolvedCalls/simpleCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/resolvedCalls/arguments")
|
||||
@InnerTestClasses({Arguments.FunctionLiterals.class, Arguments.GenericCalls.class, Arguments.NamedArguments.class, Arguments.OneArgument.class, Arguments.RealExamples.class, Arguments.SeveralCandidates.class})
|
||||
public static class Arguments extends AbstractResolvedCallsTest {
|
||||
public void testAllFilesPresentInArguments() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/resolvedCalls/arguments"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/resolvedCalls/arguments/functionLiterals")
|
||||
public static class FunctionLiterals extends AbstractResolvedCallsTest {
|
||||
public void testAllFilesPresentInFunctionLiterals() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/resolvedCalls/arguments/functionLiterals"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("chainedLambdas.kt")
|
||||
public void testChainedLambdas() throws Exception {
|
||||
doTest("compiler/testData/resolvedCalls/arguments/functionLiterals/chainedLambdas.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("notInferredLambdaReturnType.kt")
|
||||
public void testNotInferredLambdaReturnType() throws Exception {
|
||||
doTest("compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaReturnType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("notInferredLambdaType.kt")
|
||||
public void testNotInferredLambdaType() throws Exception {
|
||||
doTest("compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleGenericLambda.kt")
|
||||
public void testSimpleGenericLambda() throws Exception {
|
||||
doTest("compiler/testData/resolvedCalls/arguments/functionLiterals/simpleGenericLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleLambda.kt")
|
||||
public void testSimpleLambda() throws Exception {
|
||||
doTest("compiler/testData/resolvedCalls/arguments/functionLiterals/simpleLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unmappedLambda.kt")
|
||||
public void testUnmappedLambda() throws Exception {
|
||||
doTest("compiler/testData/resolvedCalls/arguments/functionLiterals/unmappedLambda.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/resolvedCalls/arguments/genericCalls")
|
||||
public static class GenericCalls extends AbstractResolvedCallsTest {
|
||||
public void testAllFilesPresentInGenericCalls() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/resolvedCalls/arguments/genericCalls"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("inferredParameter.kt")
|
||||
public void testInferredParameter() throws Exception {
|
||||
doTest("compiler/testData/resolvedCalls/arguments/genericCalls/inferredParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleGeneric.kt")
|
||||
public void testSimpleGeneric() throws Exception {
|
||||
doTest("compiler/testData/resolvedCalls/arguments/genericCalls/simpleGeneric.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("uninferredParameter.kt")
|
||||
public void testUninferredParameter() throws Exception {
|
||||
doTest("compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("uninferredParameterTypeMismatch.kt")
|
||||
public void testUninferredParameterTypeMismatch() throws Exception {
|
||||
doTest("compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameterTypeMismatch.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/resolvedCalls/arguments/namedArguments")
|
||||
public static class NamedArguments extends AbstractResolvedCallsTest {
|
||||
public void testAllFilesPresentInNamedArguments() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/resolvedCalls/arguments/namedArguments"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("positionedAfterNamed.kt")
|
||||
public void testPositionedAfterNamed() throws Exception {
|
||||
doTest("compiler/testData/resolvedCalls/arguments/namedArguments/positionedAfterNamed.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("shiftedArgsMatch.kt")
|
||||
public void testShiftedArgsMatch() throws Exception {
|
||||
doTest("compiler/testData/resolvedCalls/arguments/namedArguments/shiftedArgsMatch.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/resolvedCalls/arguments/oneArgument")
|
||||
public static class OneArgument extends AbstractResolvedCallsTest {
|
||||
public void testAllFilesPresentInOneArgument() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/resolvedCalls/arguments/oneArgument"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("argumentHasNoType.kt")
|
||||
public void testArgumentHasNoType() throws Exception {
|
||||
doTest("compiler/testData/resolvedCalls/arguments/oneArgument/argumentHasNoType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleMatch.kt")
|
||||
public void testSimpleMatch() throws Exception {
|
||||
doTest("compiler/testData/resolvedCalls/arguments/oneArgument/simpleMatch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeMismatch.kt")
|
||||
public void testTypeMismatch() throws Exception {
|
||||
doTest("compiler/testData/resolvedCalls/arguments/oneArgument/typeMismatch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unmappedArgument.kt")
|
||||
public void testUnmappedArgument() throws Exception {
|
||||
doTest("compiler/testData/resolvedCalls/arguments/oneArgument/unmappedArgument.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/resolvedCalls/arguments/realExamples")
|
||||
public static class RealExamples extends AbstractResolvedCallsTest {
|
||||
public void testAllFilesPresentInRealExamples() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/resolvedCalls/arguments/realExamples"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("emptyList.kt")
|
||||
public void testEmptyList() throws Exception {
|
||||
doTest("compiler/testData/resolvedCalls/arguments/realExamples/emptyList.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("emptyMutableList.kt")
|
||||
public void testEmptyMutableList() throws Exception {
|
||||
doTest("compiler/testData/resolvedCalls/arguments/realExamples/emptyMutableList.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/resolvedCalls/arguments/severalCandidates")
|
||||
public static class SeveralCandidates extends AbstractResolvedCallsTest {
|
||||
public void testAllFilesPresentInSeveralCandidates() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/resolvedCalls/arguments/severalCandidates"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("mostSpecific.kt")
|
||||
public void testMostSpecific() throws Exception {
|
||||
doTest("compiler/testData/resolvedCalls/arguments/severalCandidates/mostSpecific.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Test innerSuite() {
|
||||
TestSuite suite = new TestSuite("Arguments");
|
||||
suite.addTestSuite(Arguments.class);
|
||||
suite.addTestSuite(FunctionLiterals.class);
|
||||
suite.addTestSuite(GenericCalls.class);
|
||||
suite.addTestSuite(NamedArguments.class);
|
||||
suite.addTestSuite(OneArgument.class);
|
||||
suite.addTestSuite(RealExamples.class);
|
||||
suite.addTestSuite(SeveralCandidates.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/resolvedCalls/functionTypes")
|
||||
public static class FunctionTypes extends AbstractResolvedCallsTest {
|
||||
public void testAllFilesPresentInFunctionTypes() throws Exception {
|
||||
@@ -159,6 +322,7 @@ public class ResolvedCallsTestGenerated extends AbstractResolvedCallsTest {
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite("ResolvedCallsTestGenerated");
|
||||
suite.addTestSuite(ResolvedCallsTestGenerated.class);
|
||||
suite.addTest(Arguments.innerSuite());
|
||||
suite.addTestSuite(FunctionTypes.class);
|
||||
suite.addTestSuite(Invoke.class);
|
||||
suite.addTestSuite(RealExamples.class);
|
||||
|
||||
Reference in New Issue
Block a user