[PL][Tests] Add test for fun reference with changed SAM

It works now, because with rich IR references the actual call to the
referenced function is treated and checked as a regular call, which
includes checking the function shape.

#KT-61552 Fixed
diff --git a/compiler/testData/klib/partial-linkage/classTransformations/lib1/l1.kt b/compiler/testData/klib/partial-linkage/classTransformations/lib1/l1.kt
index a8af2a0..ba37c9f 100644
--- a/compiler/testData/klib/partial-linkage/classTransformations/lib1/l1.kt
+++ b/compiler/testData/klib/partial-linkage/classTransformations/lib1/l1.kt
@@ -159,3 +159,7 @@
 interface XProperty2Default { /*val property2: Int get() = 42*/ }
 
 fun interface FunctionalInterfaceToInterface : XAnswer
+
+fun interface FunctionalInterfaceWithChangedFun {
+    fun answer(): Int
+}
diff --git a/compiler/testData/klib/partial-linkage/classTransformations/lib1/l1.kt.1 b/compiler/testData/klib/partial-linkage/classTransformations/lib1/l1.kt.1
index c82b2aa..c4cd86a 100644
--- a/compiler/testData/klib/partial-linkage/classTransformations/lib1/l1.kt.1
+++ b/compiler/testData/klib/partial-linkage/classTransformations/lib1/l1.kt.1
@@ -159,3 +159,7 @@
 interface XProperty2Default { val property2: Int get() = 42 }
 
 /*fun*/ interface FunctionalInterfaceToInterface : XAnswer
+
+fun interface FunctionalInterfaceWithChangedFun {
+    fun answer(x: Int): Int
+}
\ No newline at end of file
diff --git a/compiler/testData/klib/partial-linkage/classTransformations/lib2/l2.kt b/compiler/testData/klib/partial-linkage/classTransformations/lib2/l2.kt
index f9c77b9..dd4eac1 100644
--- a/compiler/testData/klib/partial-linkage/classTransformations/lib2/l2.kt
+++ b/compiler/testData/klib/partial-linkage/classTransformations/lib2/l2.kt
@@ -289,6 +289,22 @@
     return getFunctionalInterfaceToInterface(answer).answer()
 }
 
+fun getFunctionalInterfaceWithChangedFun(answer: Int): FunctionalInterfaceWithChangedFun {
+    val worker = FunctionalInterfaceWithChangedFun { answer }
+    return worker
+}
+
+fun getFunctionalInterfaceWithChangedFunAsObject(answer: Int): FunctionalInterfaceWithChangedFun {
+    val worker = object : FunctionalInterfaceWithChangedFun {
+        override fun answer() = answer
+    }
+    return worker
+}
+
+fun getFunctionalInterfaceWithChangedFunAnswer(answer: Int): Int {
+    return getFunctionalInterfaceWithChangedFun(answer).answer()
+}
+
 fun interface FunctionalInterfaceWith0AbstractFunctions : XAnswerDefault
 fun interface FunctionalInterfaceWith1AbstractFunction : XAnswer, XFunction1Default, XFunction2Default, XProperty1Default, XProperty2Default
 fun interface FunctionalInterfaceWith2AbstractFunctions : XAnswer, XFunction1, XFunction2Default, XProperty1Default, XProperty2Default
diff --git a/compiler/testData/klib/partial-linkage/classTransformations/main/m.kt b/compiler/testData/klib/partial-linkage/classTransformations/main/m.kt
index 8f868e0..963a3c5 100644
--- a/compiler/testData/klib/partial-linkage/classTransformations/main/m.kt
+++ b/compiler/testData/klib/partial-linkage/classTransformations/main/m.kt
@@ -179,6 +179,9 @@
     expectSuccess(1) { getFunctionalInterfaceToInterface(1).answer() }
     expectSuccess(2) { getFunctionalInterfaceToInterfaceAsObject(2).answer() }
     expectSuccess(3) { getFunctionalInterfaceToInterfaceAnswer(3) }
+    expectFailure(linkage("Reference to lambda in function 'getFunctionalInterfaceWithChangedFun' can not be evaluated: No function found for symbol '/FunctionalInterfaceWithChangedFun.answer'")) { getFunctionalInterfaceWithChangedFun(1).answer() }
+    expectFailure(linkage("Function 'answer' can not be called: No function found for symbol '/FunctionalInterfaceWithChangedFun.answer'")) { getFunctionalInterfaceWithChangedFunAsObject(2).answer() }
+    expectFailure(linkage("Reference to lambda in function 'getFunctionalInterfaceWithChangedFun' can not be evaluated: No function found for symbol '/FunctionalInterfaceWithChangedFun.answer'")) { getFunctionalInterfaceWithChangedFunAnswer(3) }
     expectSuccess(4) { getFunctionalInterfaceWith0AbstractFunctions(4).answer() }
     expectSuccess(5) { getFunctionalInterfaceWith0AbstractFunctionsAsObject(5).answer() }
     expectSuccess(6) { getFunctionalInterfaceWith0AbstractFunctionsAnswer(6) }