Commit Graph

306 Commits

Author SHA1 Message Date
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
Georgy Bronnikov 2b0ec8abe3 Update tests 2018-12-10 17:26:55 +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 6f97db81c8 Update testData after IR type rendering changes 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
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
Igor Chevdar 2ff87ab1ce Fixed tests on IR copier 2018-11-15 19:13:06 +03:00
Mikhail Zarechenskiy d28488eaed Remove WITH_UNSIGNED directive from tests
#KT-25226 Fixed
2018-11-13 11:48:32 +03:00
Dmitry Petrov 51002ee620 psi2ir: Handle missing "then" branches as empty blocks
#KT-27933
2018-11-08 12:29:15 +03:00
Dmitry Petrov bd1491ac8a psi2ir: Merge constant entries in string template expressions
This is required to handle UCNs properly, see KT-28006.

 #KT-28006
2018-11-08 12:29:15 +03:00
Alexander Udalov 266a8dae3f Fix KClassValue behavior for reified type parameter literals
#KT-27799 Open
2018-10-25 16:27:23 +02:00
Dmitry Petrov 813e4c966a Update testData for constant initializers in IR 2018-10-02 17:08:55 +03:00
Dmitry Petrov 8891733074 Generate const val initializers as IrConst expressions 2018-10-02 13:46:37 +03:00
Mikhael Bogdanov 4fb434c0de Move out jvm-specific part from ir-common
#KT-27005 Fixed
2018-10-02 11:12:21 +02:00
Georgy Bronnikov ade640eadb JVM_IR. Support compile time constants 2018-10-01 12:25:55 +03:00
Georgy Bronnikov 487f500f85 Revert "JVM_IR. Support compile time constants"
This reverts commit 055215c54f.
2018-09-25 05:24:48 +03:00
Georgy Bronnikov 055215c54f JVM_IR. Support compile time constants 2018-09-25 01:38:51 +03:00
Dmitry Petrov d03237bebc Generate backing fields and initializers for external constants 2018-09-21 09:50:21 +03:00
Dmitry Petrov ec8bdff5c7 Working infrastructure for external dependencies testing
(not really, but at least something)
2018-09-21 09:50:21 +03:00
Ilmir Usmanov 14818a4fc1 Minor. Remove tests with suspend delegates 2018-09-18 14:56:11 +03:00
Dmitry Petrov b8eb804774 KT-26531 is fixed in NewInference mode 2018-09-10 14:10:05 +03:00
Mikhail Zarechenskiy 3431123cab Fixes for tests about mod
#KT-25217
2018-09-10 06:31:55 +03:00
Alexander Udalov 0e5544a491 Use AnnotationSplitter for annotations on extension receiver
Instead of using `@receiver:`-targeted annotations on the receiver type,
use normal annotations of the ReceiverParameterDescriptor instance
everywhere
2018-09-06 19:13:10 +03:00
Dmitry Petrov 00aa6158c8 Fix IR tests for 1.3 2018-08-31 09:19:13 +03:00
Dmitry Petrov 4cf98fd3ce Fix IR generation for '!is' pattern 2018-08-31 09:12:44 +03:00
Georgy Bronnikov 50e8f7efc7 Track fake overrides for IrField 2018-08-24 13:41:52 +03:00
Mikhael Bogdanov 1a1bb53381 Update IR text test
Additional implicit coercions to unit was added
2018-08-15 14:18:15 +03:00
Dmitry Petrov 56ad091534 Generate synthetic inline class methods in psi2ir 2018-08-14 10:00:21 +03:00
Dmitry Petrov de11d9164d Add IrClass.irInline 2018-08-14 10:00:21 +03:00
Dmitry Petrov 1bfb75a51b Generate intrinsic-based numeric comparison only for FP types 2018-08-03 09:34:59 +03:00
Dmitry Petrov ea710ce607 IrField.isStatic: Update testData for new test 2018-07-31 14:04:04 +03:00
Dmitry Petrov 6dfcf15a39 IR: IrField.isStatic 2018-07-31 13:39:54 +03:00
Mikhail Zarechenskiy acd5b62148 Introduce limited constant conversions for Kotlin/Native
#KT-25320 Fixed
2018-07-29 04:32:32 +03:00
Dmitry Petrov 65fe1101fd Object references in object field initializers are 'GET_VAR this@Object' 2018-07-23 18:16:32 +03:00
Dmitry Petrov ae0704af9c Generate singleton references as GET_OBJECT in nested classes 2018-07-20 16:46:18 +03:00
Dmitry Petrov 779cae7db5 Adjust receivers for possibly synthetic properties access
Synthetic property accessors are treated as extension functions on Java
classes by the front-end. However, underlying Java accessor methods are
proper members.
2018-07-20 16:46:18 +03:00
Dmitry Petrov 99a71b9ecc Desugar synthetic Java properties in psi2ir 2018-07-19 12:34:45 +03:00
Dmitry Petrov 76bfb94538 Add tests for Java synthetic properties in external dependencies 2018-07-19 12:34:45 +03:00
Svyatoslav Scherbina 226f16b44e ir.tree: fix .originalKotlinType for transformed IR types 2018-07-03 09:55:12 +03:00
Ilya Gorbunov 16fb5f6901 Set language and api versions automatically for unsigned types box tests
Remove InlineClasses feature directive from tests
2018-07-03 03:52:18 +03:00
Dmitry Petrov bbcb12ea4b samAdapter test doesn't actually need FULL_JDK 2018-06-29 14:27:57 +03:00
Dmitry Petrov b1d0a5e807 Fix delegated function body generation 2018-06-29 11:24:46 +03:00
Dmitry Petrov 799fcc2606 Fix IrType rendering, update testData 2018-06-29 11:24:46 +03:00
Dmitry Petrov 8999e5bfe6 psi2ir: support unsigned integer literals
NB in FE unsigned integer constants are now represented using signed
integer types (e.g., UInt constant actually holds an Int value).
So, in IR so far we also represent unsigned constant literals as
constant values of corresponding signed types, but with corresponding
unsigned type:
0xFFFF_FFFFu becomes 'CONST Int type=kotlin.UInt value=-1'
2018-06-21 12:32:00 +03:00
Mikhael Bogdanov c588d22e6a Don't sort descriptors in DeclarationStubGenerator
Sorting adds 30% time to test execution
2018-06-21 11:18:35 +02:00
Dmitry Petrov bf083314dd Support 'when' with subject variable in psi2ir 2018-06-20 14:06:34 +03:00
Dmitry Petrov ecd2709a11 psi2ir: type arguments for function references 2018-06-19 11:13:50 +03:00
Roman Artemev 960fba3c4e Fix test failures 2018-06-15 16:23:06 +03:00
Dmitry Petrov 7b1b557250 psi2ir: Java annotations have no primary constructor 2018-05-31 10:09:31 +03:00
Dmitry Petrov 8094cb7dc5 psi2ir: Generate external dependencies in a loop
There are some cases (superclasses, overridden methods, and so on) where
external dependencies generation can require additional external
dependencies.
2018-05-31 10:09:31 +03:00