From 11ea241efb3349a0b7df4a2d9ee2fd13adeb58a3 Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Thu, 10 Jul 2014 16:33:50 +0400 Subject: [PATCH] Render candidate and resulting descriptors in resolved call tests --- .../functionLiterals/chainedLambdas.txt | 3 ++ .../notInferredLambdaReturnType.txt | 3 ++ .../notInferredLambdaType.txt | 3 ++ .../functionLiterals/simpleGenericLambda.txt | 3 ++ .../functionLiterals/simpleLambda.txt | 2 + .../functionLiterals/unmappedLambda.txt | 2 + .../genericCalls/inferredParameter.txt | 3 ++ .../arguments/genericCalls/simpleGeneric.txt | 3 ++ .../genericCalls/uninferredParameter.txt | 3 ++ .../uninferredParameterTypeMismatch.txt | 3 ++ .../namedArguments/positionedAfterNamed.txt | 2 + .../namedArguments/shiftedArgsMatch.txt | 2 + .../oneArgument/argumentHasNoType.txt | 2 + .../arguments/oneArgument/simpleMatch.txt | 2 + .../arguments/oneArgument/typeMismatch.txt | 2 + .../oneArgument/unmappedArgument.txt | 2 + .../arguments/realExamples/emptyList.txt | 3 ++ .../realExamples/emptyMutableList.txt | 3 ++ .../severalCandidates/mostSpecific.txt | 2 + .../explicitReceiverIsReceiverArgument.txt | 4 +- .../explicitReceiverIsThisObject.txt | 4 +- .../invokeForExtensionFunctionType.txt | 6 ++- .../functionTypes/invokeForFunctionType.txt | 4 +- .../valOfExtensionFunctionType.txt | 2 + .../valOfExtensionFunctionTypeInvoke.txt | 6 ++- .../functionTypes/valOfFunctionType.txt | 6 ++- .../functionTypes/valOfFunctionTypeInvoke.txt | 4 +- .../hasBothThisObjectAndReceiverArgument.txt | 6 ++- ...eceiverArgumentWithoutExplicitReceiver.txt | 6 ++- .../implicitReceiverIsReceiverArgument.txt | 4 +- .../implicitReceiverIsThisObject.txt | 4 +- .../impliedThisNoExplicitReceiver.txt | 2 + .../resolvedCalls/invoke/bothReceivers.txt | 6 ++- .../invoke/implicitReceiverForInvoke.txt | 6 ++- .../receiverArgumentAsReceiverForInvoke.txt | 4 +- .../invoke/thisObjectAsReceiverForInvoke.txt | 4 +- .../realExamples/stringPlusInBuilders.txt | 6 ++- .../testData/resolvedCalls/simpleCall.txt | 2 + .../resolvedCalls/this/labeledThis.txt | 2 + .../resolvedCalls/this/simpleThis.txt | 2 + .../this/thisInExtensionFunction.txt | 2 + .../calls/AbstractResolvedCallsTest.kt | 53 ++++++++++++------- .../jet/renderer/DescriptorRenderer.java | 6 +++ 43 files changed, 157 insertions(+), 42 deletions(-) diff --git a/compiler/testData/resolvedCalls/arguments/functionLiterals/chainedLambdas.txt b/compiler/testData/resolvedCalls/arguments/functionLiterals/chainedLambdas.txt index c1d52e51c88..27e44eef0da 100644 --- a/compiler/testData/resolvedCalls/arguments/functionLiterals/chainedLambdas.txt +++ b/compiler/testData/resolvedCalls/arguments/functionLiterals/chainedLambdas.txt @@ -8,6 +8,9 @@ fun test() { Resolved call: +Candidate descriptor: fun foo(t: T, f: (T) -> S, g: (S) -> R): Unit +Resulting descriptor: fun foo(t: Int, f: (Int) -> String, g: (String) -> Int): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER diff --git a/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaReturnType.txt b/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaReturnType.txt index 66ee4700e35..cf2012097ec 100644 --- a/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaReturnType.txt +++ b/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaReturnType.txt @@ -7,6 +7,9 @@ fun test() { Resolved call: +Candidate descriptor: fun foo(f: () -> T): Unit +Resulting descriptor: fun foo(f: () -> ???): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER diff --git a/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaType.txt b/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaType.txt index f39602a176d..27c0624d4ce 100644 --- a/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaType.txt +++ b/compiler/testData/resolvedCalls/arguments/functionLiterals/notInferredLambdaType.txt @@ -7,6 +7,9 @@ fun test() { Resolved call: +Candidate descriptor: fun foo(f: (T) -> String): Unit +Resulting descriptor: fun foo(f: (???) -> String): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER diff --git a/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleGenericLambda.txt b/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleGenericLambda.txt index ffefb4f1cbc..5b6ecebc1d6 100644 --- a/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleGenericLambda.txt +++ b/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleGenericLambda.txt @@ -7,6 +7,9 @@ fun test() { Resolved call: +Candidate descriptor: fun foo(f: (T) -> String): Unit +Resulting descriptor: fun foo(f: (Int) -> String): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER diff --git a/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleLambda.txt b/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleLambda.txt index 056c94a958b..c5fbe8a0e65 100644 --- a/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleLambda.txt +++ b/compiler/testData/resolvedCalls/arguments/functionLiterals/simpleLambda.txt @@ -7,6 +7,8 @@ fun test() { Resolved call: +Resulting descriptor: fun foo(f: (Int) -> String): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER diff --git a/compiler/testData/resolvedCalls/arguments/functionLiterals/unmappedLambda.txt b/compiler/testData/resolvedCalls/arguments/functionLiterals/unmappedLambda.txt index e60eb02cfb6..a4a66c9e292 100644 --- a/compiler/testData/resolvedCalls/arguments/functionLiterals/unmappedLambda.txt +++ b/compiler/testData/resolvedCalls/arguments/functionLiterals/unmappedLambda.txt @@ -7,6 +7,8 @@ fun test() { Resolved call: +Resulting descriptor: fun foo(): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER diff --git a/compiler/testData/resolvedCalls/arguments/genericCalls/inferredParameter.txt b/compiler/testData/resolvedCalls/arguments/genericCalls/inferredParameter.txt index b8ed8d73f5a..a91d580f90a 100644 --- a/compiler/testData/resolvedCalls/arguments/genericCalls/inferredParameter.txt +++ b/compiler/testData/resolvedCalls/arguments/genericCalls/inferredParameter.txt @@ -9,6 +9,9 @@ fun test(a: Any, ls: List) { Resolved call: +Candidate descriptor: fun foo(t: T, l: List): Unit +Resulting descriptor: fun foo(t: Comparable, l: List>): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER diff --git a/compiler/testData/resolvedCalls/arguments/genericCalls/simpleGeneric.txt b/compiler/testData/resolvedCalls/arguments/genericCalls/simpleGeneric.txt index b5c687db1b5..50e18eca011 100644 --- a/compiler/testData/resolvedCalls/arguments/genericCalls/simpleGeneric.txt +++ b/compiler/testData/resolvedCalls/arguments/genericCalls/simpleGeneric.txt @@ -9,6 +9,9 @@ fun bar() { Resolved call: +Candidate descriptor: fun foo(t: T): Unit +Resulting descriptor: fun foo(t: A): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER diff --git a/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameter.txt b/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameter.txt index a6c4e0ab52b..a461469e91a 100644 --- a/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameter.txt +++ b/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameter.txt @@ -9,6 +9,9 @@ fun test(ls: MutableList) { Resolved call: +Candidate descriptor: fun foo(t: T, l: MutableList): Unit +Resulting descriptor: fun foo(t: ???, l: MutableList): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER diff --git a/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameterTypeMismatch.txt b/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameterTypeMismatch.txt index 3f8f6545b8c..ddc1ba1e21e 100644 --- a/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameterTypeMismatch.txt +++ b/compiler/testData/resolvedCalls/arguments/genericCalls/uninferredParameterTypeMismatch.txt @@ -7,6 +7,9 @@ fun test() { Resolved call: +Candidate descriptor: fun foo(l: List): Unit +Resulting descriptor: fun foo(l: List): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER diff --git a/compiler/testData/resolvedCalls/arguments/namedArguments/positionedAfterNamed.txt b/compiler/testData/resolvedCalls/arguments/namedArguments/positionedAfterNamed.txt index 28b7ea1d382..12b54fa037e 100644 --- a/compiler/testData/resolvedCalls/arguments/namedArguments/positionedAfterNamed.txt +++ b/compiler/testData/resolvedCalls/arguments/namedArguments/positionedAfterNamed.txt @@ -10,6 +10,8 @@ fun bar() { Resolved call: +Resulting descriptor: fun foo(a: A, b: B): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER diff --git a/compiler/testData/resolvedCalls/arguments/namedArguments/shiftedArgsMatch.txt b/compiler/testData/resolvedCalls/arguments/namedArguments/shiftedArgsMatch.txt index 9382881aa69..520a3668970 100644 --- a/compiler/testData/resolvedCalls/arguments/namedArguments/shiftedArgsMatch.txt +++ b/compiler/testData/resolvedCalls/arguments/namedArguments/shiftedArgsMatch.txt @@ -10,6 +10,8 @@ fun bar() { Resolved call: +Resulting descriptor: fun foo(a: A, b: B): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER diff --git a/compiler/testData/resolvedCalls/arguments/oneArgument/argumentHasNoType.txt b/compiler/testData/resolvedCalls/arguments/oneArgument/argumentHasNoType.txt index f098fd4953d..7197b79d371 100644 --- a/compiler/testData/resolvedCalls/arguments/oneArgument/argumentHasNoType.txt +++ b/compiler/testData/resolvedCalls/arguments/oneArgument/argumentHasNoType.txt @@ -9,6 +9,8 @@ fun bar() { Resolved call: +Resulting descriptor: fun foo(a: A): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER diff --git a/compiler/testData/resolvedCalls/arguments/oneArgument/simpleMatch.txt b/compiler/testData/resolvedCalls/arguments/oneArgument/simpleMatch.txt index edc79a112ad..841740a940a 100644 --- a/compiler/testData/resolvedCalls/arguments/oneArgument/simpleMatch.txt +++ b/compiler/testData/resolvedCalls/arguments/oneArgument/simpleMatch.txt @@ -9,6 +9,8 @@ fun bar() { Resolved call: +Resulting descriptor: fun foo(a: A): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER diff --git a/compiler/testData/resolvedCalls/arguments/oneArgument/typeMismatch.txt b/compiler/testData/resolvedCalls/arguments/oneArgument/typeMismatch.txt index d2987216848..e488d69898c 100644 --- a/compiler/testData/resolvedCalls/arguments/oneArgument/typeMismatch.txt +++ b/compiler/testData/resolvedCalls/arguments/oneArgument/typeMismatch.txt @@ -9,6 +9,8 @@ fun bar() { Resolved call: +Resulting descriptor: fun foo(a: A): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER diff --git a/compiler/testData/resolvedCalls/arguments/oneArgument/unmappedArgument.txt b/compiler/testData/resolvedCalls/arguments/oneArgument/unmappedArgument.txt index e8953ac1f78..1630dfdabd4 100644 --- a/compiler/testData/resolvedCalls/arguments/oneArgument/unmappedArgument.txt +++ b/compiler/testData/resolvedCalls/arguments/oneArgument/unmappedArgument.txt @@ -7,6 +7,8 @@ fun bar() { Resolved call: +Resulting descriptor: fun foo(): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER diff --git a/compiler/testData/resolvedCalls/arguments/realExamples/emptyList.txt b/compiler/testData/resolvedCalls/arguments/realExamples/emptyList.txt index a363fcbd899..7dcfea9586b 100644 --- a/compiler/testData/resolvedCalls/arguments/realExamples/emptyList.txt +++ b/compiler/testData/resolvedCalls/arguments/realExamples/emptyList.txt @@ -11,6 +11,9 @@ fun bar() { Resolved call: +Candidate descriptor: fun foo(t: T): Unit +Resulting descriptor: fun foo(t: List): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER diff --git a/compiler/testData/resolvedCalls/arguments/realExamples/emptyMutableList.txt b/compiler/testData/resolvedCalls/arguments/realExamples/emptyMutableList.txt index f8823bf7896..11b074adb75 100644 --- a/compiler/testData/resolvedCalls/arguments/realExamples/emptyMutableList.txt +++ b/compiler/testData/resolvedCalls/arguments/realExamples/emptyMutableList.txt @@ -11,6 +11,9 @@ fun bar() { Resolved call: +Candidate descriptor: fun foo(t: T): Unit +Resulting descriptor: fun foo(t: MutableList): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER diff --git a/compiler/testData/resolvedCalls/arguments/severalCandidates/mostSpecific.txt b/compiler/testData/resolvedCalls/arguments/severalCandidates/mostSpecific.txt index 356700d9232..a57f201cf65 100644 --- a/compiler/testData/resolvedCalls/arguments/severalCandidates/mostSpecific.txt +++ b/compiler/testData/resolvedCalls/arguments/severalCandidates/mostSpecific.txt @@ -11,6 +11,8 @@ fun bar() { Resolved call: +Resulting descriptor: fun foo(a: A, s: String): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER diff --git a/compiler/testData/resolvedCalls/explicitReceiverIsReceiverArgument.txt b/compiler/testData/resolvedCalls/explicitReceiverIsReceiverArgument.txt index 04191d7f5f4..296c440beb7 100644 --- a/compiler/testData/resolvedCalls/explicitReceiverIsReceiverArgument.txt +++ b/compiler/testData/resolvedCalls/explicitReceiverIsReceiverArgument.txt @@ -9,6 +9,8 @@ fun bar(a: A) { Resolved call: +Resulting descriptor: fun A.foo(): Unit + Explicit receiver kind = RECEIVER_ARGUMENT This object = NO_RECEIVER -Receiver argument = a \ No newline at end of file +Receiver argument = a {A} diff --git a/compiler/testData/resolvedCalls/explicitReceiverIsThisObject.txt b/compiler/testData/resolvedCalls/explicitReceiverIsThisObject.txt index bd56ecc7a55..08c9ce0394b 100644 --- a/compiler/testData/resolvedCalls/explicitReceiverIsThisObject.txt +++ b/compiler/testData/resolvedCalls/explicitReceiverIsThisObject.txt @@ -9,6 +9,8 @@ fun bar(a: A) { Resolved call: +Resulting descriptor: fun foo(): Unit + Explicit receiver kind = THIS_OBJECT -This object = a +This object = a {A} Receiver argument = NO_RECEIVER \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/functionTypes/invokeForExtensionFunctionType.txt b/compiler/testData/resolvedCalls/functionTypes/invokeForExtensionFunctionType.txt index d5dc30baaaf..9e4efda1d7c 100644 --- a/compiler/testData/resolvedCalls/functionTypes/invokeForExtensionFunctionType.txt +++ b/compiler/testData/resolvedCalls/functionTypes/invokeForExtensionFunctionType.txt @@ -5,6 +5,8 @@ fun bar(f: Int.()->Unit) { Resolved call: +Resulting descriptor: fun Int.invoke(): Unit + Explicit receiver kind = BOTH_RECEIVERS -This object = f -Receiver argument = 1 \ No newline at end of file +This object = f {ExtensionFunction0} +Receiver argument = 1 {Int} diff --git a/compiler/testData/resolvedCalls/functionTypes/invokeForFunctionType.txt b/compiler/testData/resolvedCalls/functionTypes/invokeForFunctionType.txt index fba366e6d2c..0b39355eea3 100644 --- a/compiler/testData/resolvedCalls/functionTypes/invokeForFunctionType.txt +++ b/compiler/testData/resolvedCalls/functionTypes/invokeForFunctionType.txt @@ -5,6 +5,8 @@ fun bar(f: ()->Unit) { Resolved call: +Resulting descriptor: fun invoke(): Unit + Explicit receiver kind = THIS_OBJECT -This object = f +This object = f {Function0} Receiver argument = NO_RECEIVER \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionType.txt b/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionType.txt index 9dcebd6aee8..c7d065e06c6 100644 --- a/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionType.txt +++ b/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionType.txt @@ -9,6 +9,8 @@ trait A { Resolved call: +Resulting descriptor: val foo: Int.() -> Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = Class{A} Receiver argument = NO_RECEIVER \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionTypeInvoke.txt b/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionTypeInvoke.txt index d395cbff7db..d969989af64 100644 --- a/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionTypeInvoke.txt +++ b/compiler/testData/resolvedCalls/functionTypes/valOfExtensionFunctionTypeInvoke.txt @@ -9,6 +9,8 @@ trait A { Resolved call: +Resulting descriptor: fun Int.invoke(): Unit + Explicit receiver kind = BOTH_RECEIVERS -This object = foo -Receiver argument = 1 \ No newline at end of file +This object = foo {ExtensionFunction0} +Receiver argument = 1 {Int} diff --git a/compiler/testData/resolvedCalls/functionTypes/valOfFunctionType.txt b/compiler/testData/resolvedCalls/functionTypes/valOfFunctionType.txt index 43bac144301..357cf17cdcb 100644 --- a/compiler/testData/resolvedCalls/functionTypes/valOfFunctionType.txt +++ b/compiler/testData/resolvedCalls/functionTypes/valOfFunctionType.txt @@ -9,6 +9,8 @@ fun test(a: A) { Resolved call: +Resulting descriptor: val foo: (Int) -> Int + Explicit receiver kind = THIS_OBJECT -This object = a -Receiver argument = NO_RECEIVER +This object = a {A} +Receiver argument = NO_RECEIVER \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/functionTypes/valOfFunctionTypeInvoke.txt b/compiler/testData/resolvedCalls/functionTypes/valOfFunctionTypeInvoke.txt index 59b8a909d9c..93ef70e670e 100644 --- a/compiler/testData/resolvedCalls/functionTypes/valOfFunctionTypeInvoke.txt +++ b/compiler/testData/resolvedCalls/functionTypes/valOfFunctionTypeInvoke.txt @@ -9,8 +9,10 @@ fun test(a: A) { Resolved call: +Resulting descriptor: fun invoke(p1: Int): Int + Explicit receiver kind = THIS_OBJECT -This object = foo +This object = foo {Function1} Receiver argument = NO_RECEIVER Value arguments mapping: diff --git a/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgument.txt b/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgument.txt index 626d229bfc3..092d4a8dea5 100644 --- a/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgument.txt +++ b/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgument.txt @@ -15,6 +15,8 @@ fun with(receiver: T, f: T.() -> R) : R = receiver.f() Resolved call: +Resulting descriptor: fun B.foo(): Unit + Explicit receiver kind = RECEIVER_ARGUMENT -This object = A -Receiver argument = b \ No newline at end of file +This object = AExt{fun A.(): Unit} +Receiver argument = b {B} diff --git a/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgumentWithoutExplicitReceiver.txt b/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgumentWithoutExplicitReceiver.txt index f6cc189ec9e..ff394c9abbd 100644 --- a/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgumentWithoutExplicitReceiver.txt +++ b/compiler/testData/resolvedCalls/hasBothThisObjectAndReceiverArgumentWithoutExplicitReceiver.txt @@ -17,6 +17,8 @@ fun with(receiver: T, f: T.() -> R) : R = receiver.f() Resolved call: +Resulting descriptor: fun B.foo(): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER -This object = A -Receiver argument = B \ No newline at end of file +This object = AExt{fun A.(): Unit} +Receiver argument = BExt{fun B.(): Unit} diff --git a/compiler/testData/resolvedCalls/implicitReceiverIsReceiverArgument.txt b/compiler/testData/resolvedCalls/implicitReceiverIsReceiverArgument.txt index b726fb61621..cc006c3d88c 100644 --- a/compiler/testData/resolvedCalls/implicitReceiverIsReceiverArgument.txt +++ b/compiler/testData/resolvedCalls/implicitReceiverIsReceiverArgument.txt @@ -9,6 +9,8 @@ fun A.bar() { Resolved call: +Resulting descriptor: fun A.foo(): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER -Receiver argument = A \ No newline at end of file +Receiver argument = AExt{fun A.bar(): Unit} diff --git a/compiler/testData/resolvedCalls/implicitReceiverIsThisObject.txt b/compiler/testData/resolvedCalls/implicitReceiverIsThisObject.txt index 65f6e00a35d..17d0ede13d6 100644 --- a/compiler/testData/resolvedCalls/implicitReceiverIsThisObject.txt +++ b/compiler/testData/resolvedCalls/implicitReceiverIsThisObject.txt @@ -9,6 +9,8 @@ fun A.bar() { Resolved call: +Resulting descriptor: fun foo(): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER -This object = A +This object = AExt{fun A.bar(): Unit} Receiver argument = NO_RECEIVER \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/impliedThisNoExplicitReceiver.txt b/compiler/testData/resolvedCalls/impliedThisNoExplicitReceiver.txt index f15b9251fc9..0666596a0ee 100644 --- a/compiler/testData/resolvedCalls/impliedThisNoExplicitReceiver.txt +++ b/compiler/testData/resolvedCalls/impliedThisNoExplicitReceiver.txt @@ -8,6 +8,8 @@ class A { Resolved call: +Resulting descriptor: fun foo(): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = Class{A} Receiver argument = NO_RECEIVER \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/invoke/bothReceivers.txt b/compiler/testData/resolvedCalls/invoke/bothReceivers.txt index 75df4a02162..3caabfecdd9 100644 --- a/compiler/testData/resolvedCalls/invoke/bothReceivers.txt +++ b/compiler/testData/resolvedCalls/invoke/bothReceivers.txt @@ -9,6 +9,8 @@ fun bar(f: Foo) { Resolved call: +Resulting descriptor: fun Int.invoke(): Unit + Explicit receiver kind = BOTH_RECEIVERS -This object = f -Receiver argument = 1 \ No newline at end of file +This object = f {Foo} +Receiver argument = 1 {Int} diff --git a/compiler/testData/resolvedCalls/invoke/implicitReceiverForInvoke.txt b/compiler/testData/resolvedCalls/invoke/implicitReceiverForInvoke.txt index fbaae4479f6..0737d204702 100644 --- a/compiler/testData/resolvedCalls/invoke/implicitReceiverForInvoke.txt +++ b/compiler/testData/resolvedCalls/invoke/implicitReceiverForInvoke.txt @@ -13,6 +13,8 @@ fun with(receiver: T, f: T.() -> R) : R = throw Exception() Resolved call: +Resulting descriptor: fun Int.invoke(): Unit + Explicit receiver kind = THIS_OBJECT -This object = f -Receiver argument = Int \ No newline at end of file +This object = f {Foo} +Receiver argument = IntExt{fun Int.(): Unit} diff --git a/compiler/testData/resolvedCalls/invoke/receiverArgumentAsReceiverForInvoke.txt b/compiler/testData/resolvedCalls/invoke/receiverArgumentAsReceiverForInvoke.txt index f010934444b..1dec4465301 100644 --- a/compiler/testData/resolvedCalls/invoke/receiverArgumentAsReceiverForInvoke.txt +++ b/compiler/testData/resolvedCalls/invoke/receiverArgumentAsReceiverForInvoke.txt @@ -8,6 +8,8 @@ fun bar(f: Foo) { Resolved call: +Resulting descriptor: fun Foo.invoke(): Unit + Explicit receiver kind = RECEIVER_ARGUMENT This object = NO_RECEIVER -Receiver argument = f \ No newline at end of file +Receiver argument = f {Foo} diff --git a/compiler/testData/resolvedCalls/invoke/thisObjectAsReceiverForInvoke.txt b/compiler/testData/resolvedCalls/invoke/thisObjectAsReceiverForInvoke.txt index 0223ce4b121..e3548d9510e 100644 --- a/compiler/testData/resolvedCalls/invoke/thisObjectAsReceiverForInvoke.txt +++ b/compiler/testData/resolvedCalls/invoke/thisObjectAsReceiverForInvoke.txt @@ -9,6 +9,8 @@ fun bar(f: Foo) { Resolved call: +Resulting descriptor: fun invoke(): Unit + Explicit receiver kind = THIS_OBJECT -This object = f +This object = f {Foo} Receiver argument = NO_RECEIVER \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/realExamples/stringPlusInBuilders.txt b/compiler/testData/resolvedCalls/realExamples/stringPlusInBuilders.txt index f7335d10769..133db8cdacc 100644 --- a/compiler/testData/resolvedCalls/realExamples/stringPlusInBuilders.txt +++ b/compiler/testData/resolvedCalls/realExamples/stringPlusInBuilders.txt @@ -41,6 +41,8 @@ val fail: Nothing get() = throw Exception() Resolved call: +Resulting descriptor: fun String.plus(): Unit + Explicit receiver kind = RECEIVER_ARGUMENT -This object = Title -Receiver argument = "Foo" \ No newline at end of file +This object = TitleExt{fun Title.(): Unit} +Receiver argument = "Foo" {String} diff --git a/compiler/testData/resolvedCalls/simpleCall.txt b/compiler/testData/resolvedCalls/simpleCall.txt index e76342b732b..da7efadbaf9 100644 --- a/compiler/testData/resolvedCalls/simpleCall.txt +++ b/compiler/testData/resolvedCalls/simpleCall.txt @@ -7,6 +7,8 @@ fun bar() { Resolved call: +Resulting descriptor: fun foo(): Unit + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/this/labeledThis.txt b/compiler/testData/resolvedCalls/this/labeledThis.txt index 3c20ad1969b..6259f4be2bd 100644 --- a/compiler/testData/resolvedCalls/this/labeledThis.txt +++ b/compiler/testData/resolvedCalls/this/labeledThis.txt @@ -7,6 +7,8 @@ class A { Resolved call: +Resulting descriptor: Class{A}::this + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/this/simpleThis.txt b/compiler/testData/resolvedCalls/this/simpleThis.txt index cd252fb10a9..6985f488820 100644 --- a/compiler/testData/resolvedCalls/this/simpleThis.txt +++ b/compiler/testData/resolvedCalls/this/simpleThis.txt @@ -7,6 +7,8 @@ class A { Resolved call: +Resulting descriptor: Class{A}::this + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER \ No newline at end of file diff --git a/compiler/testData/resolvedCalls/this/thisInExtensionFunction.txt b/compiler/testData/resolvedCalls/this/thisInExtensionFunction.txt index e5aba9428b4..f40d6b1b943 100644 --- a/compiler/testData/resolvedCalls/this/thisInExtensionFunction.txt +++ b/compiler/testData/resolvedCalls/this/thisInExtensionFunction.txt @@ -7,6 +7,8 @@ fun A.bar() = this.foo() Resolved call: +Resulting descriptor: AExt{fun A.bar(): Unit}::this + Explicit receiver kind = NO_EXPLICIT_RECEIVER This object = NO_RECEIVER Receiver argument = NO_RECEIVER \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/resolve/calls/AbstractResolvedCallsTest.kt b/compiler/tests/org/jetbrains/jet/resolve/calls/AbstractResolvedCallsTest.kt index 1cdd77fb1b1..c1eeff7aafb 100644 --- a/compiler/tests/org/jetbrains/jet/resolve/calls/AbstractResolvedCallsTest.kt +++ b/compiler/tests/org/jetbrains/jet/resolve/calls/AbstractResolvedCallsTest.kt @@ -21,7 +21,6 @@ import org.jetbrains.jet.JetLiteFixture import org.jetbrains.jet.JetTestUtils import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall -import org.jetbrains.jet.lang.resolve.scopes.receivers.AbstractReceiverValue import org.jetbrains.jet.lang.resolve.scopes.receivers.ExpressionReceiver import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue @@ -38,6 +37,10 @@ import org.jetbrains.jet.lang.psi.JetExpression import com.intellij.psi.util.PsiTreeUtil import org.jetbrains.jet.lang.resolve.calls.model.VariableAsFunctionResolvedCall import org.jetbrains.jet.lang.resolve.bindingContextUtil.getParentResolvedCall +import org.jetbrains.jet.lang.descriptors.ReceiverParameterDescriptor +import org.jetbrains.jet.lang.resolve.scopes.receivers.ExtensionReceiver +import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor +import org.jetbrains.jet.lang.resolve.scopes.receivers.ClassReceiver public abstract class AbstractResolvedCallsTest() : JetLiteFixture() { override fun createEnvironment(): JetCoreEnvironment = createEnvironmentWithMockJdk(ConfigurationKind.JDK_ONLY) @@ -63,8 +66,9 @@ public abstract class AbstractResolvedCallsTest() : JetLiteFixture() { } private fun ReceiverValue.getText() = when (this) { - is ExpressionReceiver -> getExpression().getText() - is AbstractReceiverValue -> getType().toString() + is ExpressionReceiver -> "${getExpression().getText()} {${getType()}}" + is ClassReceiver -> "Class{${getType()}}" + is ExtensionReceiver -> "${getType()}Ext{${getDeclarationDescriptor().getText()}}" else -> toString() } @@ -78,25 +82,38 @@ private fun ArgumentMapping.getText() = when (this) { else -> "ARGUMENT UNMAPPED: " } +private fun DeclarationDescriptor.getText(): String = when (this) { + is ReceiverParameterDescriptor -> "${getValue().getText()}::this" + else -> DescriptorRenderer.COMPACT_WITH_SHORT_TYPES.render(this) +} + private fun ResolvedCall<*>.renderToText(): String { - val result = StringBuilder() - fun addLine(line: String) = result.append(line).append("\n") + return StringBuilder { + appendln("Resolved call:") + appendln() - addLine("Resolved call:\n") - addLine("Explicit receiver kind = ${getExplicitReceiverKind()}") - addLine("This object = ${getThisObject().getText()}") - addLine("Receiver argument = ${getReceiverArgument().getText()}") + if (getCandidateDescriptor() != getResultingDescriptor()) { + appendln("Candidate descriptor: ${getCandidateDescriptor()!!.getText()}") + } + appendln("Resulting descriptor: ${getResultingDescriptor()!!.getText()}") + appendln() - val valueArguments = getCall().getAllValueArguments() - if (valueArguments.isEmpty()) return result.toString() + appendln("Explicit receiver kind = ${getExplicitReceiverKind()}") + appendln("This object = ${getThisObject().getText()}") + appendln("Receiver argument = ${getReceiverArgument().getText()}") - addLine("\nValue arguments mapping:\n") + val valueArguments = getCall().getAllValueArguments() + if (!valueArguments.isEmpty()) { + appendln() + appendln("Value arguments mapping:") + appendln() - for (valueArgument in valueArguments) { - val argumentText = valueArgument.getText() - val argumentMappingText = getArgumentMapping(valueArgument).getText() + for (valueArgument in valueArguments) { + val argumentText = valueArgument.getText() + val argumentMappingText = getArgumentMapping(valueArgument).getText() - addLine("$argumentMappingText $argumentText") - } - return result.toString() + appendln("$argumentMappingText $argumentText") + } + } + }.toString() } \ No newline at end of file diff --git a/core/descriptors/src/org/jetbrains/jet/renderer/DescriptorRenderer.java b/core/descriptors/src/org/jetbrains/jet/renderer/DescriptorRenderer.java index 8553b8e7153..b1947acacfb 100644 --- a/core/descriptors/src/org/jetbrains/jet/renderer/DescriptorRenderer.java +++ b/core/descriptors/src/org/jetbrains/jet/renderer/DescriptorRenderer.java @@ -49,6 +49,12 @@ public interface DescriptorRenderer extends Renderer { .setWithDefinedIn(false) .setModifiers().build(); + DescriptorRenderer COMPACT_WITH_SHORT_TYPES = new DescriptorRendererBuilder() + .setWithDefinedIn(false) + .setModifiers() + .setShortNames(true) + .setIncludeSynthesizedParameterNames(false).build(); + DescriptorRenderer STARTS_FROM_NAME = new DescriptorRendererBuilder() .setWithDefinedIn(false) .setModifiers()