Commit Graph

8267 Commits

Author SHA1 Message Date
Dmitriy Novozhilov de7fb9606a Migrate all JDK 9 related tests to JDK 11 2021-09-28 13:01:47 +03:00
Dmitriy Novozhilov ce3562f0e8 Migrate all JDK 15 related tests to JDK 17 2021-09-28 13:01:45 +03:00
Ivan Kylchik cc934d9574 Support arguments' evaluation of primitive arrays in fir2ir transformer 2021-09-27 17:45:01 +03:00
Svyatoslav Kuzmich 5c05ff48ff [Wasm] Copy property reference lowering from K/N 2021-09-27 17:07:39 +03:00
Victor Petukhov ee728b6902 Use the new type inference for top-level callable reference resolution
^KT-47797 Fixed
^KT-47987 Fixed
^KT-45034 Fixed
^KT-48446 Fixed
^KT-13934 Fixed
2021-09-27 16:12:27 +03:00
Dmitry Petrov be28b3c74d JVM_IR KT-29822 KT-48669 loop over unsigned array, indices, withIndex 2021-09-24 12:12:42 +03:00
Dmitry Petrov 2cc6b589f3 JVM_IR KT-48640 generate for-in-downTo as a counter loop 2021-09-24 12:12:41 +03:00
Pavel Kunyavskiy fb875c484d [K/N] Implement instantiating of annotation class 2021-09-23 06:59:34 +00:00
Svyatoslav Kuzmich a2bfcfeae8 [Wasm] Do not erase interfaces down to Any type in Wasm signature.
This enables overloading virtual methods with different interface types
2021-09-22 19:49:44 +03:00
Svyatoslav Kuzmich 6db7154876 [Wasm] Build bridges for non-virtual functions that implement interfaces 2021-09-22 19:49:43 +03:00
Steven Schäfer 1eb9a5a86d JVM IR: Don't generate bridges for default argument stubs (KT-46389) 2021-09-22 18:45:54 +02:00
Leonid Startsev f033d3d5b7 Remove ignored dexing in tests after it was fixed
by rewriting IR codegen (https://github.com/JetBrains/kotlin/pull/3986/files#diff-9fe05d2f7c421d566cd1294a191d5a2e8f6e6f7a5f6b638542b79369caf91d4eR454)
2021-09-22 11:41:13 +00:00
Ilmir Usmanov 11ba620647 Minor. Add tests with arrays in annotations 2021-09-21 21:07:22 +00:00
Ilmir Usmanov e74e267d16 Inline classes. Use inline class instead of underlying type
in annotations if underlying type is not nullable reference type.
Previously, it worked only for inline classes with primitive
underlying type and nullable reference type.

 #KT-44133
2021-09-21 21:07:22 +00:00
Georgy Bronnikov 64e2911b58 JVM_IR: special case for raw types in DescriptorMangleComputer 2021-09-21 21:16:02 +03:00
pyos 783c3d1500 JVM_IR: resolve fake overrides of inline delegated property operators
before checking whether they use the KProperty parameter. (Otherwise the
body is empty and the check always says that the parameter is unused.)

^KT-48825 Fixed
2021-09-21 18:08:22 +02:00
pyos e9d5d9da48 JVM_IR: optimize property accesses in inline lambdas and private funs 2021-09-21 16:41:30 +02:00
Mikhael Bogdanov 72ab6d5e7e Add test for obsolete (fixed in IR) KT-42967
#KT-42967 Fixed
2021-09-21 12:41:07 +02:00
Ilmir Usmanov b0088fd06d Minor. Ignore test on JS_IR 2021-09-20 21:29:58 +00:00
Ilmir Usmanov 91491eef06 Fixup end label of local variable if it is before start label
In that case, put end label to next label after start label.
2021-09-20 21:29:58 +00:00
pyos f786084a0a JVM_IR: mark direct uses of inline lambdas as conditionally suspend
They may or may not be inlined later.

IDK how the test passes when both modules are compiled with the old
backend - perhaps this has something to do with the fact that when `f`
is compiled with the IR backend, the call to `x()` is followed by `pop`
and `getstatic kotlin/Unit.INSTANCE`? This is probably why the original
issue in kotlinx.coroutines reports that everything works fine with
kotlinx-coroutines-core:1.4.3.

^KT-46879 Fixed
^KT-48801 Fixed
2021-09-20 19:29:44 +02:00
Igor Yakovlev 41a69ad388 [WASM] Add receiver capturing to callable references 2021-09-20 19:08:22 +03:00
Pavel Punegov 0b2a8c0c25 [K/N][Test] Ignore test with deprecated StringBuilder.deleteCharAt 2021-09-20 12:16:54 +03: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
Svyatoslav Kuzmich 0abc798da9 [Wasm] Add JS interop tests 2021-09-16 14:20:35 +03:00
Igor Chevdar e194a07358 [tests] Added some tests 2021-09-16 10:54:14 +00:00
pyos 8724bc9525 Add test for KT-48478 2021-09-15 13:23:11 +02:00
pyos 0864f9faf8 JVM_IR: mark inline lambda functions with a special origin
Keeping the origin as LOCAL_FUNCTION_FOR_LAMBDA was a mistake as this
tells codegen nothing. Changing the origin in allows, for example,
removing the hack that detaches inline lambdas from the IR tree before
verification and codegen, or treating inline lambdas and inline
anonymous functions the same way.

This includes fake functions created for inline callable references.

 #KT-48319 Fixed
 #KT-47279 Fixed?
2021-09-15 13:23:11 +02:00
Tianyu Geng e95de0a778 FIR checker: report type mismatch for named vararg arguement
ProhibitAssigningSingleElementsToVarargsInNamedForm is enabled from 1.3
so there is no need to make FIR accepting single element passed through
named arguments.

In addition, we may want to report only
ASSIGNING_SINGLE_ELEMENT_TO_VARARG_IN_NAMED_FORM_FUNCTION and not arg
type mismatch. But FE1.0 is reporting both so I am following it. If we
want to remove the redundant report, we will probably want to remove
FirNamedVarargChecker and report during resolution as a cone diagnostic.
2021-09-15 12:11:36 +03:00
Tianyu Geng 3c84fbcab1 IR: make calls with explicit singleton receiver tailrec [KT-48602] 2021-09-14 23:48:52 +03:00
Tianyu Geng 8525b4932b FIR Checker: check tailrec
Difference from FE1.0
* KT-4285: calls to virtual method with default argument should be
  reported as not tailrec. FE1.0 is missing such cases.
* KT-48600: calls inside lambda should be reported as not tailrec. FE1.0
  also misses such cases.
2021-09-14 23:48:50 +03:00
Alexander Udalov e857966edb JVM: remove support for disabling NoConstantValueAttributeForNonConstVals
This feature is enabled by default since 1.4, which is the earliest
language version supported by Kotlin at this moment.
2021-09-14 22:29:12 +02:00
pyos d07070e184 JVM_IR: avoid redundant accessors in private inline funs
Their call sites are all in the same file, so we can check whether the
declarations used in the inline function are accessible from all the
places where it will be inlined.

 #KT-48736 Fixed
2021-09-14 22:17:10 +02:00
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 df700117c3 Minor: update testData 2021-09-08 09:05:36 +03:00