AA: tests about equals on sealed/data class

^KT-54844 In Progress
This commit is contained in:
Jinseong Jeon
2022-09-20 14:10:53 -07:00
committed by Ilya Kirillov
parent a4cd485f48
commit b2e239a542
10 changed files with 201 additions and 0 deletions
@@ -0,0 +1,31 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = d1
isSafeNavigation = false
type = D
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Boolean
symbol = /D.equals(<dispatch receiver>: D, other: kotlin.Any?): kotlin.Boolean
valueParameters = [
KtVariableLikeSignature:
name = other
receiverType = null
returnType = kotlin.Any?
symbol = other: kotlin.Any?
callableIdIfNonLocal = null
]
callableIdIfNonLocal = /D.equals
typeArgumentsMapping = {}
argumentMapping = {
d2 -> (KtVariableLikeSignature:
name = other
receiverType = null
returnType = kotlin.Any?
symbol = other: kotlin.Any?
callableIdIfNonLocal = null)
}
@@ -0,0 +1,6 @@
data class D(val id: String)
// TODO(KT-54844): need to create KtSymbol for data class synthetic members, such as equals/hashCode/toString
fun test(d1: D, d2: D) {
<expr>d1 == d2</expr>
}
@@ -0,0 +1,31 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = d1
isSafeNavigation = false
type = D
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?
callableIdIfNonLocal = null
]
callableIdIfNonLocal = kotlin/Any.equals
typeArgumentsMapping = {}
argumentMapping = {
d2 -> (KtVariableLikeSignature:
name = other
receiverType = null
returnType = kotlin.Any?
symbol = other: kotlin.Any?
callableIdIfNonLocal = null)
}
@@ -0,0 +1,9 @@
data class D(val id: String) {
override fun equals(other: Any?): Boolean {
return (other as? D)?.id == id
}
}
fun test(d1: D, d2: D) {
<expr>d1 == d2</expr>
}
@@ -0,0 +1,31 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = d1
isSafeNavigation = false
type = D
extensionReceiver = null
signature = KtFunctionLikeSignature:
receiverType = null
returnType = kotlin.Boolean
symbol = /D.equals(<dispatch receiver>: D, other: kotlin.Any?): kotlin.Boolean
valueParameters = [
KtVariableLikeSignature:
name = other
receiverType = null
returnType = kotlin.Any?
symbol = other: kotlin.Any?
callableIdIfNonLocal = null
]
callableIdIfNonLocal = /D.equals
typeArgumentsMapping = {}
argumentMapping = {
d2 -> (KtVariableLikeSignature:
name = other
receiverType = null
returnType = kotlin.Any?
symbol = other: kotlin.Any?
callableIdIfNonLocal = null)
}
@@ -0,0 +1,8 @@
sealed class SealedClass {
data class ClassOne(val data: Int) : SealedClass()
data class ClassTwo(val value: String) : SealedClass()
fun test(s1: SealedClass, s2: SealedClass) {
<expr>s1 == s2</expr>
}
}
@@ -0,0 +1,31 @@
KtSuccessCallInfo:
call = KtSimpleFunctionCall:
isImplicitInvoke = false
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
dispatchReceiver = KtExplicitReceiverValue:
expression = s1
isSafeNavigation = false
type = SealedClass
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?
callableIdIfNonLocal = null
]
callableIdIfNonLocal = kotlin/Any.equals
typeArgumentsMapping = {}
argumentMapping = {
s2 -> (KtVariableLikeSignature:
name = other
receiverType = null
returnType = kotlin.Any?
symbol = other: kotlin.Any?
callableIdIfNonLocal = null)
}