Commit Graph

4123 Commits

Author SHA1 Message Date
pyos 8ff79e002e FIR: load parents of Java inner classes first, as before 2021-09-14 19:00:44 +03:00
Roman Artemev 3b53c97c2c [JS IR] Fix test data 'kt -> ir -> klib -> ir -> js' aka prod mode
- fix order in dts tests
 - unmute fixed test in prod mode
 - mute filing expect-actual link test in prod mode
2021-09-13 13:44:46 +03:00
pyos 23420ecf7a IR: do not infer array element types for non-annotation constants
While annotations restrict the set of allowed types to a few final
built-ins, in arbitrary constants we can have array elements that are
some subtype of the array's element type.

 #KT-48671 Fixed
2021-09-10 21:55:15 +02:00
Mikhail Glukhikh fc6403679a Rename !USE_EXPERIMENTAL test directive to !OPT_IN 2021-09-10 16:29:16 +03:00
Mikhail Glukhikh 3febabe977 Use OPT_IN instead of EXPERIMENTAL in diagnostic names 2021-09-10 16:29:13 +03:00
Ivan Kochurkin 55f33999f1 [FIR] Add REPEATED_ANNOTATION, REPEATED_ANNOTATION_WARNING 2021-09-10 00:49:07 +03:00
Alexander Udalov 64b911ea5e JVM IR: do not optimize casts for primitives in TypeOperatorLowering
#KT-48659 Fixed
2021-09-09 15:06:57 +02:00
Igor Laevsky 00f61978b8 WASM: Enable exception handling tests 2021-09-08 19:56:38 +03:00
Igor Laevsky d99473fe4d WASM: Canonicalize catches without finally blocks 2021-09-08 19:56:35 +03:00
Igor Laevsky a246ec636e WASM: Stupidify unit handling
Now every IR instruction returns an actual Unit instance.
All Unit's are actual objects passed around except for function boundaries.
2021-09-08 19:56:29 +03:00
Svyatoslav Kuzmich b79719d6f5 [Wasm] Fix unit issues
- Materialize unit when its value is actually needed.
- Special-case Unit_getInstance return type at codegen. It should be a
  proper Unit object instead of a "void"
2021-09-08 19:56:26 +03:00
Mikhail Glukhikh 20ddaa9ebf Remove redundant upcast in JvmPropertiesLowering
#KT-48621 Fixed
2021-09-08 18:04:36 +03:00
Leonid Startsev 6f954462d6 Implement proper contract for generated java.lang.Annotation.hashCode()
#KT-48606 Fixed
2021-09-08 14:41:25 +00:00
Victor Petukhov 810aee60db Get nested builder inference sessions properly, across delegated inference sessions too
^KT-48445 Fixed
2021-09-08 13:10:50 +03:00
Victor Petukhov 1d9ffebad6 Create resolution context for delegated property resolve as well
^KT-48445 Fixed
2021-09-08 13:10:46 +03:00
Victor Petukhov ce02cd4729 Enable suspend conversions by default in 1.6
^KT-48618 Fixed
2021-09-08 13:09:20 +03:00
Dmitry Petrov d9e4dec810 JVM_IR reuse loop variable as index variable should happen after LDL
We can't apply "reuse loop variable as index variable" transformation
before local declarations lowering, otherwise it will affect captured
loop variable behavior, resulting in KT-48626.

Since it's JVM-specific, move it to JvmOptimizationLowering.
2021-09-06 22:16:40 +03:00
pyos c522543e44 FIR: mute a blackbox test that fails due to another case of #3747 2021-09-06 13:11:17 +03:00
pyos 09c34eaa7b FIR: unmute some more blackbox tests 2021-09-06 13:11:09 +03:00
pyos 03304bce96 FIR: enhance Java type parameter bounds
This also fixes handling of self-recursive types.

TODO: fix jspecify/{strict,warn}Mode/Captured.fir.kt
2021-09-06 13:11:08 +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
Alexander Udalov a06fc20680 JVM IR: erase parameter default value when copying it to bridge
#KT-48391 Fixed
2021-09-03 15:00:44 +02:00
pyos 7ce5556de3 JVM_IR: try to fix SyntheticAccessorLowering.isAccessible again
The condition on the relationship between the current class and the type
of the receiver for protected members was the opposite of what the JVMS
says, and yet somehow mostly worked?

 #KT-48331 Fixed
 #KT-20542 Fixed
2021-09-03 15:54:16 +03:00
Pavel Punegov 5bc6d937e8 [Native][Tests] Ignore test in Native backend
This test fail in the new MM
2021-09-03 10:52:10 +00:00
Dmitry Petrov b669de1663 JVM_IR generate range-based loop closer to Java counter loop
KT-48435 KT-48507
2021-09-03 10:38:20 +03:00
Alexander Udalov 1864716c83 Remove -Xnormalize-constructor-calls
Constructor call normalization is enabled by default since 1.3.
2021-09-02 22:11:22 +02:00
Mikhail Glukhikh 9c8b8f053e FIR: handle named argument properly during annotation serialization 2021-09-02 11:12:48 +03:00
Mikhael Bogdanov 19474ee30f Support large strings in indy-with-constants concatenation
#KT-47917 Fixed
2021-09-01 14:03:56 +00:00
Leonid Startsev 1932546a90 Support instantiation of annotations in JS
#KT-47700 Fixed
2021-09-01 11:13:55 +00: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
Alexander Udalov cc52832943 JVM IR: fix incorrect type of IrCheckNotNull intrinsic
It is not correct to assume that arg0 has been generated to have the
same IrType as the whole expression.

The reason it only backfired in throwing exceptions probably has to do
with the fact that visitThrow might be the only place in
ExpressionCodegen right now which uses the IrType from PromisedValue to
make a decision on whether to generate checkcast.

It seems suspicious that ExpressionCodegen.visitFieldAccess/visitCall
return PromisedValue whose IrType mentions type parameters which are
declared outside of the call site, but that should probably be
investigated separately.

 #KT-48440 Fixed
2021-08-31 18:45:23 +02:00
Dmitry Petrov 1c1b9547c1 JVM_IR KT-48435 use Java-like counter loop when possible 2021-08-31 16:39:25 +03:00
Denis.Zharkov c23de2dae8 FIR: Unignore test on StrictJavaNullabilityAssertions
^KT-48302 Fixed
2021-08-31 15:41:18 +03:00
Denis.Zharkov d91155558b Rename LF: DefinitelyNotNullTypeParameters -> DefinitelyNonNullableTypes 2021-08-31 15:41:17 +03:00
Denis.Zharkov 9e6af52e1f Enable DefinitelyNotNullTypeParameters since 1.7
^KT-26245 In Progress
2021-08-31 15:41:13 +03:00
Denis.Zharkov 302eacbf59 Support new form of definitely non-nullable types: T & Any
^KT-26245 In Progress
2021-08-31 15:41:11 +03:00
Alexander Udalov 04c5bbdcf8 JVM IR: change generation scheme of property $delegate methods
Generate $delegate method as instance method in
PropertyReferenceDelegationLowering, and remove dispatch receiver later
in MakePropertyDelegateMethodsStatic. The method needs to be static to
be non-overridable (see delegateMethodIsNonOverridable.kt), and public
to be accessible in reflection.

Otherwise we generated incorrect IR where a static function accessed an
instance field of the containing class, which failed in multiple places
including LocalDeclarationsLowering.

 #KT-48350 Fixed
2021-08-31 14:07:22 +02:00
pyos 5e4f022c59 JVM_IR: use nullability when boxing/unboxing inline class types
Given inline class V(Any?), a coercion from (Object, V) to (Object, V?)
is boxing.

In theory, the same issue in the old backend can be fixed by making
`KotlinTypeMapper.mapUnderlyingTypeOfInlineClassType` use
`computeExpandedTypeForInlineClass`, but for some reason this breaks a
lot of stuff.

 #KT-48430 Fixed
2021-08-31 12:05:34 +03:00
Alexander Udalov 0b11d4214c Make typeOf stable since 1.6
#KT-45396 Fixed
2021-08-30 19:36:32 +02:00
Ilmir Usmanov 1f8dd45c2b Remove experimental coroutines support. Part 2 2021-08-30 14:21:57 +03:00
Dmitry Petrov c2b575505a JVM_IR KT-48432 fix overflow in const-bound range optimization 2021-08-27 16:42:52 +03:00
Mads Ager 8dee3c1ca0 [JVM] Do not unbox when local variable initialized with null.
This is already the case for straightline code such as

```
inline fun <R> f(size: Int, block: () -> R): R {
    var result: R
    result = block()
    return result
}
```

However, if the local variable introduction happens at a merge
point as in the following example, we allow the unboxing but
only do it halfway. The initialization of the local is still
done with a null value.

```
inline fun <R> f(size: Int, block: () -> R): R {
    var result: R
    while (true) {
        result = block()
        if (size == 0) break
    }
    return result
}
```

This change disallows unboxing for this move complicated
case as well by bailing out if a local use is with a
TaintedBoxedValue (merge of Object and Integer).

^KT-48394 Fixed.
2021-08-26 15:14:02 +03:00
Ilya Goncharov 0ca9e08c11 [JS IR] Add test with fail with vararg call in suspend
^KT-48344 fixed
2021-08-26 08:52:34 +00:00
Ilya Goncharov 4179d078ca [JS IR] Add test on call of suspend super type 2021-08-26 08:50:14 +00:00
Dmitriy Novozhilov 0924216ed2 [FIR] Distinguish stub types for builder inference and for subtyping
^KT-48110 Fixed
2021-08-26 10:08:52 +03:00
Ivan Kochurkin 34cc7e5199 [FIR] Fix resolving to star import member instead of builtin (^KT-48157 Fixed) 2021-08-25 21:53:23 +00:00
Alexander Udalov 8d4f26cf84 IR: use inlineClassRepresentation in getInlineClassUnderlyingType
Looking for the primary constructor manually doesn't work if it's
private in the other module on JVM, because private declarations are
skipped in IrLazyClass.
2021-08-24 12:28:31 +02:00
Mikhail Glukhikh bbb76aae3f Provide more precise check for ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED
#KT-47542 Fixed
2021-08-24 12:32:30 +03:00
Steven Schäfer f05f9882ab IR: Handle annotation instantiations in constructor calls 2021-08-23 23:04:35 +02:00
Steven Schäfer 1b5214a2dc JVM: Fix usage of ClassBuilder API in AnonymousObjectTransformer 2021-08-23 18:25:33 +02:00