HL API: update resolve call tests

This commit is contained in:
Ilya Kirillov
2021-07-16 17:10:17 +02:00
committed by teamcityserver
parent 44812ae45a
commit d7f1353d3d
11 changed files with 34 additions and 12 deletions
@@ -1 +1,3 @@
KtFunctionCall: targetFunction = /function(a: kotlin.Int): kotlin.Unit
KtFunctionCall:
argumentMapping = { 1 -> (a: kotlin.Int) }
targetFunction = /function(a: kotlin.Int): kotlin.Unit
@@ -1 +1,3 @@
KtFunctionCall: targetFunction = /function(<receiver>: kotlin.String, a: kotlin.Int): kotlin.Unit
KtFunctionCall:
argumentMapping = { 1 -> (a: kotlin.Int) }
targetFunction = /function(<receiver>: kotlin.String, a: kotlin.Int): kotlin.Unit
@@ -1 +1,3 @@
KtFunctionCall: targetFunction = /function(<receiver>: kotlin.String, a: kotlin.Int): kotlin.Unit
KtFunctionCall:
argumentMapping = { 1 -> (a: kotlin.Int) }
targetFunction = /function(<receiver>: kotlin.String, a: kotlin.Int): kotlin.Unit
@@ -1 +1,3 @@
KtFunctionCall: targetFunction = <constructor>(): A
KtFunctionCall:
argumentMapping = { }
targetFunction = <constructor>(): A
@@ -1 +1,3 @@
KtFunctionCall: targetFunction = <constructor>(): A
KtFunctionCall:
argumentMapping = { }
targetFunction = <constructor>(): A
@@ -1 +1,3 @@
KtFunctionCall: targetFunction = /JavaClass.javaMethod(): kotlin.Unit
KtFunctionCall:
argumentMapping = { }
targetFunction = /JavaClass.javaMethod(): kotlin.Unit
@@ -1 +1,3 @@
KtFunctionCall: targetFunction = /to(<receiver>: A, other: B): A
KtFunctionCall:
argumentMapping = { }
targetFunction = /to(<receiver>: A, other: B): A
@@ -1 +1,3 @@
KtFunctionCall: targetFunction = ERR<Too many arguments for public final fun /foo(): R|kotlin/Unit|, [/foo(): kotlin.Unit]>
KtFunctionCall:
argumentMapping = { }
targetFunction = ERR<Too many arguments for public final fun /foo(): R|kotlin/Unit|, [/foo(): kotlin.Unit]>
@@ -1 +1,3 @@
KtFunctionalTypeVariableCall: target = x: kotlin.Function1<kotlin.Int, kotlin.String>, targetFunction = kotlin/Function1.invoke(p1: kotlin.Int): kotlin.String
KtFunctionalTypeVariableCall:
target = x: kotlin.Function1<kotlin.Int, kotlin.String>
targetFunction = kotlin/Function1.invoke(p1: kotlin.Int): kotlin.String
@@ -1 +1,3 @@
KtFunctionCall: targetFunction = /invoke(<receiver>: kotlin.Int): kotlin.String
KtFunctionCall:
argumentMapping = { }
targetFunction = /invoke(<receiver>: kotlin.Int): kotlin.String
@@ -69,15 +69,17 @@ private fun KtCall.stringRepresentation(): String {
is KtSuccessCallTarget -> symbol.stringValue()
is KtErrorCallTarget -> "ERR<${this.diagnostic.defaultMessage}, [${candidates.joinToString { it.stringValue() }}]>"
is Boolean -> toString()
is Map<*, *> -> entries.joinToString(prefix = "{ ", postfix = " }") { (k, v) -> "${k?.stringValue()} -> (${v?.stringValue()})" }
is KtValueArgument -> this.text
else -> error("unexpected parameter type ${this::class}")
}
val callInfoClass = this::class
return buildString {
append(callInfoClass.simpleName!!)
append(": ")
append(":\n")
val propertyByName = callInfoClass.memberProperties.associateBy(KProperty1<*, *>::name)
callInfoClass.primaryConstructor!!.parameters.joinTo(this) { parameter ->
callInfoClass.primaryConstructor!!.parameters.joinTo(this, separator = "\n") { parameter ->
val value = propertyByName[parameter.name]!!.javaGetter!!(this@stringRepresentation)?.stringValue()
"${parameter.name!!} = $value"
}