From 48511206adb8dca004568b95e2e6894f9bb4d8cf Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Thu, 5 Jun 2014 14:36:31 +0400 Subject: [PATCH] Mark required call with 'caret' in abstract resolved calls test --- .../jet/lang/resolve/BindingContextUtils.kt | 13 +++++ .../functionLiterals/chainedLambdas.kt | 4 +- .../functionLiterals/chainedLambdas.txt | 4 +- .../notInferredLambdaReturnType.kt | 4 +- .../notInferredLambdaReturnType.txt | 4 +- .../functionLiterals/notInferredLambdaType.kt | 4 +- .../notInferredLambdaType.txt | 4 +- .../functionLiterals/simpleGenericLambda.kt | 4 +- .../functionLiterals/simpleGenericLambda.txt | 4 +- .../functionLiterals/simpleLambda.kt | 4 +- .../functionLiterals/simpleLambda.txt | 4 +- .../functionLiterals/unmappedLambda.kt | 4 +- .../functionLiterals/unmappedLambda.txt | 4 +- .../genericCalls/inferredParameter.kt | 4 +- .../genericCalls/inferredParameter.txt | 4 +- .../arguments/genericCalls/simpleGeneric.kt | 4 +- .../arguments/genericCalls/simpleGeneric.txt | 4 +- .../genericCalls/uninferredParameter.kt | 4 +- .../genericCalls/uninferredParameter.txt | 4 +- .../uninferredParameterTypeMismatch.kt | 4 +- .../uninferredParameterTypeMismatch.txt | 4 +- .../namedArguments/positionedAfterNamed.kt | 4 +- .../namedArguments/positionedAfterNamed.txt | 4 +- .../namedArguments/shiftedArgsMatch.kt | 4 +- .../namedArguments/shiftedArgsMatch.txt | 4 +- .../oneArgument/argumentHasNoType.kt | 4 +- .../oneArgument/argumentHasNoType.txt | 4 +- .../arguments/oneArgument/simpleMatch.kt | 4 +- .../arguments/oneArgument/simpleMatch.txt | 4 +- .../arguments/oneArgument/typeMismatch.kt | 4 +- .../arguments/oneArgument/typeMismatch.txt | 4 +- .../arguments/oneArgument/unmappedArgument.kt | 4 +- .../oneArgument/unmappedArgument.txt | 4 +- .../arguments/realExamples/emptyList.kt | 4 +- .../arguments/realExamples/emptyList.txt | 4 +- .../realExamples/emptyMutableList.kt | 4 +- .../realExamples/emptyMutableList.txt | 4 +- .../severalCandidates/mostSpecific.kt | 4 +- .../severalCandidates/mostSpecific.txt | 4 +- .../explicitReceiverIsReceiverArgument.kt | 4 +- .../explicitReceiverIsReceiverArgument.txt | 4 +- .../explicitReceiverIsThisObject.kt | 4 +- .../explicitReceiverIsThisObject.txt | 4 +- .../invokeForExtensionFunctionType.kt | 4 +- .../invokeForExtensionFunctionType.txt | 4 +- .../functionTypes/invokeForFunctionType.kt | 4 +- .../functionTypes/invokeForFunctionType.txt | 4 +- .../valOfExtensionFunctionType.kt | 4 +- .../valOfExtensionFunctionType.txt | 4 +- .../valOfExtensionFunctionTypeInvoke.kt | 4 +- .../valOfExtensionFunctionTypeInvoke.txt | 4 +- .../functionTypes/valOfFunctionType.kt | 4 +- .../functionTypes/valOfFunctionType.txt | 4 +- .../functionTypes/valOfFunctionTypeInvoke.kt | 4 +- .../functionTypes/valOfFunctionTypeInvoke.txt | 4 +- .../hasBothThisObjectAndReceiverArgument.kt | 4 +- .../hasBothThisObjectAndReceiverArgument.txt | 4 +- ...ReceiverArgumentWithoutExplicitReceiver.kt | 4 +- ...eceiverArgumentWithoutExplicitReceiver.txt | 4 +- .../implicitReceiverIsReceiverArgument.kt | 4 +- .../implicitReceiverIsReceiverArgument.txt | 4 +- .../implicitReceiverIsThisObject.kt | 4 +- .../implicitReceiverIsThisObject.txt | 4 +- .../impliedThisNoExplicitReceiver.kt | 4 +- .../impliedThisNoExplicitReceiver.txt | 4 +- .../resolvedCalls/invoke/bothReceivers.kt | 4 +- .../resolvedCalls/invoke/bothReceivers.txt | 4 +- .../invoke/implicitReceiverForInvoke.kt | 4 +- .../invoke/implicitReceiverForInvoke.txt | 4 +- .../receiverArgumentAsReceiverForInvoke.kt | 4 +- .../receiverArgumentAsReceiverForInvoke.txt | 4 +- .../invoke/thisObjectAsReceiverForInvoke.kt | 4 +- .../invoke/thisObjectAsReceiverForInvoke.txt | 4 +- .../realExamples/stringPlusInBuilders.kt | 4 +- .../realExamples/stringPlusInBuilders.txt | 4 +- compiler/testData/resolvedCalls/simpleCall.kt | 4 +- .../testData/resolvedCalls/simpleCall.txt | 4 +- .../calls/AbstractResolvedCallsTest.kt | 50 ++++++++----------- 78 files changed, 109 insertions(+), 258 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BindingContextUtils.kt b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BindingContextUtils.kt index b7615b955a2..3674c3231d8 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BindingContextUtils.kt +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BindingContextUtils.kt @@ -34,6 +34,11 @@ import org.jetbrains.jet.lang.psi.JetDeclarationWithBody import org.jetbrains.jet.lang.resolve.DescriptorUtils import org.jetbrains.jet.lang.descriptors.impl.AnonymousFunctionDescriptor import org.jetbrains.jet.lang.resolve.calls.ArgumentTypeResolver +import org.jetbrains.jet.lang.psi.JetArrayAccessExpression +import org.jetbrains.jet.lang.psi.JetUnaryExpression +import org.jetbrains.jet.lang.psi.JetBinaryExpression +import org.jetbrains.jet.lang.psi.JetSimpleNameExpression +import com.intellij.psi.util.PsiTreeUtil /** * For expressions like a(), a[i], a.b.c(), +a, a + b, (a()), a(): Int, @label a() @@ -57,6 +62,14 @@ fun JetExpression.getCorrespondingCall(bindingContext: BindingContext): Call? { return bindingContext[CALL, reference] } +fun JetExpression.getEnclosingCall(bindingContext: BindingContext): Call? { + val parent = PsiTreeUtil.getNonStrictParentOfType( + this, + javaClass(), javaClass(), javaClass(), + javaClass(), javaClass()) + return parent?.getCorrespondingCall(bindingContext) +} + fun Call.hasUnresolvedArguments(bindingContext: BindingContext): Boolean { val arguments = getValueArguments().map { it?.getArgumentExpression() } return arguments.any { diff --git a/compiler/testData/resolvedCalls/arguments/functionLiterals/chainedLambdas.kt b/compiler/testData/resolvedCalls/arguments/functionLiterals/chainedLambdas.kt index 9ef4432d82e..bb2ff2f0418 100644 --- a/compiler/testData/resolvedCalls/arguments/functionLiterals/chainedLambdas.kt +++ b/compiler/testData/resolvedCalls/arguments/functionLiterals/chainedLambdas.kt @@ -1,8 +1,6 @@ -// !CALL: foo - fun foo(t: T, f: (T) -> S, g: (S) -> R) {} fun test() { - foo(1, { x -> "$x"}, { y -> y.length }) + foo(1, { x -> "$x"}, { y -> y.length }) } \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/arguments/functionLiterals/chainedLambdas.txt b/compiler/testData/resolvedCalls/arguments/functionLiterals/chainedLambdas.txt index 7231979ad16..c1d52e51c88 100644 --- a/compiler/testData/resolvedCalls/arguments/functionLiterals/chainedLambdas.txt +++ b/compiler/testData/resolvedCalls/arguments/functionLiterals/chainedLambdas.txt @@ -1,10 +1,8 @@ -// !CALL: foo - fun foo(t: T, f: (T) -> S, g: (S) -> R) {} fun test() { - foo(1, { x -> "$x"}, { y -> y.length }) + foo(1, { x -> "$x"}, { y -> y.length }) } diff --git a/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaReturnType.kt b/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaReturnType.kt index 12a4c1f83ba..9e91cbb65fb 100644 --- a/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaReturnType.kt +++ b/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaReturnType.kt @@ -1,7 +1,5 @@ -// !CALL: foo - fun foo(f: () -> T) {} fun test() { - foo { b } + foo { b } } \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaReturnType.txt b/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaReturnType.txt index ffcccf2acdd..66ee4700e35 100644 --- a/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaReturnType.txt +++ b/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaReturnType.txt @@ -1,9 +1,7 @@ -// !CALL: foo - fun foo(f: () -> T) {} fun test() { - foo { b } + foo { b } } diff --git a/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaType.kt b/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaType.kt index 27e14388898..d246b2461fb 100644 --- a/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaType.kt +++ b/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaType.kt @@ -1,7 +1,5 @@ -// !CALL: foo - fun foo(f: (T) -> String) {} fun test() { - foo { x -> "$x"} + foo { x -> "$x"} } \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaType.txt b/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaType.txt index 9c2fd484423..f39602a176d 100644 --- a/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaType.txt +++ b/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaType.txt @@ -1,9 +1,7 @@ -// !CALL: foo - fun foo(f: (T) -> String) {} fun test() { - foo { x -> "$x"} + foo { x -> "$x"} } diff --git a/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleGenericLambda.kt b/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleGenericLambda.kt index b56ad44c1d4..b0714a6a5ab 100644 --- a/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleGenericLambda.kt +++ b/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleGenericLambda.kt @@ -1,7 +1,5 @@ -// !CALL: foo - fun foo(f: (T) -> String) {} fun test() { - foo { (x: Int) -> "$x"} + foo { (x: Int) -> "$x"} } \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleGenericLambda.txt b/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleGenericLambda.txt index ba18f5ecc06..ffefb4f1cbc 100644 --- a/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleGenericLambda.txt +++ b/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleGenericLambda.txt @@ -1,9 +1,7 @@ -// !CALL: foo - fun foo(f: (T) -> String) {} fun test() { - foo { (x: Int) -> "$x"} + foo { (x: Int) -> "$x"} } diff --git a/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleLambda.kt b/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleLambda.kt index 0c7dd89422b..6e966ba43a3 100644 --- a/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleLambda.kt +++ b/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleLambda.kt @@ -1,7 +1,5 @@ -// !CALL: foo - fun foo(f: (Int) -> String) {} fun test() { - foo { x -> "$x"} + foo { x -> "$x"} } \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleLambda.txt b/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleLambda.txt index 32f2a0e03e5..056c94a958b 100644 --- a/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleLambda.txt +++ b/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleLambda.txt @@ -1,9 +1,7 @@ -// !CALL: foo - fun foo(f: (Int) -> String) {} fun test() { - foo { x -> "$x"} + foo { x -> "$x"} } diff --git a/compiler/testData/resolvedCalls/arguments/functionLiterals/unmappedLambda.kt b/compiler/testData/resolvedCalls/arguments/functionLiterals/unmappedLambda.kt index ab11c610ddb..858eb231f29 100644 --- a/compiler/testData/resolvedCalls/arguments/functionLiterals/unmappedLambda.kt +++ b/compiler/testData/resolvedCalls/arguments/functionLiterals/unmappedLambda.kt @@ -1,7 +1,5 @@ -// !CALL: foo - fun foo() {} fun test() { - foo { x -> "$x"} + foo { x -> "$x"} } \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/arguments/functionLiterals/unmappedLambda.txt b/compiler/testData/resolvedCalls/arguments/functionLiterals/unmappedLambda.txt index aad1673179e..e60eb02cfb6 100644 --- a/compiler/testData/resolvedCalls/arguments/functionLiterals/unmappedLambda.txt +++ b/compiler/testData/resolvedCalls/arguments/functionLiterals/unmappedLambda.txt @@ -1,9 +1,7 @@ -// !CALL: foo - fun foo() {} fun test() { - foo { x -> "$x"} + foo { x -> "$x"} } diff --git a/compiler/testData/resolvedCalls/arguments/genericCalls/inferredParameter.kt b/compiler/testData/resolvedCalls/arguments/genericCalls/inferredParameter.kt index 680161c97d0..1b63ac5f1b2 100644 --- a/compiler/testData/resolvedCalls/arguments/genericCalls/inferredParameter.kt +++ b/compiler/testData/resolvedCalls/arguments/genericCalls/inferredParameter.kt @@ -1,9 +1,7 @@ -// !CALL: foo - fun foo(t: T, l: List) {} fun use(vararg a: Any?) = a fun test(a: Any, ls: List) { - use(foo(11, ls)) + use(foo(11, ls)) } \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/arguments/genericCalls/inferredParameter.txt b/compiler/testData/resolvedCalls/arguments/genericCalls/inferredParameter.txt index cc5180811f4..b8ed8d73f5a 100644 --- a/compiler/testData/resolvedCalls/arguments/genericCalls/inferredParameter.txt +++ b/compiler/testData/resolvedCalls/arguments/genericCalls/inferredParameter.txt @@ -1,11 +1,9 @@ -// !CALL: foo - fun foo(t: T, l: List) {} fun use(vararg a: Any?) = a fun test(a: Any, ls: List) { - use(foo(11, ls)) + use(foo(11, ls)) } diff --git a/compiler/testData/resolvedCalls/arguments/genericCalls/simpleGeneric.kt b/compiler/testData/resolvedCalls/arguments/genericCalls/simpleGeneric.kt index 5a7733044ba..85db157891f 100644 --- a/compiler/testData/resolvedCalls/arguments/genericCalls/simpleGeneric.kt +++ b/compiler/testData/resolvedCalls/arguments/genericCalls/simpleGeneric.kt @@ -1,9 +1,7 @@ -// !CALL: foo - class A {} fun foo(t: T) {} fun bar() { - foo(A()) + foo(A()) } \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/arguments/genericCalls/simpleGeneric.txt b/compiler/testData/resolvedCalls/arguments/genericCalls/simpleGeneric.txt index 570393ab6f4..b5c687db1b5 100644 --- a/compiler/testData/resolvedCalls/arguments/genericCalls/simpleGeneric.txt +++ b/compiler/testData/resolvedCalls/arguments/genericCalls/simpleGeneric.txt @@ -1,11 +1,9 @@ -// !CALL: foo - class A {} fun foo(t: T) {} fun bar() { - foo(A()) + foo(A()) } diff --git a/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameter.kt b/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameter.kt index 0f5861ca1d5..8f713769317 100644 --- a/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameter.kt +++ b/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameter.kt @@ -1,9 +1,7 @@ -// !CALL: foo - fun foo(t: T, l: MutableList) {} fun use(vararg a: Any?) = a fun test(ls: MutableList) { - use(foo(11, ls)) + use(foo(11, ls)) } \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameter.txt b/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameter.txt index c6fc212243c..a6c4e0ab52b 100644 --- a/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameter.txt +++ b/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameter.txt @@ -1,11 +1,9 @@ -// !CALL: foo - fun foo(t: T, l: MutableList) {} fun use(vararg a: Any?) = a fun test(ls: MutableList) { - use(foo(11, ls)) + use(foo(11, ls)) } diff --git a/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameterTypeMismatch.kt b/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameterTypeMismatch.kt index f24ac60f881..e43ae308a5e 100644 --- a/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameterTypeMismatch.kt +++ b/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameterTypeMismatch.kt @@ -1,7 +1,5 @@ -// !CALL: foo - fun foo(l: List) {} fun test() { - foo(11) + foo(11) } \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameterTypeMismatch.txt b/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameterTypeMismatch.txt index 382692b58fc..3f8f6545b8c 100644 --- a/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameterTypeMismatch.txt +++ b/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameterTypeMismatch.txt @@ -1,9 +1,7 @@ -// !CALL: foo - fun foo(l: List) {} fun test() { - foo(11) + foo(11) } diff --git a/compiler/testData/resolvedCalls/arguments/namedArguments/positionedAfterNamed.kt b/compiler/testData/resolvedCalls/arguments/namedArguments/positionedAfterNamed.kt index c42618de1f2..d770c3482c2 100644 --- a/compiler/testData/resolvedCalls/arguments/namedArguments/positionedAfterNamed.kt +++ b/compiler/testData/resolvedCalls/arguments/namedArguments/positionedAfterNamed.kt @@ -1,10 +1,8 @@ -// !CALL: foo - class A {} class B {} fun foo(a: A, b: B) {} fun bar() { - foo(b = B(), A()) + foo(b = B(), A()) } \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/arguments/namedArguments/positionedAfterNamed.txt b/compiler/testData/resolvedCalls/arguments/namedArguments/positionedAfterNamed.txt index c177029725a..28b7ea1d382 100644 --- a/compiler/testData/resolvedCalls/arguments/namedArguments/positionedAfterNamed.txt +++ b/compiler/testData/resolvedCalls/arguments/namedArguments/positionedAfterNamed.txt @@ -1,12 +1,10 @@ -// !CALL: foo - class A {} class B {} fun foo(a: A, b: B) {} fun bar() { - foo(b = B(), A()) + foo(b = B(), A()) } diff --git a/compiler/testData/resolvedCalls/arguments/namedArguments/shiftedArgsMatch.kt b/compiler/testData/resolvedCalls/arguments/namedArguments/shiftedArgsMatch.kt index 1971907315d..efadea066e4 100644 --- a/compiler/testData/resolvedCalls/arguments/namedArguments/shiftedArgsMatch.kt +++ b/compiler/testData/resolvedCalls/arguments/namedArguments/shiftedArgsMatch.kt @@ -1,10 +1,8 @@ -// !CALL: foo - class A {} class B {} fun foo(a: A, b: B) {} fun bar() { - foo(b = B(), a = A()) + foo(b = B(), a = A()) } \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/arguments/namedArguments/shiftedArgsMatch.txt b/compiler/testData/resolvedCalls/arguments/namedArguments/shiftedArgsMatch.txt index 14b9c67626a..9382881aa69 100644 --- a/compiler/testData/resolvedCalls/arguments/namedArguments/shiftedArgsMatch.txt +++ b/compiler/testData/resolvedCalls/arguments/namedArguments/shiftedArgsMatch.txt @@ -1,12 +1,10 @@ -// !CALL: foo - class A {} class B {} fun foo(a: A, b: B) {} fun bar() { - foo(b = B(), a = A()) + foo(b = B(), a = A()) } diff --git a/compiler/testData/resolvedCalls/arguments/oneArgument/argumentHasNoType.kt b/compiler/testData/resolvedCalls/arguments/oneArgument/argumentHasNoType.kt index 0f257a797ec..846457c3ae3 100644 --- a/compiler/testData/resolvedCalls/arguments/oneArgument/argumentHasNoType.kt +++ b/compiler/testData/resolvedCalls/arguments/oneArgument/argumentHasNoType.kt @@ -1,9 +1,7 @@ -// !CALL: foo - class A {} fun foo(a: A) {} fun bar() { - foo(b) + foo(b) } \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/arguments/oneArgument/argumentHasNoType.txt b/compiler/testData/resolvedCalls/arguments/oneArgument/argumentHasNoType.txt index 55463da60cc..f098fd4953d 100644 --- a/compiler/testData/resolvedCalls/arguments/oneArgument/argumentHasNoType.txt +++ b/compiler/testData/resolvedCalls/arguments/oneArgument/argumentHasNoType.txt @@ -1,11 +1,9 @@ -// !CALL: foo - class A {} fun foo(a: A) {} fun bar() { - foo(b) + foo(b) } diff --git a/compiler/testData/resolvedCalls/arguments/oneArgument/simpleMatch.kt b/compiler/testData/resolvedCalls/arguments/oneArgument/simpleMatch.kt index 1c539e8a7fc..c768220a541 100644 --- a/compiler/testData/resolvedCalls/arguments/oneArgument/simpleMatch.kt +++ b/compiler/testData/resolvedCalls/arguments/oneArgument/simpleMatch.kt @@ -1,9 +1,7 @@ -// !CALL: foo - class A {} fun foo(a: A) {} fun bar() { - foo(A()) + foo(A()) } \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/arguments/oneArgument/simpleMatch.txt b/compiler/testData/resolvedCalls/arguments/oneArgument/simpleMatch.txt index ee64e966f6a..edc79a112ad 100644 --- a/compiler/testData/resolvedCalls/arguments/oneArgument/simpleMatch.txt +++ b/compiler/testData/resolvedCalls/arguments/oneArgument/simpleMatch.txt @@ -1,11 +1,9 @@ -// !CALL: foo - class A {} fun foo(a: A) {} fun bar() { - foo(A()) + foo(A()) } diff --git a/compiler/testData/resolvedCalls/arguments/oneArgument/typeMismatch.kt b/compiler/testData/resolvedCalls/arguments/oneArgument/typeMismatch.kt index 2bbc989a2cf..7d08c6f2e46 100644 --- a/compiler/testData/resolvedCalls/arguments/oneArgument/typeMismatch.kt +++ b/compiler/testData/resolvedCalls/arguments/oneArgument/typeMismatch.kt @@ -1,9 +1,7 @@ -// !CALL: foo - class A {} fun foo(a: A) {} fun bar() { - foo("") + foo("") } \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/arguments/oneArgument/typeMismatch.txt b/compiler/testData/resolvedCalls/arguments/oneArgument/typeMismatch.txt index de38d1a98c5..d2987216848 100644 --- a/compiler/testData/resolvedCalls/arguments/oneArgument/typeMismatch.txt +++ b/compiler/testData/resolvedCalls/arguments/oneArgument/typeMismatch.txt @@ -1,11 +1,9 @@ -// !CALL: foo - class A {} fun foo(a: A) {} fun bar() { - foo("") + foo("") } diff --git a/compiler/testData/resolvedCalls/arguments/oneArgument/unmappedArgument.kt b/compiler/testData/resolvedCalls/arguments/oneArgument/unmappedArgument.kt index bfdb7ab34d7..91e97452421 100644 --- a/compiler/testData/resolvedCalls/arguments/oneArgument/unmappedArgument.kt +++ b/compiler/testData/resolvedCalls/arguments/oneArgument/unmappedArgument.kt @@ -1,7 +1,5 @@ -// !CALL: foo - fun foo() {} fun bar() { - foo("") + foo("") } \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/arguments/oneArgument/unmappedArgument.txt b/compiler/testData/resolvedCalls/arguments/oneArgument/unmappedArgument.txt index 44cd69c3822..e8953ac1f78 100644 --- a/compiler/testData/resolvedCalls/arguments/oneArgument/unmappedArgument.txt +++ b/compiler/testData/resolvedCalls/arguments/oneArgument/unmappedArgument.txt @@ -1,9 +1,7 @@ -// !CALL: foo - fun foo() {} fun bar() { - foo("") + foo("") } diff --git a/compiler/testData/resolvedCalls/arguments/realExamples/emptyList.kt b/compiler/testData/resolvedCalls/arguments/realExamples/emptyList.kt index 126f409b36e..efbcfff5fd4 100644 --- a/compiler/testData/resolvedCalls/arguments/realExamples/emptyList.kt +++ b/compiler/testData/resolvedCalls/arguments/realExamples/emptyList.kt @@ -1,5 +1,3 @@ -// !CALL: foo - class A {} fun foo(t: T) {} @@ -7,5 +5,5 @@ fun foo(t: T) {} fun emptyList(): List = throw Exception() fun bar() { - foo(emptyList()) + foo(emptyList()) } \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/arguments/realExamples/emptyList.txt b/compiler/testData/resolvedCalls/arguments/realExamples/emptyList.txt index 78f56871520..a363fcbd899 100644 --- a/compiler/testData/resolvedCalls/arguments/realExamples/emptyList.txt +++ b/compiler/testData/resolvedCalls/arguments/realExamples/emptyList.txt @@ -1,5 +1,3 @@ -// !CALL: foo - class A {} fun foo(t: T) {} @@ -7,7 +5,7 @@ fun foo(t: T) {} fun emptyList(): List = throw Exception() fun bar() { - foo(emptyList()) + foo(emptyList()) } diff --git a/compiler/testData/resolvedCalls/arguments/realExamples/emptyMutableList.kt b/compiler/testData/resolvedCalls/arguments/realExamples/emptyMutableList.kt index 188e94324aa..2fdc1eba65f 100644 --- a/compiler/testData/resolvedCalls/arguments/realExamples/emptyMutableList.kt +++ b/compiler/testData/resolvedCalls/arguments/realExamples/emptyMutableList.kt @@ -1,5 +1,3 @@ -// !CALL: foo - class A {} fun foo(t: T) {} @@ -7,5 +5,5 @@ fun foo(t: T) {} fun emptyList(): MutableList = throw Exception() fun bar() { - foo(emptyList()) + foo(emptyList()) } \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/arguments/realExamples/emptyMutableList.txt b/compiler/testData/resolvedCalls/arguments/realExamples/emptyMutableList.txt index e7a39096d91..f8823bf7896 100644 --- a/compiler/testData/resolvedCalls/arguments/realExamples/emptyMutableList.txt +++ b/compiler/testData/resolvedCalls/arguments/realExamples/emptyMutableList.txt @@ -1,5 +1,3 @@ -// !CALL: foo - class A {} fun foo(t: T) {} @@ -7,7 +5,7 @@ fun foo(t: T) {} fun emptyList(): MutableList = throw Exception() fun bar() { - foo(emptyList()) + foo(emptyList()) } diff --git a/compiler/testData/resolvedCalls/arguments/severalCandidates/mostSpecific.kt b/compiler/testData/resolvedCalls/arguments/severalCandidates/mostSpecific.kt index 9a8f7d5d5b8..5a1310b71be 100644 --- a/compiler/testData/resolvedCalls/arguments/severalCandidates/mostSpecific.kt +++ b/compiler/testData/resolvedCalls/arguments/severalCandidates/mostSpecific.kt @@ -1,5 +1,3 @@ -// !CALL: foo - class A {} fun foo(a: A) {} @@ -7,5 +5,5 @@ fun foo(a: A, s: String) {} fun foo(a: A, any: Any) {} fun bar() { - foo(A(), "") + foo(A(), "") } \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/arguments/severalCandidates/mostSpecific.txt b/compiler/testData/resolvedCalls/arguments/severalCandidates/mostSpecific.txt index 2c9fc57df6f..356700d9232 100644 --- a/compiler/testData/resolvedCalls/arguments/severalCandidates/mostSpecific.txt +++ b/compiler/testData/resolvedCalls/arguments/severalCandidates/mostSpecific.txt @@ -1,5 +1,3 @@ -// !CALL: foo - class A {} fun foo(a: A) {} @@ -7,7 +5,7 @@ fun foo(a: A, s: String) {} fun foo(a: A, any: Any) {} fun bar() { - foo(A(), "") + foo(A(), "") } diff --git a/compiler/testData/resolvedCalls/explicitReceiverIsReceiverArgument.kt b/compiler/testData/resolvedCalls/explicitReceiverIsReceiverArgument.kt index 03668ab7c84..2cbb4879d85 100644 --- a/compiler/testData/resolvedCalls/explicitReceiverIsReceiverArgument.kt +++ b/compiler/testData/resolvedCalls/explicitReceiverIsReceiverArgument.kt @@ -1,9 +1,7 @@ -// !CALL: foo - class A {} fun A.foo() {} fun bar(a: A) { - a.foo() + a.foo() } diff --git a/compiler/testData/resolvedCalls/explicitReceiverIsReceiverArgument.txt b/compiler/testData/resolvedCalls/explicitReceiverIsReceiverArgument.txt index c9ab1a45887..04191d7f5f4 100644 --- a/compiler/testData/resolvedCalls/explicitReceiverIsReceiverArgument.txt +++ b/compiler/testData/resolvedCalls/explicitReceiverIsReceiverArgument.txt @@ -1,11 +1,9 @@ -// !CALL: foo - class A {} fun A.foo() {} fun bar(a: A) { - a.foo() + a.foo() } diff --git a/compiler/testData/resolvedCalls/explicitReceiverIsThisObject.kt b/compiler/testData/resolvedCalls/explicitReceiverIsThisObject.kt index a682a5c5268..c485f3893e2 100644 --- a/compiler/testData/resolvedCalls/explicitReceiverIsThisObject.kt +++ b/compiler/testData/resolvedCalls/explicitReceiverIsThisObject.kt @@ -1,9 +1,7 @@ -// !CALL: foo - class A { fun foo() {} } fun bar(a: A) { - a.foo() + a.foo() } diff --git a/compiler/testData/resolvedCalls/explicitReceiverIsThisObject.txt b/compiler/testData/resolvedCalls/explicitReceiverIsThisObject.txt index 628ee173498..bd56ecc7a55 100644 --- a/compiler/testData/resolvedCalls/explicitReceiverIsThisObject.txt +++ b/compiler/testData/resolvedCalls/explicitReceiverIsThisObject.txt @@ -1,11 +1,9 @@ -// !CALL: foo - class A { fun foo() {} } fun bar(a: A) { - a.foo() + a.foo() } diff --git a/compiler/testData/resolvedCalls/functionTypes/invokeForExtensionFunctionType.kt b/compiler/testData/resolvedCalls/functionTypes/invokeForExtensionFunctionType.kt index 427392a2dca..58f46f6845d 100644 --- a/compiler/testData/resolvedCalls/functionTypes/invokeForExtensionFunctionType.kt +++ b/compiler/testData/resolvedCalls/functionTypes/invokeForExtensionFunctionType.kt @@ -1,5 +1,3 @@ -// !CALL: invoke - fun bar(f: Int.()->Unit) { - 1.f() + 1.f() } diff --git a/compiler/testData/resolvedCalls/functionTypes/invokeForExtensionFunctionType.txt b/compiler/testData/resolvedCalls/functionTypes/invokeForExtensionFunctionType.txt index b15d976157a..d5dc30baaaf 100644 --- a/compiler/testData/resolvedCalls/functionTypes/invokeForExtensionFunctionType.txt +++ b/compiler/testData/resolvedCalls/functionTypes/invokeForExtensionFunctionType.txt @@ -1,7 +1,5 @@ -// !CALL: invoke - fun bar(f: Int.()->Unit) { - 1.f() + 1.f() } diff --git a/compiler/testData/resolvedCalls/functionTypes/invokeForFunctionType.kt b/compiler/testData/resolvedCalls/functionTypes/invokeForFunctionType.kt index 11989964af1..990f47a3354 100644 --- a/compiler/testData/resolvedCalls/functionTypes/invokeForFunctionType.kt +++ b/compiler/testData/resolvedCalls/functionTypes/invokeForFunctionType.kt @@ -1,5 +1,3 @@ -// !CALL: invoke - fun bar(f: ()->Unit) { - f() + f() } diff --git a/compiler/testData/resolvedCalls/functionTypes/invokeForFunctionType.txt b/compiler/testData/resolvedCalls/functionTypes/invokeForFunctionType.txt index 5fbbc770795..fba366e6d2c 100644 --- a/compiler/testData/resolvedCalls/functionTypes/invokeForFunctionType.txt +++ b/compiler/testData/resolvedCalls/functionTypes/invokeForFunctionType.txt @@ -1,7 +1,5 @@ -// !CALL: invoke - fun bar(f: ()->Unit) { - f() + f() } diff --git a/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionType.kt b/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionType.kt index 496841ebd8d..52c77b2e2b7 100644 --- a/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionType.kt +++ b/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionType.kt @@ -1,9 +1,7 @@ -// !CALL: foo - trait A { val foo: Int.()->Unit fun test() { - 1.foo() + 1.foo() } } diff --git a/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionType.txt b/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionType.txt index 566a63f0ff2..9dcebd6aee8 100644 --- a/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionType.txt +++ b/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionType.txt @@ -1,10 +1,8 @@ -// !CALL: foo - trait A { val foo: Int.()->Unit fun test() { - 1.foo() + 1.foo() } } diff --git a/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionTypeInvoke.kt b/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionTypeInvoke.kt index d07a5c2b8b8..0ddcfad66f8 100644 --- a/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionTypeInvoke.kt +++ b/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionTypeInvoke.kt @@ -1,9 +1,7 @@ -// !CALL: invoke - trait A { val foo: Int.()->Unit fun test() { - 1.foo() + 1.foo() } } diff --git a/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionTypeInvoke.txt b/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionTypeInvoke.txt index 4458bd0cb10..d395cbff7db 100644 --- a/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionTypeInvoke.txt +++ b/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionTypeInvoke.txt @@ -1,10 +1,8 @@ -// !CALL: invoke - trait A { val foo: Int.()->Unit fun test() { - 1.foo() + 1.foo() } } diff --git a/compiler/testData/resolvedCalls/functionTypes/valOfFunctionType.kt b/compiler/testData/resolvedCalls/functionTypes/valOfFunctionType.kt index 871254e1d7a..bc7c508eecb 100644 --- a/compiler/testData/resolvedCalls/functionTypes/valOfFunctionType.kt +++ b/compiler/testData/resolvedCalls/functionTypes/valOfFunctionType.kt @@ -1,9 +1,7 @@ -// !CALL: foo - trait A { val foo: (Int)->Int } fun test(a: A) { - a.foo(1) + a.foo(1) } \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/functionTypes/valOfFunctionType.txt b/compiler/testData/resolvedCalls/functionTypes/valOfFunctionType.txt index 26796310fdd..43bac144301 100644 --- a/compiler/testData/resolvedCalls/functionTypes/valOfFunctionType.txt +++ b/compiler/testData/resolvedCalls/functionTypes/valOfFunctionType.txt @@ -1,11 +1,9 @@ -// !CALL: foo - trait A { val foo: (Int)->Int } fun test(a: A) { - a.foo(1) + a.foo(1) } diff --git a/compiler/testData/resolvedCalls/functionTypes/valOfFunctionTypeInvoke.kt b/compiler/testData/resolvedCalls/functionTypes/valOfFunctionTypeInvoke.kt index dda6f5901c3..ce3c9349213 100644 --- a/compiler/testData/resolvedCalls/functionTypes/valOfFunctionTypeInvoke.kt +++ b/compiler/testData/resolvedCalls/functionTypes/valOfFunctionTypeInvoke.kt @@ -1,9 +1,7 @@ -// !CALL: invoke - trait A { val foo: (Int)->Int } fun test(a: A) { - a.foo(1) + a.foo(1) } \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/functionTypes/valOfFunctionTypeInvoke.txt b/compiler/testData/resolvedCalls/functionTypes/valOfFunctionTypeInvoke.txt index 58835e53448..59b8a909d9c 100644 --- a/compiler/testData/resolvedCalls/functionTypes/valOfFunctionTypeInvoke.txt +++ b/compiler/testData/resolvedCalls/functionTypes/valOfFunctionTypeInvoke.txt @@ -1,11 +1,9 @@ -// !CALL: invoke - trait A { val foo: (Int)->Int } fun test(a: A) { - a.foo(1) + a.foo(1) } diff --git a/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgument.kt b/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgument.kt index 486ac05e8cb..3d7c1421596 100644 --- a/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgument.kt +++ b/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgument.kt @@ -1,5 +1,3 @@ -// !CALL: foo - class A { fun B.foo() {} } @@ -8,7 +6,7 @@ trait B fun bar(a: A, b: B) { with (a) { - b.foo() + b.foo() } } diff --git a/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgument.txt b/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgument.txt index d8a6832dc88..626d229bfc3 100644 --- a/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgument.txt +++ b/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgument.txt @@ -1,5 +1,3 @@ -// !CALL: foo - class A { fun B.foo() {} } @@ -8,7 +6,7 @@ trait B fun bar(a: A, b: B) { with (a) { - b.foo() + b.foo() } } diff --git a/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgumentWithoutExplicitReceiver.kt b/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgumentWithoutExplicitReceiver.kt index 7958ac03456..537c53ec85a 100644 --- a/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgumentWithoutExplicitReceiver.kt +++ b/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgumentWithoutExplicitReceiver.kt @@ -1,5 +1,3 @@ -// !CALL: foo - class A { fun B.foo() {} } @@ -9,7 +7,7 @@ trait B fun bar(a: A, b: B) { with (a) { with (b) { - foo() + foo() } } } diff --git a/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgumentWithoutExplicitReceiver.txt b/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgumentWithoutExplicitReceiver.txt index 687d5f57d69..f6cc189ec9e 100644 --- a/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgumentWithoutExplicitReceiver.txt +++ b/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgumentWithoutExplicitReceiver.txt @@ -1,5 +1,3 @@ -// !CALL: foo - class A { fun B.foo() {} } @@ -9,7 +7,7 @@ trait B fun bar(a: A, b: B) { with (a) { with (b) { - foo() + foo() } } } diff --git a/compiler/testData/resolvedCalls/implicitReceiverIsReceiverArgument.kt b/compiler/testData/resolvedCalls/implicitReceiverIsReceiverArgument.kt index 1af661a1964..0fccc7de552 100644 --- a/compiler/testData/resolvedCalls/implicitReceiverIsReceiverArgument.kt +++ b/compiler/testData/resolvedCalls/implicitReceiverIsReceiverArgument.kt @@ -1,9 +1,7 @@ -// !CALL: foo - class A {} fun A.foo() {} fun A.bar() { - foo() + foo() } diff --git a/compiler/testData/resolvedCalls/implicitReceiverIsReceiverArgument.txt b/compiler/testData/resolvedCalls/implicitReceiverIsReceiverArgument.txt index b1e77032006..b726fb61621 100644 --- a/compiler/testData/resolvedCalls/implicitReceiverIsReceiverArgument.txt +++ b/compiler/testData/resolvedCalls/implicitReceiverIsReceiverArgument.txt @@ -1,11 +1,9 @@ -// !CALL: foo - class A {} fun A.foo() {} fun A.bar() { - foo() + foo() } diff --git a/compiler/testData/resolvedCalls/implicitReceiverIsThisObject.kt b/compiler/testData/resolvedCalls/implicitReceiverIsThisObject.kt index 9f58e24c51f..b8a8f7b2d58 100644 --- a/compiler/testData/resolvedCalls/implicitReceiverIsThisObject.kt +++ b/compiler/testData/resolvedCalls/implicitReceiverIsThisObject.kt @@ -1,9 +1,7 @@ -// !CALL: foo - class A { fun foo() {} } fun A.bar() { - foo() + foo() } diff --git a/compiler/testData/resolvedCalls/implicitReceiverIsThisObject.txt b/compiler/testData/resolvedCalls/implicitReceiverIsThisObject.txt index d4198a0ed2e..65f6e00a35d 100644 --- a/compiler/testData/resolvedCalls/implicitReceiverIsThisObject.txt +++ b/compiler/testData/resolvedCalls/implicitReceiverIsThisObject.txt @@ -1,11 +1,9 @@ -// !CALL: foo - class A { fun foo() {} } fun A.bar() { - foo() + foo() } diff --git a/compiler/testData/resolvedCalls/impliedThisNoExplicitReceiver.kt b/compiler/testData/resolvedCalls/impliedThisNoExplicitReceiver.kt index b592edc9290..d6d30721e99 100644 --- a/compiler/testData/resolvedCalls/impliedThisNoExplicitReceiver.kt +++ b/compiler/testData/resolvedCalls/impliedThisNoExplicitReceiver.kt @@ -1,8 +1,6 @@ -// !CALL: foo - class A { fun foo() {} fun bar() { - foo() + foo() } } \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/impliedThisNoExplicitReceiver.txt b/compiler/testData/resolvedCalls/impliedThisNoExplicitReceiver.txt index 149c4f1d712..f15b9251fc9 100644 --- a/compiler/testData/resolvedCalls/impliedThisNoExplicitReceiver.txt +++ b/compiler/testData/resolvedCalls/impliedThisNoExplicitReceiver.txt @@ -1,9 +1,7 @@ -// !CALL: foo - class A { fun foo() {} fun bar() { - foo() + foo() } } diff --git a/compiler/testData/resolvedCalls/invoke/bothReceivers.kt b/compiler/testData/resolvedCalls/invoke/bothReceivers.kt index 5f7fb781e35..589323adc33 100644 --- a/compiler/testData/resolvedCalls/invoke/bothReceivers.kt +++ b/compiler/testData/resolvedCalls/invoke/bothReceivers.kt @@ -1,9 +1,7 @@ -// !CALL: invoke - class Foo() { fun Int.invoke() {} } fun bar(f: Foo) { - 1.f() + 1.f() } diff --git a/compiler/testData/resolvedCalls/invoke/bothReceivers.txt b/compiler/testData/resolvedCalls/invoke/bothReceivers.txt index 7f839d2538e..75df4a02162 100644 --- a/compiler/testData/resolvedCalls/invoke/bothReceivers.txt +++ b/compiler/testData/resolvedCalls/invoke/bothReceivers.txt @@ -1,11 +1,9 @@ -// !CALL: invoke - class Foo() { fun Int.invoke() {} } fun bar(f: Foo) { - 1.f() + 1.f() } diff --git a/compiler/testData/resolvedCalls/invoke/implicitReceiverForInvoke.kt b/compiler/testData/resolvedCalls/invoke/implicitReceiverForInvoke.kt index 739996ce04c..69c572f9a12 100644 --- a/compiler/testData/resolvedCalls/invoke/implicitReceiverForInvoke.kt +++ b/compiler/testData/resolvedCalls/invoke/implicitReceiverForInvoke.kt @@ -1,12 +1,10 @@ -// !CALL: invoke - class Foo() { fun Int.invoke() {} } fun bar(f: Foo, i: Int) { with (i) { - f() + f() } } diff --git a/compiler/testData/resolvedCalls/invoke/implicitReceiverForInvoke.txt b/compiler/testData/resolvedCalls/invoke/implicitReceiverForInvoke.txt index b3d65cf6105..fbaae4479f6 100644 --- a/compiler/testData/resolvedCalls/invoke/implicitReceiverForInvoke.txt +++ b/compiler/testData/resolvedCalls/invoke/implicitReceiverForInvoke.txt @@ -1,12 +1,10 @@ -// !CALL: invoke - class Foo() { fun Int.invoke() {} } fun bar(f: Foo, i: Int) { with (i) { - f() + f() } } diff --git a/compiler/testData/resolvedCalls/invoke/receiverArgumentAsReceiverForInvoke.kt b/compiler/testData/resolvedCalls/invoke/receiverArgumentAsReceiverForInvoke.kt index 5c33054ca99..b11127df1f6 100644 --- a/compiler/testData/resolvedCalls/invoke/receiverArgumentAsReceiverForInvoke.kt +++ b/compiler/testData/resolvedCalls/invoke/receiverArgumentAsReceiverForInvoke.kt @@ -1,8 +1,6 @@ -// !CALL: invoke - class Foo fun Foo.invoke() {} fun bar(f: Foo) { - f() + f() } diff --git a/compiler/testData/resolvedCalls/invoke/receiverArgumentAsReceiverForInvoke.txt b/compiler/testData/resolvedCalls/invoke/receiverArgumentAsReceiverForInvoke.txt index a6f02983a09..f010934444b 100644 --- a/compiler/testData/resolvedCalls/invoke/receiverArgumentAsReceiverForInvoke.txt +++ b/compiler/testData/resolvedCalls/invoke/receiverArgumentAsReceiverForInvoke.txt @@ -1,10 +1,8 @@ -// !CALL: invoke - class Foo fun Foo.invoke() {} fun bar(f: Foo) { - f() + f() } diff --git a/compiler/testData/resolvedCalls/invoke/thisObjectAsReceiverForInvoke.kt b/compiler/testData/resolvedCalls/invoke/thisObjectAsReceiverForInvoke.kt index aa49c2a2788..34598290dd3 100644 --- a/compiler/testData/resolvedCalls/invoke/thisObjectAsReceiverForInvoke.kt +++ b/compiler/testData/resolvedCalls/invoke/thisObjectAsReceiverForInvoke.kt @@ -1,9 +1,7 @@ -// !CALL: invoke - class Foo { fun invoke() {} } fun bar(f: Foo) { - f() + f() } diff --git a/compiler/testData/resolvedCalls/invoke/thisObjectAsReceiverForInvoke.txt b/compiler/testData/resolvedCalls/invoke/thisObjectAsReceiverForInvoke.txt index 172096c4f8c..0223ce4b121 100644 --- a/compiler/testData/resolvedCalls/invoke/thisObjectAsReceiverForInvoke.txt +++ b/compiler/testData/resolvedCalls/invoke/thisObjectAsReceiverForInvoke.txt @@ -1,11 +1,9 @@ -// !CALL: invoke - class Foo { fun invoke() {} } fun bar(f: Foo) { - f() + f() } diff --git a/compiler/testData/resolvedCalls/realExamples/stringPlusInBuilders.kt b/compiler/testData/resolvedCalls/realExamples/stringPlusInBuilders.kt index 7b1b5701c1e..e8799a68b01 100644 --- a/compiler/testData/resolvedCalls/realExamples/stringPlusInBuilders.kt +++ b/compiler/testData/resolvedCalls/realExamples/stringPlusInBuilders.kt @@ -1,5 +1,3 @@ -// !CALL: + - trait Element { fun render(builder: StringBuilder, indent: String) } @@ -34,7 +32,7 @@ fun html(init: HTML.() -> Unit): HTML = fail fun result() = html { head { - title {+"Foo"} + title { +"Foo" } } } diff --git a/compiler/testData/resolvedCalls/realExamples/stringPlusInBuilders.txt b/compiler/testData/resolvedCalls/realExamples/stringPlusInBuilders.txt index 634172c794b..f7335d10769 100644 --- a/compiler/testData/resolvedCalls/realExamples/stringPlusInBuilders.txt +++ b/compiler/testData/resolvedCalls/realExamples/stringPlusInBuilders.txt @@ -1,5 +1,3 @@ -// !CALL: + - trait Element { fun render(builder: StringBuilder, indent: String) } @@ -34,7 +32,7 @@ fun html(init: HTML.() -> Unit): HTML = fail fun result() = html { head { - title {+"Foo"} + title { +"Foo" } } } diff --git a/compiler/testData/resolvedCalls/simpleCall.kt b/compiler/testData/resolvedCalls/simpleCall.kt index 52dc57ee54a..1daf18adb77 100644 --- a/compiler/testData/resolvedCalls/simpleCall.kt +++ b/compiler/testData/resolvedCalls/simpleCall.kt @@ -1,7 +1,5 @@ -// !CALL: foo - fun foo() {} fun bar() { - foo() + foo() } diff --git a/compiler/testData/resolvedCalls/simpleCall.txt b/compiler/testData/resolvedCalls/simpleCall.txt index 9c60caad578..e76342b732b 100644 --- a/compiler/testData/resolvedCalls/simpleCall.txt +++ b/compiler/testData/resolvedCalls/simpleCall.txt @@ -1,9 +1,7 @@ -// !CALL: foo - fun foo() {} fun bar() { - foo() + foo() } diff --git a/compiler/tests/org/jetbrains/jet/resolve/calls/AbstractResolvedCallsTest.kt b/compiler/tests/org/jetbrains/jet/resolve/calls/AbstractResolvedCallsTest.kt index f0d8e85a92d..f81b6c0b3eb 100644 --- a/compiler/tests/org/jetbrains/jet/resolve/calls/AbstractResolvedCallsTest.kt +++ b/compiler/tests/org/jetbrains/jet/resolve/calls/AbstractResolvedCallsTest.kt @@ -20,7 +20,6 @@ import org.jetbrains.jet.ConfigurationKind import org.jetbrains.jet.JetLiteFixture import org.jetbrains.jet.JetTestUtils import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment -import org.jetbrains.jet.lang.psi.JetElement import org.jetbrains.jet.lang.resolve.BindingContext import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall import org.jetbrains.jet.lang.resolve.scopes.receivers.AbstractReceiverValue @@ -28,8 +27,6 @@ import org.jetbrains.jet.lang.resolve.scopes.receivers.ExpressionReceiver import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue import java.io.File -import kotlin.test.assertTrue -import org.jetbrains.jet.lang.resolve.calls.model.VariableAsFunctionResolvedCall import org.jetbrains.jet.lang.resolve.lazy.JvmResolveUtil import org.jetbrains.jet.lang.resolve.calls.model.ArgumentMapping import org.jetbrains.jet.lang.resolve.calls.model.ArgumentMatch @@ -37,43 +34,36 @@ import org.jetbrains.jet.lang.resolve.calls.util.getAllValueArguments import org.jetbrains.jet.renderer.DescriptorRenderer import com.intellij.openapi.util.io.FileUtil import org.jetbrains.jet.lang.psi.ValueArgument +import org.jetbrains.jet.lang.psi.JetPsiFactory +import org.jetbrains.jet.lang.psi.JetExpression +import org.jetbrains.jet.lang.resolve.bindingContextUtil.getEnclosingCall +import com.intellij.psi.util.PsiTreeUtil +import org.jetbrains.jet.lang.resolve.calls.model.VariableAsFunctionResolvedCall public abstract class AbstractResolvedCallsTest() : JetLiteFixture() { override fun createEnvironment(): JetCoreEnvironment = createEnvironmentWithMockJdk(ConfigurationKind.JDK_ONLY) public fun doTest(filePath: String) { - val file = File(filePath) - val text = JetTestUtils.doLoadFile(file) - val directives = JetTestUtils.parseDirectives(text) + val text = JetTestUtils.doLoadFile(File(filePath))!! - val callName = directives["CALL"] + val jetFile = JetPsiFactory.createFile(getProject(), text.replace("", "")) + val bindingContext = JvmResolveUtil.analyzeOneFileWithJavaIntegration(jetFile).getBindingContext() - fun analyzeFileAndGetResolvedCallEntries(): Map> { - val psiFile = JetTestUtils.loadJetFile(getProject(), file)!! - val analyzeExhaust = JvmResolveUtil.analyzeOneFileWithJavaIntegration(psiFile) - val bindingContext = analyzeExhaust.getBindingContext() - return bindingContext.getSliceContents(BindingContext.RESOLVED_CALL) + val element = jetFile.findElementAt(text.indexOf("")) + val expression = PsiTreeUtil.getParentOfType(element, javaClass()) + val call = expression?.getEnclosingCall(bindingContext) + + val cachedCall = bindingContext[BindingContext.RESOLVED_CALL, call?.getCalleeExpression()] + if (cachedCall == null) { + throw AssertionError("No resolved call for:\nelement: ${element.toString()}\nexpression: ${expression.toString()}\ncall: $call") } - var callFound = false - fun tryCall(resolvedCall: ResolvedCall<*>, actualName: String?) { - if (callName == null || callName != actualName) return - callFound = true + val resolvedCall = if (cachedCall !is VariableAsFunctionResolvedCall) cachedCall + else if ("(" == element?.getText()) cachedCall.functionCall + else cachedCall.variableCall - val resolvedCallInfoFileName = FileUtil.getNameWithoutExtension(filePath) + ".txt" - JetTestUtils.assertEqualsToFile(File(resolvedCallInfoFileName), "$text\n\n\n${resolvedCall.renderToText()}") - } - - for ((element, resolvedCall) in analyzeFileAndGetResolvedCallEntries()) { - if (resolvedCall is VariableAsFunctionResolvedCall) { - tryCall(resolvedCall.functionCall, "invoke") - tryCall(resolvedCall.variableCall, element.getText()) - } - else { - tryCall(resolvedCall, element.getText()) - } - } - assertTrue(callFound, "Resolved call for $callName was not found") + val resolvedCallInfoFileName = FileUtil.getNameWithoutExtension(filePath) + ".txt" + JetTestUtils.assertEqualsToFile(File(resolvedCallInfoFileName), "$text\n\n\n${resolvedCall.renderToText()}") } }