Commit Graph

1035 Commits

Author SHA1 Message Date
Dmitry Petrov 57c12476d7 Provide parent reference for temporary variables immediately 2018-12-20 15:57:31 +03:00
Mikhael Bogdanov 026ac1bee6 Inline API constant 2018-12-20 12:55:11 +01:00
Dmitry Petrov e5d946a96c Parent for thisReceiver of IrLazyClass is the corresponding class
Fixes issue in Kotlin/Native.
2018-12-19 15:48:07 +03:00
Dmitry Petrov 85f55dec9a Support SAM conversion in psi2ir
SAM conversion takes a function value (function type or a subtype),
and produces a SAM interface value.
2018-12-19 10:58:34 +03:00
Roman Artemev e436e7cf61 [JS IR BE] Support call super with default parameters 2018-12-18 15:55:09 +03:00
Roman Artemev 256317da15 [IR BE] Fix SharedVariableLowering
* make it able to detect shared vars under any declaration kind, not only IrFunction
 * Add & update tests
2018-12-18 15:19:17 +03:00
Georgy Bronnikov 3b16fa6af9 Do not generate interface delegation for default parameter stubs 2018-12-18 13:57:23 +03:00
Mikhail Zarechenskiy c924a6efe8 Fix unbound class literals for inline classes
#KT-28361 Fixed
2018-12-18 11:35:36 +03:00
Mikhail Zarechenskiy e8a8318ead [NI] Fix input/output types for callable reference atom
Input and output types are crucial for type variable fixation order and
 analysis of postponed arguments (callable references, lambdas).

 Specifically, if there is non-fixed type variable inside input types of
 a callable reference, then we'll postpone resolution for such callable
 reference.

 Initial example with the expected type `KMutableProperty1<*, F>` caused
 problems because input types were computed incorrectly (while there
 aren't input types here)

 #KT-25431 Fixed
2018-12-11 11:33:29 +03:00
Georgy Bronnikov 5dd9cfca4d Repair after merge 2018-12-10 17:26:55 +03:00
Georgy Bronnikov a695e21e44 Introduce IrLazyProperty 2018-12-10 17:26:55 +03:00
Georgy Bronnikov f4a189fe82 Change order of arguments in IrValueParameter.copyTo 2018-12-10 17:26:55 +03:00
Georgy Bronnikov c018109bca React to review comments 2018-12-10 17:26:55 +03:00
Georgy Bronnikov c9343c89bc Mark java external declarations in IrFunction.origin 2018-12-10 17:26:55 +03:00
Georgy Bronnikov 1764423860 JVM_IR. Mostly remove descriptors from InterfaceDelegationLowering 2018-12-10 17:26:55 +03:00
Georgy Bronnikov cbc46fe6e4 JVM_IR. Mostly remove descriptors from InterfaceLowering
Descriptors are only used to generate a new method name via a call to
KotlinTypeMapper.
2018-12-10 17:26:55 +03:00
Georgy Bronnikov 55b65546fa IR. Take care of type parameters for calls in DefaultArgumentStubGenerator 2018-12-10 17:26:55 +03:00
Georgy Bronnikov bba711a189 JVM_IR. Remove descriptors from ConstAndJvmFieldPropertiesLowering 2018-12-10 17:26:55 +03:00
Georgy Bronnikov 41da078de5 IR. Create IrAnonymousInitializerSymbolImpl using a class symbol 2018-12-10 17:26:55 +03:00
Georgy Bronnikov 481bef9799 JVM_IR. Copy annotations properly in MoveCompanionObjectFieldsLowering 2018-12-10 17:26:55 +03:00
Georgy Bronnikov a5fea34f12 Remove some dead code 2018-12-10 17:26:55 +03:00
Georgy Bronnikov bf4f552478 IR. Remove descriptors from KCallableNamePropertyLowering 2018-12-10 17:26:55 +03:00
Roman Artemev eff81525d3 Make IrField be IrDeclarationParent
* fix parent in TypeOperatorLowering
2018-12-07 17:58:20 +03:00
Roman Artemev ce70e5850f [JS IR BE] New Inliner from native 2018-12-07 17:58:20 +03:00
Dmitry Petrov 0561cb6c0d Fix KT-24804 PSI2IR Crashes on loop with two labels 2018-12-07 10:51:55 +03:00
Dmitry Petrov f8582c1929 psi2ir: ersatz type approximation for intersection types
Emulate old JVM back-end behavior for intersection type mapping.

IrType renderer should render the IR type, not the original Kotlin type.
2018-12-07 10:51:55 +03:00
Roman Artemev 30cc5f6d3c Support Ir Validation in phaser 2018-12-04 19:45:15 +03:00
Roman Artemev de1cbc396e Implement JS IR Phaser 2018-12-04 19:45:15 +03:00
Roman Artemev 2d9d9484b3 Refactored Common & JVM IR Phaser 2018-12-04 19:45:15 +03:00
Svyatoslav Kuzmich 8359887696 [JS IR BE] Fix inline classes workarounds
- Remove uninitialized return type check
- Remove unbound classifier symbol check
2018-12-03 13:07:41 +03:00
Svyatoslav Kuzmich 59032c384e [JS IR BE] Validate parents 2018-11-29 15:36:57 +03:00
Svyatoslav Kuzmich 39cdee8d6c [JS IR BE] Enable IrValidator 2018-11-29 15:36:56 +03:00
Svyatoslav Kuzmich 2172a12df4 [JS IR BE] Eliminate identical IrElements duplicates 2018-11-29 15:36:56 +03:00
Svyatoslav Kuzmich ba0f652e02 [JS IR BE] Fix parameters parents 2018-11-29 15:36:56 +03:00
Svyatoslav Kuzmich d5f8c63130 [IR] Add returnType to consturcotrs of IrFunctionBase 2018-11-29 15:36:56 +03:00
Svyatoslav Kuzmich fe6b36391d [JS IR] JsIrBuilder - add returnType and parent to buildFunction 2018-11-29 15:36:56 +03:00
Georgy Bronnikov ffa3d7c57a Update test data 2018-11-29 12:48:52 +03:00
Georgy Bronnikov 32640750ee Add CompilerPhase and corresponding compiler keys 2018-11-29 12:48:52 +03:00
Dmitry Petrov 42e253b5ff KT-28456 generate index arguments per expression
In the desugaring for compound assignment to a collection element,
argument expression 'i' is mapped to value parameters 'iG' and 'iS' of
corresponding 'get' and 'set' operators.
In general, these value parameters can have different indices.

This requires extra machinery in argument generation - that is, to be
able to generate a particular expression argument using an arbitrary
callback. In the vast majority of the cases this callback will just use
the corresponding StatementGenerator to generate IR subtree for the
provided expression. In case of 'get' and 'set' operator calls for an
augmented assignment expression this will map corresponding argument
expressions to pregenerated temporary variables.

Thus, in the following context:
```
  class A

  operator fun A.get(vararg xs: Int) = 0
  operator fun A.set(i: Int, j: Int, v: Int) {}
```

statement `a[1, 2] += 3` will be desugared as (in a really pseudo
Kotlin):
```
  {
    val tmp_array = a
    val tmp_index0 = 1
    val tmp_index1 = 2
    tmp_array.set(
      i = tmp_index0,
      j = tmp_index1,
      v = tmp_array.get(xs = [tmp_index0, tmp_index1]).plus(3)
    )
  }
```
2018-11-28 14:36:44 +03:00
Mikhail Glukhikh d50c4d7211 Fix failing IR tests because of CCE in WrappedValueParameterDescriptor
In previous commits, renderValueParameter began to calculate its
containing declaration. However, WrappedValueParameterDescriptor
assumes that parent of IrParameter is IrFunction, which is not true
for dispatch receiver parameters. The correct fix would be not to create
WrappedValueParameterDescriptor for dispatch receivers at all and use
WrappedReceiverParameterDescriptor instead. In this fix, I just moved
parameter' containing declaration calculation inside specific option
which is usually false, thus hiding the found problem.
2018-11-22 13:03:05 +03:00
Dmitry Petrov 7dd906db44 KT-28324 More exact startOffset for function/constructor declarations
Function/constructor declaration start offset is the start offset of the
corresponding declaration token, if available.
2018-11-22 10:09:31 +03:00
Igor Chevdar 2f3ff60abc Fixed bug with fake overridden functions with defaults 2018-11-20 12:11:29 +03:00
Dmitry Petrov a0d74be7cf KT-28235: Make sure array access produces unique elements
This requires generating calls on-demand in
LValueWithGetterAndSetterCalls.
2018-11-16 10:33:30 +03:00
Dmitry Petrov 080c177ed2 Minor: formatting 2018-11-16 10:33:30 +03:00
Igor Chevdar 2ff87ab1ce Fixed tests on IR copier 2018-11-15 19:13:06 +03:00
Igor Chevdar 728b7b130b Removed descriptors usage from IR copier 2018-11-15 19:13:06 +03:00
Svyatoslav Kuzmich 0bf3199c19 Support nullable inline classes 2018-11-08 15:00:33 +03:00
Svyatoslav Kuzmich 370b04df35 [JS IR BE] Inline classes lowering 2018-11-08 15:00:30 +03:00
Svyatoslav Kuzmich 4866c2b36a [IR] Move irCall from JS backend to common utils 2018-11-08 15:00:09 +03:00
Svyatoslav Kuzmich 81d61aefff [IR] Specify IrType in irTemporary 2018-11-08 15:00:09 +03:00