Commit Graph

130 Commits

Author SHA1 Message Date
Ivan Kochurkin b4fada82ae [FIR2IR] Fix conversion of loops with withIndex 2021-10-25 21:21:42 +03:00
Ivan Kochurkin 31507e7e7e [FIR2IR] Fix origin for desugared blocks (to enable jvm optimization lowering)
Move getIrAssignmentOrigin to ConversionUtils
2021-10-25 21:21:37 +03:00
Denis.Zharkov a0a57581ec FIR: Do not add alias for variables with explicit type 2021-10-20 22:05:24 +03:00
Dmitriy Novozhilov b454fcc1e0 [FIR] Save IR dumps to .ir.txt files instead of .txt in tests
This is needed to avoid clashes between different dumps from different
  handlers
2021-10-12 17:26:36 +03:00
Dmitriy Novozhilov 63d841247c [FIR2IR] Properly setup IrClass.sealedSubclasses 2021-10-09 17:07:36 +03:00
Dmitry Petrov 146f0f4904 JVM_IR KT-41214 emit PermittedSubclasses on JDK17+ 2021-10-09 17:07:35 +03:00
Pavel Kunyavskiy a40022efcd Generate IR for annotation class constructors. 2021-09-23 06:59:33 +00:00
Tianyu Geng 765cad8448 FIR checker: substitute type parameters in dispatch receiver type
Consider the following code:

```
fun test(a: List<String>) {
  a.first()
}
```

The dispatch receiver type of `first` in this case is `List<T>` before
this change. After this change, it's `List<String>`.

In addition, this change also replace the dispatch receiver type with
the more specific type if available. For example, consider the following

```
class MyList: ArrayList<String>()

fun test(a: MyList) {
  a.get(0)
}
```
The dispatch receiver type of `get` is `MyList`, instead of
`ArrayList<String>`. That is, a fake override is created in this case.
2021-09-17 01:59:06 +03:00
Mikhail Glukhikh fc6403679a Rename !USE_EXPERIMENTAL test directive to !OPT_IN 2021-09-10 16:29:16 +03:00
pyos a475453a01 FIR: enable useCorrectedNullabilityForFlexibleTypeParameters
It's necessary for correct substitution of `T & Any` with `T = V..V?`.
2021-09-06 13:11:16 +03:00
pyos 5355d04553 FIR: enhance in/out-variant type arguments 2021-09-06 13:11:03 +03:00
pyos 8e122397b0 FIR: fix type index computation during enhancement
1. in/out type parameters count;
2. star projections take up 1 space in the tree.
2021-09-06 13:11:02 +03:00
pyos 5fec9f34b1 FIR: revert a hack that allows overriding T!! with T
1. this should've been only done if the language feature for validating
    that is disabled;

 2. that feature probably won't matter by the time FIR is stable;

 3. it only worked because type enhancement of type arguments is broken
    anyway - a more correct hack would be to provide a custom
    ConeTypePreparator.
2021-09-06 13:11:01 +03:00
Alexander Udalov ffe0d9de70 Psi2ir: do not sort descriptors for fake override generation
Descriptors are already supposed to be sorted in scopes. The problem is
that rendering descriptors for sorting takes a lot of time (~1.5% of
total compilation time of intellij with JVM IR), and simple heuristics,
like comparing by names first, don't fully help with it.

 #KT-48233
2021-08-31 20:25:59 +02:00
Denis.Zharkov 753ba99b04 FIR: Support enhanced types when checking if Java type is primitive 2021-08-17 21:38:01 +03:00
Ilya Chernikov 8f5d5c3ace FIR: Fixes in testdata after implementing FIR-specific IrBuiltIns 2021-07-16 02:24:29 +03:00
Dmitry Petrov 8ea4916d64 JVM_IR KT-47739 recognize fake override external stubs 2021-07-15 19:20:39 +03:00
Dmitriy Novozhilov ae608ea67f [FE 1.0] Always create return value for CallInstruction
This fixes missing `USED_AS_EXPRESSION` recordings
^KT-47527 Fixed
2021-07-02 17:55:20 +03:00
Alexander Udalov 7306256127 JVM IR: support mutability-flexible types 2021-07-01 19:33:55 +02:00
Denis.Zharkov a213ee0e01 FIR: Rework delegated scope
Now delegated members are generated just to declared scope

^KT-47413 In Progress
2021-07-01 17:49:29 +03:00
Andrey Zinovyev d360932ebc [FIR] Fill overriddenSymbols for fake overridden IrProperty 2021-06-17 13:24:12 +03:00
Roman Artemev bbcd511c44 [TEST] fix irText testData
- support DELEGATED_MEMBER overrides
2021-06-16 21:16:48 +03:00
Roman Artemev 14c91ca0de [TEST] Set proper TARGET_BACKEND for jvm-specific irText tests 2021-06-16 21:16:43 +03:00
Mikhail Glukhikh 77dd0ad396 FIR: handle custom attributes more precise 2021-06-09 15:42:37 +03:00
Denis.Zharkov 18e93b50d9 FIR: Fix loading read-only collection Java types with incorrect variance 2021-06-07 15:25:56 +03:00
Mikhail Glukhikh a255f44d6e FIR2IR KT-46578 add overridden properties generation 2021-05-14 16:20:20 +03:00
Dmitry Petrov 53c1de172f IR KT-46578 add IrProperty#overriddenSymbols 2021-05-14 16:20:18 +03:00
Tianyu Geng d4717569b9 Fix inferred type of FirGetClassCall
The inferred type should be `KClass<out Blah>` for `FirGetClassCall`
invoked on expressions.
2021-05-06 17:50:33 +03:00
Mikhail Glukhikh f278de8768 FIR: don't call toString() inside string concatenations 2021-04-26 12:50:55 +03:00
Mikhail Glukhikh 9f27362ee1 Match triangle & diamond intersections in FirTypeIntersectionScope 2021-04-02 10:24:20 +03:00
Jinseong Jeon 81999117dc FIR2IR: force return type of loop body block as Unit 2021-04-01 20:07:49 +03:00
Jinseong Jeon 7898d167f3 FIR2IR: wrap do-while loop in IrBlock
"so that variables declared in loop body are not visible outside of the
loop" (from commit d096f1d)
2021-04-01 20:07:47 +03:00
Dmitriy Novozhilov d0a148074f [FIR2IR] Fix generating body for for-loop 2021-03-30 12:28:15 +03:00
Dmitriy Novozhilov f4afc2ef44 [FIR] Map dispatch receiver type of function in JvmMappedScope 2021-03-24 12:56:16 +03:00
Mikhail Glukhikh ebfc431733 FIR body resolve context: fix accessor scope handling 2021-03-17 12:13:23 +03:00
Dmitriy Novozhilov 3d1f4b8386 [FIR] Don't add @EnhancedVisibility to types with @Nullable annotation 2021-03-15 12:13:06 +03:00
Dmitriy Novozhilov 65ea4e184a [FIR] Fix enhancement of FlexibleNullability and EnhancedNullability
- Add utilities to add new attribute to ConeAttributes
- Get rid of FlexibleNullability attribute (it can be easily inferred
    for any flexible type at any moment)
- Fix determining of EnhancedNullability attribute
2021-03-11 13:10:04 +03:00
Dmitriy Novozhilov da0fd7cc15 [FIR2IR] Approximate non-denotable types when converting ConeType to IrType 2021-03-02 19:11:21 +03:00
Dmitriy Novozhilov af79265f42 [FIR] Fix creating overrides for functions with name same as renamed in JVM builtins 2021-03-02 19:11:15 +03:00
Denis.Zharkov 377a0aa237 FIR2IR: Adjust test data for updated overridden structure 2021-02-20 10:59:22 +03:00
Mikhail Glukhikh 7050af9b79 FIR2IR: use invariant projections for SAM_CONVERSION types 2021-02-11 11:48:34 +03:00
Mikhail Glukhikh d4b0688690 FIR: introduce delegate field initializers
Before this commit we initialized delegate fields in primary constructor,
that could provoke NPE in case delegate is used in initializer of
some property backing field.
Now we initialize delegate fields directly instead.
2021-02-08 14:28:27 +03:00
Mikhail Glukhikh 694d69fbfa FIR2IR: select return target inside accessor properly 2021-02-08 14:28:24 +03:00
Mikhail Glukhikh 465261e611 FIR: don't create intersection override for duplicating symbols 2021-02-02 16:25:08 +03:00
Denis.Zharkov 1e0d9f4075 FIR2IR: Do not add implicit casts for types with different nullability
For smart casts, elvises, etc., there are no implicit casts in psi2fir
in changed test data
2021-01-29 10:50:22 +03:00
Denis.Zharkov 5c62ee4ba8 FIR2IR: Fix complex cases of smart cast expressions used as dispatch receiver
It might be not only <ExpressionWithSmartCast>(a).foo(), but also
id(<ExpressionWithSmartCast>(a)).foo() and many other cases
2021-01-29 10:50:22 +03:00
Mikhail Glukhikh ce1f9882df FIR2IR: Fix mapping for intersection overrides of deserialized functions 2021-01-27 15:42:04 +03:00
Mikhail Glukhikh 1a4b327210 FIR2IR: fix smart casts in case field is accessed 2021-01-26 12:27:09 +03:00
Mikhail Glukhikh 1c9064836e FIR2IR: fix intersection type smart cast when synthetic property accessed 2021-01-26 12:26:50 +03:00
Denis.Zharkov 3a3d2ee3e9 FIR2IR: Fix mapping for intersection overrides of deserialized properties 2021-01-25 12:29:31 +03:00