Revert changes for "tolerant to uninitialized values" in OptimizationBasicInterpreter:
this approach doesn't converge for some specific cases where local variable is reused
(e.g., in several inlined functions - see https://youtrack.jetbrains.com/issue/KT-15112).
Instead, treat fake always-false conditional jump in the beginning of the post-condition loop as a "reference point" for stack on loop break / continue.
This requires an extra abstraction layer in FixStackAnalyzer, since we can't perform fine-grain manipulations on Frames
(such as "combine frame C from local variables of frame A and stack of frame B").
NB additional NOPs will be generated for post-condition loops.
Should make a separate bytecode postprocessing pass to get rid of unnecessary NOPs
(several YT issues for perceived quality of the generated bytecode are about such NOPs).
For special calls (when-expressions, if-expressions, etc.), do not attempt to
get type of the argument expression, which is the block with the callable
reference, instead get type of the callable reference itself. The difference
matters because for block expressions, a new lexical scope is created for each
getTypeInfo (see ExpressionTypingServices.getBlockReturnedType), and we do not
support rewrites of this value in the binding trace
#KT-12044 Fixed
- `invoke` method must always start a suspend functions
- For creation of coroutine that has not been started yet, there are
two special internal interfaces `SuspendFunction0`/`SuspendFunction1`
The meaning of `setDropOriginalInContainingParts()` call is that
it makes copyBuilder forget the original parts, in particular
the valueParameter.original.containingDeclaration does not reference
original descriptor no more
Otherwise the following exception is happening:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl.getOverriddenDescriptors(ValueParameterDescriptorImpl.kt:119)
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl.getOverriddenDescriptors(ValueParameterDescriptorImpl.kt:119)
at org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt$hasDefaultValue$1.getNeighbors(DescriptorUtils.kt:192)
at org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt$hasDefaultValue$1.getNeighbors(DescriptorUtils.kt)
at org.jetbrains.kotlin.utils.DFS.doDfs(DFS.java:98)
at org.jetbrains.kotlin.utils.DFS.doDfs(DFS.java:99)
at org.jetbrains.kotlin.utils.DFS.dfs(DFS.java:27)
at org.jetbrains.kotlin.utils.DFS.dfs(DFS.java:37)
at org.jetbrains.kotlin.utils.DFS.ifAny(DFS.java:47)
at org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt.hasDefaultValue(DescriptorUtils.kt:189)
at org.jetbrains.kotlin.renderer.DescriptorRendererImpl.renderValueParameter(DescriptorRendererImpl.kt:803)
at org.jetbrains.kotlin.renderer.DescriptorRendererImpl.renderValueParameters(DescriptorRendererImpl.kt:767)
at org.jetbrains.kotlin.renderer.DescriptorRendererImpl.renderFunction(DescriptorRendererImpl.kt:683)
at org.jetbrains.kotlin.renderer.DescriptorRendererImpl.access$renderFunction(DescriptorRendererImpl.kt:42)
at org.jetbrains.kotlin.renderer.DescriptorRendererImpl$RenderDeclarationDescriptorVisitor.visitFunctionDescriptor(DescriptorRendererImpl.kt:1039)
at org.jetbrains.kotlin.renderer.DescriptorRendererImpl$RenderDeclarationDescriptorVisitor.visitFunctionDescriptor(DescriptorRendererImpl.kt:1002)
at org.jetbrains.kotlin.descriptors.impl.FunctionDescriptorImpl.accept(FunctionDescriptorImpl.java:760)