In Native and JS, there is a special logic where the compiler saves
a copy of inlined function (see `InlineFunctionsSupport`). This copy
is used in the IR inliner. Because of that, we can't really compare
inlined function with other functions directly. We need to
get `originalFunction` first and save it.
This is an addition to d4278250e6. Apparently we still need to produce
a new fake override for each inherited static member, because otherwise
we would try to determine the most specific return type, maximum
visibility, etc, all of which makes no sense for static members.
#KT-66152 Fixed
The problem was that in K2 for some top-level script declarations we
need to add a dispatch receiver parameter (because frontend do not
assign any, but representing script as a class requires it to be the
script class) and at the same time, calls to these declarations rely on
properly set dispatch receiver parameter.
The simplest solution found is to have an additional traversal on the
relevan top-level declarations and assigning the dispatch receiver,
before running the main transformation.
#KT-64502 fixed
When using DeepCopyIrTreeWithSymbols as class transformer to transform
the IrClass, the source element of IrClass was set to
SourceElement.NO_SOURCE after the transform.
^KT-65343 Fixed
`originalCallee` is supposed to be the owner of the original call.
It can be a fake override, and in the inliner we are using actual
function with body. Apparently we can just stick with the resolved
function.
#KT-64807
The previous one was incorrect for K1 since parent of top-level function
is `IrClass`, not `IrPackageFragment`.
The change is non-functional, K1 still worked correctly, but had to do
some extra work when inlining `emptyArray` calls and produces less
performant bytecode.
It was a workaround for case, where expect class don't have
override of abstract function. We don't allow it anymore,
so it can be dropped to make correct modality comparation.
^KT-65971
This fixes some crashes on red code in diagnostic tests.
Also can be useful in the future, when we would allow things like
enum.name in annotation arguments.
^KT-65971
This is needed because in case a static member is inherited via a Kotlin
class (class C in the newly added test), its origin becomes
FAKE_OVERRIDE which is technically not Java anymore. After this change,
we'll build fake overrides for static members from superclasses
regardless of whether they come from Java or Kotlin.
Also, move the previous logic of
isOverridableFunction/isOverridableProperty to the only call site at
IdSignatureFactory.
#KT-65589 Fixed