This fixes the problem in JVM IR backend which didn't pass bound
receiver value of an adapted function reference to the superclass
(kotlin/jvm/internal/AdaptedFunctionReference), which caused equals to
work incorrectly on such references (see changes in box tests).
Previously, bound adapted function reference was represented as
IrFunctionExpression to an adapter function which calls the callee. The
value of the bound receiver in that case could only be found in the body
of that adapter function. This is not very convenient, so this change
makes psi2ir produce a block of the adapter function + reference to it.
The bound receiver value is then found in the reference. This is
basically similar to what ProvisionalFunctionExpressionLowering is doing
for all function expressions. And since this IR structure is already
supported in FunctionReferenceLowering, the problem in the JVM IR is
fixed without any additional modifications.
However, inliners do not support this IR structure yet, see KT-38535 and
KT-38536.
In general, `InliningContext.findAnonymousTransformationInfo` was not
reliable because it mapped each type to *some* info for that type,
preferring ones with `shouldRegenerate == true` if those exist. Thus, it
returned incorrect results if one type was regenerated multiple times,
e.g. in a nested inlining context or because of a `finally` (which
duplicates anonymous objects). The solution is to avoid a global map and
attach the current transformation info directly to the current inlining
context.
This allows removing a hack in the MethodSignatureMapper.
When introducing non-getter methods that dispatch to a getter
we have to be careful to use the right name.
DeepCopyIrTreeWithSymbols should create the link between new
properties and their new getter/setter.
While this fix only changes label name, it's important for proper
lambda resolution because receiver is set for a lambda
only in presence of a label
This commit fixes a lot of checkType calls in diagnostic tests
- To fix this test `ExpectActualTable` has to be refactored from usage
of descriptors to IdSignature since Wrapped and Deserialized descriptors
for the same declaration are not equal to each other.