new tests
diff --git a/compiler/testData/klib/partial-linkage/referencingUnusableDeclarations/lib2/l2.kt b/compiler/testData/klib/partial-linkage/referencingUnusableDeclarations/lib2/l2.kt
index 9c22b1c..cb88179 100644
--- a/compiler/testData/klib/partial-linkage/referencingUnusableDeclarations/lib2/l2.kt
+++ b/compiler/testData/klib/partial-linkage/referencingUnusableDeclarations/lib2/l2.kt
@@ -65,6 +65,10 @@
fun referenceInnerToNestedConstructorWithoutDispatchReceiver(): String = ClassWithChangedMembers::InnerToNested.name
fun referenceInnerToNestedConstructorWithDispatchReceiver(obj: ClassWithChangedMembers): String = obj::InnerToNested.name
+fun invokeNestedToInnerConstructorWithoutDispatchReceiver(): String = ClassWithChangedMembers::NestedToInner.invoke(123).toString()
+fun invokeInnerToNestedConstructorWithoutDispatchReceiver(obj: ClassWithChangedMembers): String = ClassWithChangedMembers::InnerToNested.invoke(obj, 123).toString()
+fun invokeInnerToNestedConstructorWithDispatchReceiver(obj: ClassWithChangedMembers): String = obj::InnerToNested.invoke(123).toString()
+
fun referenceFunctionWithUnlinkedParameter(): String = ::functionWithUnlinkedParameter.name
fun referenceFunctionWithUnlinkedReturnValue(): String = ::functionWithUnlinkedReturnValue.name
fun referenceFunctionWithRemovedTypeParameter(): String {
diff --git a/compiler/testData/klib/partial-linkage/referencingUnusableDeclarations/main/m.kt b/compiler/testData/klib/partial-linkage/referencingUnusableDeclarations/main/m.kt
index 391c72c..fbb61f1 100644
--- a/compiler/testData/klib/partial-linkage/referencingUnusableDeclarations/main/m.kt
+++ b/compiler/testData/klib/partial-linkage/referencingUnusableDeclarations/main/m.kt
@@ -49,6 +49,10 @@
expectFailure(linkage("Reference to constructor 'InnerToNested.<init>' can not be evaluated: The call site provides 1 more value argument(s) than the constructor expects")) { referenceInnerToNestedConstructorWithoutDispatchReceiver() }
expectFailure(linkage("Reference to constructor 'InnerToNested.<init>' can not be evaluated: The call site provides 1 more value argument(s) than the constructor expects")) { referenceInnerToNestedConstructorWithDispatchReceiver(classWithChangedMembers) }
+ expectFailure(linkage("Reference to constructor 'NestedToInner.<init>' can not be evaluated: The call site has 1 less value argument(s) than the constructor requires. Those arguments are missing: <this>")) { invokeNestedToInnerConstructorWithoutDispatchReceiver() }
+ expectFailure(linkage("Reference to constructor 'InnerToNested.<init>' can not be evaluated: The call site provides 1 more value argument(s) than the constructor expects")) { invokeInnerToNestedConstructorWithoutDispatchReceiver(classWithChangedMembers) }
+ expectFailure(linkage("Reference to constructor 'InnerToNested.<init>' can not be evaluated: The call site provides 1 more value argument(s) than the constructor expects")) { invokeInnerToNestedConstructorWithDispatchReceiver(classWithChangedMembers) }
+
expectFailure(linkage("Reference to function 'functionWithUnlinkedParameter' can not be evaluated: Function uses unlinked class symbol '/RemovedClass'")) { referenceFunctionWithUnlinkedParameter() }
expectFailure(linkage("Reference to function 'functionWithUnlinkedReturnValue' can not be evaluated: Function uses unlinked class symbol '/RemovedClass'")) { referenceFunctionWithUnlinkedReturnValue() }
expectFailure(linkage("Reference to function 'functionWithRemovedTypeParameter' can not be evaluated: Function uses unlinked class symbol '/RemovedClass' (via type parameter '#0')")) { referenceFunctionWithRemovedTypeParameter() }
diff --git a/compiler/testData/klib/partial-linkage/referencingUnusableDeclarationsWithRichReferences/ReadMe.md b/compiler/testData/klib/partial-linkage/referencingUnusableDeclarationsWithRichReferences/ReadMe.md
new file mode 100644
index 0000000..749d36b7
--- /dev/null
+++ b/compiler/testData/klib/partial-linkage/referencingUnusableDeclarationsWithRichReferences/ReadMe.md
@@ -0,0 +1 @@
+This is the copy of referencingUnusableDeclarations test, but testing the new implementation of callable references (IrRichCallableReference).
\ No newline at end of file
diff --git a/compiler/testData/klib/partial-linkage/referencingUnusableDeclarationsWithRichReferences/lib2/l2.kt b/compiler/testData/klib/partial-linkage/referencingUnusableDeclarationsWithRichReferences/lib2/l2.kt
index 9c22b1c..cb88179 100644
--- a/compiler/testData/klib/partial-linkage/referencingUnusableDeclarationsWithRichReferences/lib2/l2.kt
+++ b/compiler/testData/klib/partial-linkage/referencingUnusableDeclarationsWithRichReferences/lib2/l2.kt
@@ -65,6 +65,10 @@
fun referenceInnerToNestedConstructorWithoutDispatchReceiver(): String = ClassWithChangedMembers::InnerToNested.name
fun referenceInnerToNestedConstructorWithDispatchReceiver(obj: ClassWithChangedMembers): String = obj::InnerToNested.name
+fun invokeNestedToInnerConstructorWithoutDispatchReceiver(): String = ClassWithChangedMembers::NestedToInner.invoke(123).toString()
+fun invokeInnerToNestedConstructorWithoutDispatchReceiver(obj: ClassWithChangedMembers): String = ClassWithChangedMembers::InnerToNested.invoke(obj, 123).toString()
+fun invokeInnerToNestedConstructorWithDispatchReceiver(obj: ClassWithChangedMembers): String = obj::InnerToNested.invoke(123).toString()
+
fun referenceFunctionWithUnlinkedParameter(): String = ::functionWithUnlinkedParameter.name
fun referenceFunctionWithUnlinkedReturnValue(): String = ::functionWithUnlinkedReturnValue.name
fun referenceFunctionWithRemovedTypeParameter(): String {
diff --git a/compiler/testData/klib/partial-linkage/referencingUnusableDeclarationsWithRichReferences/main/m.kt b/compiler/testData/klib/partial-linkage/referencingUnusableDeclarationsWithRichReferences/main/m.kt
index 391c72c..f8720ac 100644
--- a/compiler/testData/klib/partial-linkage/referencingUnusableDeclarationsWithRichReferences/main/m.kt
+++ b/compiler/testData/klib/partial-linkage/referencingUnusableDeclarationsWithRichReferences/main/m.kt
@@ -7,30 +7,30 @@
val classWithChangedMembers = ClassWithChangedMembers()
expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: No class found for symbol '/RemovedClass'")) { referenceRemovedClassReference() }
- expectFailure(linkage("Reference to constructor 'RemovedClass.<init>' can not be evaluated: No constructor found for symbol '/RemovedClass.<init>'")) { referenceRemovedClassConstructorReference() }
+ expectFailure(linkage("Reference to constructor 'RemovedClass.<init>' can not be evaluated: Expression uses unlinked class symbol '/RemovedClass'")) { referenceRemovedClassConstructorReference() }
expectFailure(linkage("Reference to property 'p1' can not be evaluated: No property found for symbol '/RemovedClass.p1'")) { referenceRemovedClassProperty1Reference() }
- expectFailure(linkage("Reference to function 'f1' can not be evaluated: No function found for symbol '/RemovedClass.f1'")) { referenceRemovedClassFunction1Reference() }
+ expectFailure(linkage("Reference to function 'f1' can not be evaluated: Expression uses unlinked class symbol '/RemovedClass'")) { referenceRemovedClassFunction1Reference() }
expectFailure(linkage("Reference to class 'RemovedClassImpl' can not be evaluated: Expression uses unlinked class symbol '/RemovedClass' (via class 'RemovedClassImpl')")) { referenceRemovedClassImplReference() }
- expectFailure(linkage("Reference to constructor 'RemovedClassImpl.<init>' can not be evaluated: Class 'RemovedClassImpl' uses unlinked class symbol '/RemovedClass'")) { referenceRemovedClassImplConstructorReference() }
+ expectFailure(linkage("Reference to constructor 'RemovedClassImpl.<init>' can not be evaluated: Expression uses unlinked class symbol '/RemovedClass' (via class 'RemovedClassImpl')")) { referenceRemovedClassImplConstructorReference() }
expectFailure(linkage("Reference to property 'p1' can not be evaluated: No property found for symbol '/RemovedClassImpl.p1'")) { referenceRemovedClassImplProperty1Reference() }
expectFailure(linkage("Reference to property 'p2' can not be evaluated: Dispatch receiver class 'RemovedClassImpl' uses unlinked class symbol '/RemovedClass'")) { referenceRemovedClassImplProperty2Reference() }
- expectFailure(linkage("Reference to function 'f1' can not be evaluated: No function found for symbol '/RemovedClassImpl.f1'")) { referenceRemovedClassImplFunction1Reference() }
- expectFailure(linkage("Reference to function 'f2' can not be evaluated: Dispatch receiver class 'RemovedClassImpl' uses unlinked class symbol '/RemovedClass'")) { referenceRemovedClassImplFunction2Reference() }
+ expectFailure(linkage("Reference to function 'f1' can not be evaluated: Expression uses unlinked class symbol '/RemovedClass' (via class 'RemovedClassImpl')")) { referenceRemovedClassImplFunction1Reference() }
+ expectFailure(linkage("Reference to function 'f2' can not be evaluated: Expression uses unlinked class symbol '/RemovedClass' (via class 'RemovedClassImpl')")) { referenceRemovedClassImplFunction2Reference() }
expectFailure(linkage("Reference to class 'RemovedInterface' can not be evaluated: No class found for symbol '/RemovedInterface'")) { referenceRemovedInterfaceReference() }
expectFailure(linkage("Reference to property 'p1' can not be evaluated: No property found for symbol '/RemovedInterface.p1'")) { referenceRemovedInterfaceProperty1Reference() }
expectFailure(linkage("Reference to property 'p2' can not be evaluated: No property found for symbol '/RemovedInterface.p2'")) { referenceRemovedInterfaceProperty2Reference() }
- expectFailure(linkage("Reference to function 'f1' can not be evaluated: No function found for symbol '/RemovedInterface.f1'")) { referenceRemovedInterfaceFunction1Reference() }
- expectFailure(linkage("Reference to function 'f2' can not be evaluated: No function found for symbol '/RemovedInterface.f2'")) { referenceRemovedInterfaceFunction2Reference() }
+ expectFailure(linkage("Reference to function 'f1' can not be evaluated: Expression uses unlinked class symbol '/RemovedInterface'")) { referenceRemovedInterfaceFunction1Reference() }
+ expectFailure(linkage("Reference to function 'f2' can not be evaluated: Expression uses unlinked class symbol '/RemovedInterface'")) { referenceRemovedInterfaceFunction2Reference() }
expectFailure(linkage("Reference to class 'RemovedInterfaceImpl' can not be evaluated: Expression uses unlinked class symbol '/RemovedInterface' (via class 'RemovedInterfaceImpl')")) { referenceRemovedInterfaceImplReference() }
expectFailure(linkage("Reference to property 'p1' can not be evaluated: Dispatch receiver class 'RemovedInterfaceImpl' uses unlinked class symbol '/RemovedInterface'")) { referenceRemovedInterfaceImplProperty1Reference() }
expectFailure(linkage("Reference to property 'p2' can not be evaluated: No property found for symbol '/RemovedInterfaceImpl.p2'")) { referenceRemovedInterfaceImplProperty2Reference() }
expectFailure(linkage("Reference to property 'p3' can not be evaluated: Dispatch receiver class 'RemovedInterfaceImpl' uses unlinked class symbol '/RemovedInterface'")) { referenceRemovedInterfaceImplProperty3Reference() }
- expectFailure(linkage("Reference to function 'f1' can not be evaluated: Dispatch receiver class 'RemovedInterfaceImpl' uses unlinked class symbol '/RemovedInterface'")) { referenceRemovedInterfaceImplFunction1Reference() }
- expectFailure(linkage("Reference to function 'f2' can not be evaluated: No function found for symbol '/RemovedInterfaceImpl.f2'")) { referenceRemovedInterfaceImplFunction2Reference() }
- expectFailure(linkage("Reference to function 'f3' can not be evaluated: Dispatch receiver class 'RemovedInterfaceImpl' uses unlinked class symbol '/RemovedInterface'")) { referenceRemovedInterfaceImplFunction3Reference() }
+ expectFailure(linkage("Reference to function 'f1' can not be evaluated: Expression uses unlinked class symbol '/RemovedInterface' (via class 'RemovedInterfaceImpl')")) { referenceRemovedInterfaceImplFunction1Reference() }
+ expectFailure(linkage("Reference to function 'f2' can not be evaluated: Expression uses unlinked class symbol '/RemovedInterface' (via class 'RemovedInterfaceImpl')")) { referenceRemovedInterfaceImplFunction2Reference() }
+ expectFailure(linkage("Reference to function 'f3' can not be evaluated: Expression uses unlinked class symbol '/RemovedInterface' (via class 'RemovedInterfaceImpl')")) { referenceRemovedInterfaceImplFunction3Reference() }
expectSuccess("<init>") { referenceStableClassConstructor() }
expectSuccess("foo") { referenceStableClassMemberFunctionWithoutDispatchReceiver() }
@@ -45,13 +45,17 @@
expectFailure(linkage("Reference to function 'removedFun' can not be evaluated: No function found for symbol '/InterfaceWithChangedMembers.removedFun'")) { referenceRemovedFunFromInterface() }
expectFailure(linkage("Reference to function 'changedFun' can not be evaluated: No function found for symbol '/InterfaceWithChangedMembers.changedFun'")) { referenceChangedFunFromInterface() }
- expectFailure(linkage("Reference to constructor 'NestedToInner.<init>' can not be evaluated: The call site has 1 less value argument(s) than the constructor requires. Those arguments are missing: <this>")) { referenceNestedToInnerConstructorWithoutDispatchReceiver() }
- expectFailure(linkage("Reference to constructor 'InnerToNested.<init>' can not be evaluated: The call site provides 1 more value argument(s) than the constructor expects")) { referenceInnerToNestedConstructorWithoutDispatchReceiver() }
- expectFailure(linkage("Reference to constructor 'InnerToNested.<init>' can not be evaluated: The call site provides 1 more value argument(s) than the constructor expects")) { referenceInnerToNestedConstructorWithDispatchReceiver(classWithChangedMembers) }
+ expectSuccess("<init>") { referenceNestedToInnerConstructorWithoutDispatchReceiver() }
+ expectSuccess("<init>") { referenceInnerToNestedConstructorWithoutDispatchReceiver() }
+ expectSuccess("<init>") { referenceInnerToNestedConstructorWithDispatchReceiver(classWithChangedMembers) }
- expectFailure(linkage("Reference to function 'functionWithUnlinkedParameter' can not be evaluated: Function uses unlinked class symbol '/RemovedClass'")) { referenceFunctionWithUnlinkedParameter() }
- expectFailure(linkage("Reference to function 'functionWithUnlinkedReturnValue' can not be evaluated: Function uses unlinked class symbol '/RemovedClass'")) { referenceFunctionWithUnlinkedReturnValue() }
- expectFailure(linkage("Reference to function 'functionWithRemovedTypeParameter' can not be evaluated: Function uses unlinked class symbol '/RemovedClass' (via type parameter '#0')")) { referenceFunctionWithRemovedTypeParameter() }
+ expectFailure(linkage("Constructor 'NestedToInner.<init>' can not be called: The call site has 1 less value argument(s) than the constructor requires. Those arguments are missing: x")) { invokeNestedToInnerConstructorWithoutDispatchReceiver() }
+ expectFailure(linkage("Constructor 'InnerToNested.<init>' can not be called: The call site provides 1 more value argument(s) than the constructor expects")) { invokeInnerToNestedConstructorWithoutDispatchReceiver(classWithChangedMembers) }
+ expectFailure(linkage("Constructor 'InnerToNested.<init>' can not be called: The call site provides 1 more value argument(s) than the constructor expects")) { invokeInnerToNestedConstructorWithDispatchReceiver(classWithChangedMembers) }
+
+ expectFailure(linkage("Reference to function 'functionWithUnlinkedParameter' can not be evaluated: Expression uses unlinked class symbol '/RemovedClass'")) { referenceFunctionWithUnlinkedParameter() }
+ expectFailure(linkage("Reference to function 'functionWithUnlinkedReturnValue' can not be evaluated: Expression uses unlinked class symbol '/RemovedClass'")) { referenceFunctionWithUnlinkedReturnValue() }
+ expectFailure(linkage("Reference to function 'functionWithRemovedTypeParameter' can not be evaluated: Expression uses unlinked class symbol '/RemovedClass' (via class 'RemovedClassImpl')")) { referenceFunctionWithRemovedTypeParameter() }
expectSuccess("foo") { referencingMemberFunctionFoo(sfh) }
expectSuccess("bar") { referencingMemberFunctionBar(sfh) }