Analysis API: Handle other FirElements in

KtCallResolver.resolveCandidates() and copy over remaining tests.
This commit is contained in:
Mark Punzalan
2022-01-31 17:58:37 +00:00
committed by Ilya Kirillov
parent 9b9da94a09
commit 58c6c25fe9
107 changed files with 1736 additions and 38 deletions
@@ -0,0 +1,6 @@
@Deprecated("", level=DeprecationLevel.HIDDEN)
fun a() {}
fun test() {
<expr>a()</expr>
}
@@ -0,0 +1,5 @@
class A
fun test(a: A, b: A) {
<expr>a ?: b</expr>
}
@@ -0,0 +1,5 @@
class A
fun test(a: A, b: A) {
a <expr>?:</expr> b
}
@@ -0,0 +1,5 @@
class A
fun test(a: A, b: A) {
<expr>a === b</expr>
}
@@ -0,0 +1,5 @@
class A
fun test(a: A, b: A) {
a <expr>===</expr> b
}
@@ -0,0 +1,5 @@
class A
fun test(a: A, b: A) {
<expr>a !== b</expr>
}
@@ -0,0 +1,5 @@
class A
fun test(a: A, b: A) {
a <expr>!==</expr> b
}
@@ -0,0 +1,4 @@
annotation class RequiresPermission(val anyOf: IntArray)
@RequiresPermission(anyOf = <expr>arrayOf(1, 2, 3)</expr>)
fun foo(): Int = 5
@@ -0,0 +1,34 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Array<kotlin.Int>
symbol = kotlin/arrayOf(vararg elements: T): kotlin.Array<T>
valueParameters = [
KtVariableLikeSignature:
name = elements
receiverType = null
returnType = kotlin.Int
symbol = vararg elements: T
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
name = elements
receiverType = null
returnType = kotlin.Int
symbol = vararg elements: T),
2 -> (KtVariableLikeSignature:
name = elements
receiverType = null
returnType = kotlin.Int
symbol = vararg elements: T),
3 -> (KtVariableLikeSignature:
name = elements
receiverType = null
returnType = kotlin.Int
symbol = vararg elements: T)
}
@@ -0,0 +1,14 @@
// WITH_STDLIB
package test
class Target<T> {
fun add(t: T) {}
}
fun <T> buildTarget(@BuilderInference block: Target<T>.() -> Unit): Target<T> {
return Target<T>().apply { block() }
}
fun test(s: String) {
val result = buildTarget { <expr>add</expr>(s) }
}
@@ -0,0 +1,27 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtImplicitReceiverValue:
symbol = KtReceiverParameterSymbol:
origin: SOURCE
type: test/Target<kotlin/String>
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = test/Target.add(<dispatch receiver>: test.Target<T>, t: T): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
name = t
receiverType = null
returnType = T
symbol = t: T
]
argumentMapping = {
s -> (KtVariableLikeSignature:
name = t
receiverType = null
returnType = T
symbol = t: T)
}
@@ -0,0 +1,3 @@
fun test(a: Any?) {
<expr>a!!</expr>
}
@@ -0,0 +1,3 @@
KtSuccessCallInfo:
call = KtCheckNotNullCall:
baseExpression = a
@@ -0,0 +1,3 @@
fun test(a: (() -> Unit)?) {
<expr>a!!</expr>()
}
@@ -0,0 +1,3 @@
KtSuccessCallInfo:
call = KtCheckNotNullCall:
baseExpression = a
@@ -0,0 +1,3 @@
fun test(i: Int, j: Int) {
<expr>i < j</expr>
}
@@ -0,0 +1,26 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = i
isSafeNavigation = false
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Int
symbol = kotlin/Int.compareTo(<dispatch receiver>: kotlin.Int, other: kotlin.Int): kotlin.Int
valueParameters = [
KtVariableLikeSignature:
name = other
receiverType = null
returnType = kotlin.Int
symbol = other: kotlin.Int
]
argumentMapping = {
j -> (KtVariableLikeSignature:
name = other
receiverType = null
returnType = kotlin.Int
symbol = other: kotlin.Int)
}
@@ -47,4 +47,4 @@ KtErrorCallInfo:
valueParameters = []
argumentMapping = {}
]
diagnostic = ERROR<UNRESOLVED_REFERENCE_WRONG_RECEIVER: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: [/invoke]>
diagnostic = ERROR<UNRESOLVED_REFERENCE_WRONG_RECEIVER: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: [/invoke]>
@@ -47,4 +47,4 @@ KtErrorCallInfo:
valueParameters = []
argumentMapping = {}
]
diagnostic = ERROR<UNRESOLVED_REFERENCE_WRONG_RECEIVER: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: [/invoke]>
diagnostic = ERROR<UNRESOLVED_REFERENCE_WRONG_RECEIVER: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: [/invoke]>
@@ -47,4 +47,4 @@ KtSuccessCallInfo:
returnType = kotlin.Unit
symbol = /invoke(<extension receiver>: kotlin.Double): kotlin.Unit
valueParameters = []
argumentMapping = {}
argumentMapping = {}
@@ -0,0 +1,5 @@
class B
fun test(b1: B, b2: B) {
<expr>b1 == b2</expr>
}
@@ -0,0 +1,26 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = b1
isSafeNavigation = false
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Boolean
symbol = kotlin/Any.equals(<dispatch receiver>: kotlin.Any, other: kotlin.Any?): kotlin.Boolean
valueParameters = [
KtVariableLikeSignature:
name = other
receiverType = null
returnType = kotlin.Any?
symbol = other: kotlin.Any?
]
argumentMapping = {
b2 -> (KtVariableLikeSignature:
name = other
receiverType = null
returnType = kotlin.Any?
symbol = other: kotlin.Any?)
}
@@ -0,0 +1,11 @@
open class A {
override fun equals(other: Any?): Boolean {
return true
}
}
class B : A()
fun test(b1: B, b2: B) {
<expr>b1 == b2</expr>
}
@@ -0,0 +1,26 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = b1
isSafeNavigation = false
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Boolean
symbol = /A.equals(<dispatch receiver>: A, other: kotlin.Any?): kotlin.Boolean
valueParameters = [
KtVariableLikeSignature:
name = other
receiverType = null
returnType = kotlin.Any?
symbol = other: kotlin.Any?
]
argumentMapping = {
b2 -> (KtVariableLikeSignature:
name = other
receiverType = null
returnType = kotlin.Any?
symbol = other: kotlin.Any?)
}
@@ -0,0 +1,9 @@
open class A {
override fun equals(other: Any?): Boolean {
return true
}
}
fun test(a1: A, a2: A) {
<expr>a1 == a2</expr>
}
@@ -0,0 +1,26 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = a1
isSafeNavigation = false
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Boolean
symbol = /A.equals(<dispatch receiver>: A, other: kotlin.Any?): kotlin.Boolean
valueParameters = [
KtVariableLikeSignature:
name = other
receiverType = null
returnType = kotlin.Any?
symbol = other: kotlin.Any?
]
argumentMapping = {
a2 -> (KtVariableLikeSignature:
name = other
receiverType = null
returnType = kotlin.Any?
symbol = other: kotlin.Any?)
}
@@ -0,0 +1,5 @@
fun <A, B> A.function(a: B) {}
fun call() {
"str".<expr>function(1)</expr>
}
@@ -0,0 +1,26 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = KtExplicitReceiverValue:
expression = "str"
isSafeNavigation = false
signature = KtFunctionLikeSignature:
receiverType = kotlin.String
returnType = kotlin.Unit
symbol = /function(<extension receiver>: A, a: B): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = a: B
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = a: B)
}
@@ -0,0 +1,5 @@
fun function(a: Int, b: (String) -> Boolean) {}
fun call() {
<expr>function(1) { s -> true }</expr>
}
@@ -0,0 +1,34 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /function(a: kotlin.Int, b: kotlin.Function1<kotlin.String, kotlin.Boolean>): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = a: kotlin.Int,
KtVariableLikeSignature:
name = b
receiverType = null
returnType = kotlin.Function1<kotlin.String, kotlin.Boolean>
symbol = b: kotlin.Function1<kotlin.String, kotlin.Boolean>
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = a: kotlin.Int),
{ s -> true } -> (KtVariableLikeSignature:
name = b
receiverType = null
returnType = kotlin.Function1<kotlin.String, kotlin.Boolean>
symbol = b: kotlin.Function1<kotlin.String, kotlin.Boolean>)
}
@@ -1,5 +1,5 @@
fun function(a: Int, b: String) {}
fun call() {
<expr>function(1)</expr>
<expr>function(b = "foo", a = 1)</expr>
}
@@ -0,0 +1,34 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /function(a: kotlin.Int, b: kotlin.String): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = a: kotlin.Int,
KtVariableLikeSignature:
name = b
receiverType = null
returnType = kotlin.String
symbol = b: kotlin.String
]
argumentMapping = {
"foo" -> (KtVariableLikeSignature:
name = b
receiverType = null
returnType = kotlin.String
symbol = b: kotlin.String),
1 -> (KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = a: kotlin.Int)
}
@@ -0,0 +1,5 @@
fun function(a: Int, b: (String) -> Boolean) {}
fun call() {
<expr>function(1, { s -> true })</expr>
}
@@ -0,0 +1,34 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /function(a: kotlin.Int, b: kotlin.Function1<kotlin.String, kotlin.Boolean>): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = a: kotlin.Int,
KtVariableLikeSignature:
name = b
receiverType = null
returnType = kotlin.Function1<kotlin.String, kotlin.Boolean>
symbol = b: kotlin.Function1<kotlin.String, kotlin.Boolean>
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = a: kotlin.Int),
{ s -> true } -> (KtVariableLikeSignature:
name = b
receiverType = null
returnType = kotlin.Function1<kotlin.String, kotlin.Boolean>
symbol = b: kotlin.Function1<kotlin.String, kotlin.Boolean>)
}
@@ -0,0 +1,6 @@
fun function(vararg a: Int) {}
fun call() {
val args = intArrayOf(1, 2, 3)
<expr>function(*args)</expr>
}
@@ -0,0 +1,24 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /function(vararg a: kotlin.Int): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = vararg a: kotlin.Int
]
argumentMapping = {
args -> (KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = vararg a: kotlin.Int)
}
@@ -0,0 +1,5 @@
fun <A, B> function(a: A, b: B) {}
fun call() {
<expr>function(1, "")</expr>
}
@@ -0,0 +1,34 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /function(a: A, b: B): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = a: A,
KtVariableLikeSignature:
name = b
receiverType = null
returnType = kotlin.String
symbol = b: B
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = a: A),
"" -> (KtVariableLikeSignature:
name = b
receiverType = null
returnType = kotlin.String
symbol = b: B)
}
@@ -0,0 +1,5 @@
fun function(vararg a: Int) {}
fun call() {
<expr>function(1, 2, 3)</expr>
}
@@ -0,0 +1,34 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /function(vararg a: kotlin.Int): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = vararg a: kotlin.Int
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = vararg a: kotlin.Int),
2 -> (KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = vararg a: kotlin.Int),
3 -> (KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = vararg a: kotlin.Int)
}
@@ -0,0 +1,6 @@
class A {
val f: String.() -> Unit = {}
fun test() {
"".<expr>f()</expr>
}
}
@@ -0,0 +1,22 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = true
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = f
isSafeNavigation = false
extensionReceiver = KtExplicitReceiverValue:
expression = ""
isSafeNavigation = false
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = kotlin/Function1.invoke(<dispatch receiver>: kotlin.Function1<P1, R>, p1: P1): R
valueParameters = [
KtVariableLikeSignature:
name = p1
receiverType = null
returnType = kotlin.String
symbol = p1: P1
]
argumentMapping = {}
@@ -0,0 +1,7 @@
class A {
fun test() {
"".<expr>f()</expr>
}
}
val A.f: String.() -> Unit = {}
@@ -0,0 +1,22 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = true
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = f
isSafeNavigation = false
extensionReceiver = KtExplicitReceiverValue:
expression = ""
isSafeNavigation = false
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = kotlin/Function1.invoke(<dispatch receiver>: kotlin.Function1<P1, R>, p1: P1): R
valueParameters = [
KtVariableLikeSignature:
name = p1
receiverType = null
returnType = kotlin.String
symbol = p1: P1
]
argumentMapping = {}
@@ -0,0 +1,5 @@
fun String.function(a: Int) {}
fun call() {
"str".<expr>function(1)</expr>
}
@@ -0,0 +1,26 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = KtExplicitReceiverValue:
expression = "str"
isSafeNavigation = false
signature = KtFunctionLikeSignature:
receiverType = kotlin.String
returnType = kotlin.Unit
symbol = /function(<extension receiver>: kotlin.String, a: kotlin.Int): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = a: kotlin.Int
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = a: kotlin.Int)
}
@@ -0,0 +1,5 @@
fun String.function(a: Int) {}
fun call() {
"str"?.<expr>function(1)</expr>
}
@@ -0,0 +1,26 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = KtExplicitReceiverValue:
expression = "str"
isSafeNavigation = true
signature = KtFunctionLikeSignature:
receiverType = kotlin.String
returnType = kotlin.Unit
symbol = /function(<extension receiver>: kotlin.String, a: kotlin.Int): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = a: kotlin.Int
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = a: kotlin.Int)
}
@@ -0,0 +1,5 @@
fun test() {
<expr>Obj(555)</expr>
}
object Obj
@@ -0,0 +1,15 @@
KtErrorCallInfo:
candidateCalls = [
KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = Obj
symbol = <constructor>(): Obj
valueParameters = []
argumentMapping = {}
]
diagnostic = ERROR<INVISIBLE_REFERENCE: Symbol /Obj.Obj is invisible>
@@ -0,0 +1,7 @@
class A {
constructor(i: Int)
}
fun call() {
val a = <expr>A(42)</expr>
}
@@ -0,0 +1,24 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = A
symbol = <constructor>(i: kotlin.Int): A
valueParameters = [
KtVariableLikeSignature:
name = i
receiverType = null
returnType = kotlin.Int
symbol = i: kotlin.Int
]
argumentMapping = {
42 -> (KtVariableLikeSignature:
name = i
receiverType = null
returnType = kotlin.Int
symbol = i: kotlin.Int)
}
@@ -0,0 +1,5 @@
class A
fun call() {
val a = <expr>A()</expr>
}
@@ -0,0 +1,12 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = A
symbol = <constructor>(): A
valueParameters = []
argumentMapping = {}
@@ -0,0 +1,7 @@
// FILE: call.kt
fun call() {
val a = <expr>A()</expr>
}
// FILE: A.java
class A {}
@@ -0,0 +1,12 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = A
symbol = <constructor>(): A
valueParameters = []
argumentMapping = {}
@@ -0,0 +1,7 @@
class C {
operator fun get(a: Int, b: String): Boolean = true
}
fun call(c: C) {
val res = <expr>c[1, "foo", false]</expr>
}
@@ -3,12 +3,14 @@ KtErrorCallInfo:
KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
dispatchReceiver = KtExplicitReceiverValue:
expression = c
isSafeNavigation = false
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /function(a: kotlin.Int, b: kotlin.String): kotlin.Unit
returnType = kotlin.Boolean
symbol = /C.get(<dispatch receiver>: C, a: kotlin.Int, b: kotlin.String): kotlin.Boolean
valueParameters = [
KtVariableLikeSignature:
name = a
@@ -26,7 +28,12 @@ KtErrorCallInfo:
name = a
receiverType = null
returnType = kotlin.Int
symbol = a: kotlin.Int)
symbol = a: kotlin.Int),
"foo" -> (KtVariableLikeSignature:
name = b
receiverType = null
returnType = kotlin.String
symbol = b: kotlin.String)
}
]
diagnostic = ERROR<NO_VALUE_FOR_PARAMETER: No value passed for parameter 'b'>
diagnostic = ERROR<TOO_MANY_ARGUMENTS: Too many arguments for public final operator fun /C.get(a: R|kotlin/Int|, b: R|kotlin/String|): R|kotlin/Boolean|>
@@ -0,0 +1,7 @@
class C {
operator fun set(a: Int, b: String, value: Boolean) {}
}
fun call(c: C) {
<expr>c[1, "foo", 3.14]</expr> = false
}
@@ -0,0 +1,49 @@
KtErrorCallInfo:
candidateCalls = [
KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = c
isSafeNavigation = false
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /C.set(<dispatch receiver>: C, a: kotlin.Int, b: kotlin.String, value: kotlin.Boolean): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = a: kotlin.Int,
KtVariableLikeSignature:
name = b
receiverType = null
returnType = kotlin.String
symbol = b: kotlin.String,
KtVariableLikeSignature:
name = value
receiverType = null
returnType = kotlin.Boolean
symbol = value: kotlin.Boolean
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
name = a
receiverType = null
returnType = kotlin.Int
symbol = a: kotlin.Int),
"foo" -> (KtVariableLikeSignature:
name = b
receiverType = null
returnType = kotlin.String
symbol = b: kotlin.String),
false -> (KtVariableLikeSignature:
name = value
receiverType = null
returnType = kotlin.Boolean
symbol = value: kotlin.Boolean)
}
]
diagnostic = ERROR<TOO_MANY_ARGUMENTS: Too many arguments for public final operator fun /C.set(a: R|kotlin/Int|, b: R|kotlin/String|, value: R|kotlin/Boolean|): R|kotlin/Unit|>
@@ -0,0 +1,4 @@
annotation class RequiresPermission(val anyOf: IntArray)
@RequiresPermission(anyOf = <expr>intArrayOf(1, 2, 3)</expr>)
fun foo(): Int = 5
@@ -0,0 +1,34 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.IntArray
symbol = kotlin/intArrayOf(vararg elements: kotlin.Int): kotlin.IntArray
valueParameters = [
KtVariableLikeSignature:
name = elements
receiverType = null
returnType = kotlin.Int
symbol = vararg elements: kotlin.Int
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
name = elements
receiverType = null
returnType = kotlin.Int
symbol = vararg elements: kotlin.Int),
2 -> (KtVariableLikeSignature:
name = elements
receiverType = null
returnType = kotlin.Int
symbol = vararg elements: kotlin.Int),
3 -> (KtVariableLikeSignature:
name = elements
receiverType = null
returnType = kotlin.Int
symbol = vararg elements: kotlin.Int)
}
@@ -0,0 +1,10 @@
// FILE: call.kt
fun call() {
val javaClass = JavaClass()
javaClass.<expr>javaMethod()</expr>
}
// FILE: JavaClass.java
class JavaClass {
void javaMethod() {}
}
@@ -0,0 +1,14 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = javaClass
isSafeNavigation = false
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /JavaClass.javaMethod(<dispatch receiver>: JavaClass): kotlin.Unit
valueParameters = []
argumentMapping = {}
@@ -0,0 +1,7 @@
interface A<T> {
fun <R> foo(r: R)
}
fun call(a: A<String>) {
a.<expr>foo(1)</expr>
}
@@ -0,0 +1,26 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = a
isSafeNavigation = false
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /A.foo(<dispatch receiver>: A<T>, r: R): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
name = r
receiverType = null
returnType = kotlin.Int
symbol = r: R
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
name = r
receiverType = null
returnType = kotlin.Int
symbol = r: R)
}
@@ -0,0 +1,7 @@
class A {
private fun foo() {}
}
fun test(a: A) {
<expr>a.foo()</expr>
}
@@ -0,0 +1,17 @@
KtErrorCallInfo:
candidateCalls = [
KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = a
isSafeNavigation = false
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /A.foo(<dispatch receiver>: A): kotlin.Unit
valueParameters = []
argumentMapping = {}
]
diagnostic = ERROR<INVISIBLE_REFERENCE: Symbol /A.foo is invisible>
@@ -0,0 +1,5 @@
infix fun <A, B> A.to(other: B) = this
open class A<T>(x: T)
class B : A(<expr>1 to 2</expr>)
@@ -0,0 +1,26 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = KtExplicitReceiverValue:
expression = 1
isSafeNavigation = false
signature = KtFunctionLikeSignature:
receiverType = kotlin.Int
returnType = kotlin.Int
symbol = /to(<extension receiver>: A, other: B): A
valueParameters = [
KtVariableLikeSignature:
name = other
receiverType = null
returnType = kotlin.Int
symbol = other: B
]
argumentMapping = {
2 -> (KtVariableLikeSignature:
name = other
receiverType = null
returnType = kotlin.Int
symbol = other: B)
}
@@ -0,0 +1,5 @@
fun x() {
<expr>foo(1)</expr>
}
fun foo(){}
@@ -0,0 +1,15 @@
KtErrorCallInfo:
candidateCalls = [
KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /foo(): kotlin.Unit
valueParameters = []
argumentMapping = {}
]
diagnostic = ERROR<TOO_MANY_ARGUMENTS: Too many arguments for public final fun /foo(): R|kotlin/Unit|>
@@ -0,0 +1,7 @@
fun test(a: Any) {
if (a is String) {
a.<expr>foo()</expr>
}
}
fun String.foo() {}
@@ -0,0 +1,16 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = KtSmartCastedReceiverValue:
original = KtExplicitReceiverValue:
expression = a
isSafeNavigation = false
smartCastType = kotlin.String
signature = KtFunctionLikeSignature:
receiverType = kotlin.String
returnType = kotlin.Unit
symbol = /foo(<extension receiver>: kotlin.String): kotlin.Unit
valueParameters = []
argumentMapping = {}
@@ -0,0 +1,3 @@
fun call(x: (a: Int, b: String) -> Unit) {
<expr>x(1, "")</expr>
}
@@ -0,0 +1,36 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = true
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = x
isSafeNavigation = false
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = kotlin/Function2.invoke(<dispatch receiver>: kotlin.Function2<P1, P2, R>, p1: P1, p2: P2): R
valueParameters = [
KtVariableLikeSignature:
name = a
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(a)) kotlin.Int
symbol = p1: P1,
KtVariableLikeSignature:
name = b
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(b)) kotlin.String
symbol = p2: P2
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
name = a
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(a)) kotlin.Int
symbol = p1: P1),
"" -> (KtVariableLikeSignature:
name = b
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(b)) kotlin.String
symbol = p2: P2)
}
@@ -0,0 +1,3 @@
fun call(x: Function2<@ParameterName("a") Int, @ParameterName("b") String, Unit>) {
<expr>x(1, "")</expr>
}
@@ -0,0 +1,36 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = true
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = x
isSafeNavigation = false
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = kotlin/Function2.invoke(<dispatch receiver>: kotlin.Function2<P1, P2, R>, p1: P1, p2: P2): R
valueParameters = [
KtVariableLikeSignature:
name = a
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(a)) kotlin.Int
symbol = p1: P1,
KtVariableLikeSignature:
name = b
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(b)) kotlin.String
symbol = p2: P2
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
name = a
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(a)) kotlin.Int
symbol = p1: P1),
"" -> (KtVariableLikeSignature:
name = b
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(b)) kotlin.String
symbol = p2: P2)
}
@@ -0,0 +1,4 @@
// @ParameterName annotation takes precedence over name in function type parameter
fun call(x: (notMe: @ParameterName("a") Int, meNeither: @ParameterName("b") String) -> Unit) {
<expr>x(1, "")</expr>
}
@@ -0,0 +1,36 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = true
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = x
isSafeNavigation = false
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = kotlin/Function2.invoke(<dispatch receiver>: kotlin.Function2<P1, P2, R>, p1: P1, p2: P2): R
valueParameters = [
KtVariableLikeSignature:
name = a
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(a)) kotlin.Int
symbol = p1: P1,
KtVariableLikeSignature:
name = b
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(b)) kotlin.String
symbol = p2: P2
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
name = a
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(a)) kotlin.Int
symbol = p1: P1),
"" -> (KtVariableLikeSignature:
name = b
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(b)) kotlin.String
symbol = p2: P2)
}
@@ -0,0 +1,6 @@
fun <T> T.foo(): (a: T) -> Unit = TODO()
fun call() {
val x = 123.foo()
<expr>x(1)</expr>
}
@@ -0,0 +1,26 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = true
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = x
isSafeNavigation = false
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = kotlin/Function1.invoke(<dispatch receiver>: kotlin.Function1<P1, R>, p1: P1): R
valueParameters = [
KtVariableLikeSignature:
name = a
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(a)) kotlin.Int
symbol = p1: P1
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
name = a
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(a)) kotlin.Int
symbol = p1: P1)
}
@@ -0,0 +1,4 @@
// @ParameterName annotation is ignored when not used in function type
fun call(a: @ParameterName("notMe") Int, b: @ParameterName("meNeither") String) {
<expr>call(1, "")</expr>
}
@@ -0,0 +1,34 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = /call(a: @R|kotlin.ParameterName|(name = String(notMe)) kotlin.Int, b: @R|kotlin.ParameterName|(name = String(meNeither)) kotlin.String): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
name = a
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(notMe)) kotlin.Int
symbol = a: @R|kotlin.ParameterName|(name = String(notMe)) kotlin.Int,
KtVariableLikeSignature:
name = b
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(meNeither)) kotlin.String
symbol = b: @R|kotlin.ParameterName|(name = String(meNeither)) kotlin.String
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
name = a
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(notMe)) kotlin.Int
symbol = a: @R|kotlin.ParameterName|(name = String(notMe)) kotlin.Int),
"" -> (KtVariableLikeSignature:
name = b
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(meNeither)) kotlin.String
symbol = b: @R|kotlin.ParameterName|(name = String(meNeither)) kotlin.String)
}
@@ -0,0 +1,3 @@
fun call(x: (a: Int, String) -> Unit) {
<expr>x(1, "")</expr>
}
@@ -0,0 +1,36 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = true
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = x
isSafeNavigation = false
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Unit
symbol = kotlin/Function2.invoke(<dispatch receiver>: kotlin.Function2<P1, P2, R>, p1: P1, p2: P2): R
valueParameters = [
KtVariableLikeSignature:
name = a
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(a)) kotlin.Int
symbol = p1: P1,
KtVariableLikeSignature:
name = p2
receiverType = null
returnType = kotlin.String
symbol = p2: P2
]
argumentMapping = {
1 -> (KtVariableLikeSignature:
name = a
receiverType = null
returnType = @R|kotlin.ParameterName|(name = String(a)) kotlin.Int
symbol = p1: P1),
"" -> (KtVariableLikeSignature:
name = p2
receiverType = null
returnType = kotlin.String
symbol = p2: P2)
}
@@ -0,0 +1,7 @@
interface Foo
operator fun <T> Foo.invoke(t: T) {}
fun test(f: Foo) {
<expr>f("")</expr>
}
@@ -0,0 +1,26 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = true
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = null
extensionReceiver = KtExplicitReceiverValue:
expression = f
isSafeNavigation = false
signature = KtFunctionLikeSignature:
receiverType = Foo
returnType = kotlin.Unit
symbol = /invoke(<extension receiver>: Foo, t: T): kotlin.Unit
valueParameters = [
KtVariableLikeSignature:
name = t
receiverType = null
returnType = kotlin.String
symbol = t: T
]
argumentMapping = {
"" -> (KtVariableLikeSignature:
name = t
receiverType = null
returnType = kotlin.String
symbol = t: T)
}
@@ -0,0 +1,7 @@
operator fun Int.invoke() {}
class A {
val f: Int = 1
fun test() {
<expr>f()</expr>
}
}

Some files were not shown because too many files have changed in this diff Show More