- Added tests to demonstrate broken behaviour: the interaction of inline
functions and callable references with varargs and defaults in various
combinations.
- Refactored InlineCallableReferencesToLambdaPhase to look like and use
some of the infrastructure from CallableReferenceLowering.
- Lifted some of this infrastructure out to be broadly reusable.
Take branching and method calls into account when finding the line
number of the continuation. If there is no line number before
branching instructions or method calls, the following code is
still on the line of the suspend call itself.
This fixes a couple of issues with incorrect line numbers for
multiple throws on the same line or multipe suspend calls on
the same line.
In addition, it avoids the need to spam the method node with
repeated line number instructions in the IR backend.
When creating delegation redirectors for default implementations of
interface functions, `overriddenSymbols` should be repaired across the
whole module, not just a particular file.
With the mangling added in 488418d960, there's no longer any risk in
writing "special" function name ("<anonymous>" in this case) to the
local variable table.
#KT-34356 Fixed
Do this by reordering the lowerings so that the lowering that
adds continuations happen after default methods have been
eliminated if needed.
Mark more functions as known to be tail-calls: bridges and
delegated members.
Preserve source info and annotations when creating replacement
functions.
- Extract all backend codegen tests that specifically target behaviour
in to-be-deprecated functionality from language versions < 1.3"
- Remove those tests from the JVM IR test suite.
If "null" was the first entry in an optimizable "when" over enum,
mapRuntimeEnumEntry was called before mapConstEnumEntry, and the
$WhenMappings field was not created. Now both mapConstEnumEntry and
mapRuntimeEnumEntry create this field on the first access
other than randomly throw assertion errors on inline calls in synthetic
functions, which have no line number attached.
`lazySourceMapper.callSiteMarker` is set in `InlineCodegen.inlineCall`;
`IrSourceCompilerForInline.doCreateMethodNodeFromSource` does not need
to touch it.
The challenge for overridable suspend functions is that the calling
the state machine method to resume after suspension would be
virtually dispatced to the wrong method. To avoid that a static
suspend implementation method is generated which becomes the
state machine method used to resume.
suspend functions and lambdas.
Otherwise, when state-machine builder splits instructions and adds
LINENUMBER between states, the information becomes corrupted.
When replacing an enum entry reference with `this`, you need to take
`this` from the function's `dispatchReceiverParameter`, not the class's
`thisReceiver`. Otherwise the code generator fails to find the reference
among accessible variables.
where "fix" means "work around a bug that is much harder to fix". When
lambdas are extracted into the nearest class, captured type parameters
are not transformed into type parameters of the new method; because of
this, to check whether a reified type parameter is captured by a method
we need to check the outermost named function, not the current function.
Rely on the frontend weeding out cases that are not supported.
In psi2ir, introduce all the parameters before processing default
values.
Change the DefaultArgumentStubGenerator to generate code that
matches the behavior of the current backend.