Commit Graph

14957 Commits

Author SHA1 Message Date
Jinseong Jeon edc17a9d5f FIR LC: populate no-arg constructor if needed 2021-11-25 12:53:54 +01:00
Dmitry Petrov 88f41d006a FIR2IR don't generate delegates for default interface members 2021-11-25 13:25:36 +03:00
Mads Ager 261482904c [FIR] Give external package fragments different module descriptors.
The inliner uses module descriptors to figure out if it needs to
regenerate objects.

We should avoid the use of descriptors in the inliner, but this
works as a first quick fix.
2021-11-25 13:20:31 +03:00
Ivan Kochurkin f046f2964b [FIR] Add PLATFORM_CLASS_MAPPED_TO_KOTLIN 2021-11-24 23:13:41 +03:00
Ivan Kochurkin 51b73bb6ae [FIR] Add REDUNDANT_NULLABLE diagnostics 2021-11-24 23:13:40 +03:00
Ivan Kochurkin 4caf3c5e83 [FIR] Add NOT_A_CLASS diagnostics 2021-11-24 23:13:40 +03:00
Ivan Kochurkin 3beb447e85 [FIR] Consider anonymous object declarations in classDeclarationsStack in transformers 2021-11-24 23:13:38 +03:00
Ivan Kochurkin b83ed7a6ed [FIR] Fix KtExpression.usedAsExpression for labeled expression 2021-11-24 23:13:37 +03:00
Ivan Kochurkin 2241887b8f [FIR] Drop RESOLVED_TO_UNDERSCORE_NAMED_CATCH_PARAMETER, always resolve to UNRESOLVED_REFERENCE 2021-11-24 23:13:35 +03:00
Dmitry Petrov 91b1814b02 FIR2IR insert implicit cast on elvis RHS 2021-11-24 16:19:11 +00:00
Dmitry Petrov badfade2fd FIR2IR strip FlexibleNullability on IMPLICIT_NOTNULL 2021-11-24 16:19:10 +00:00
Mikhail Glukhikh 0058d7e3d6 Add BB test for problem fixed with c2ab91d0 2021-11-24 15:30:33 +03:00
Mads Ager 8255118204 [JVM] Do not extend local ranges across control-flow merges.
The coroutine method transformer extends the range of locals
across code where the local is not live when it is safe to do
so. However, it only bailed out for one case of control-flow
merging, namely backwards branches for loops. That is not
sufficient as there can be control flow merges without loops
where the local is only defined on one control-flow path.

This change generalizes the bailout to any control-flow merge.

^KT-49834 Fixed
2021-11-23 13:49:45 +01:00
Dmitry Petrov 55d1fdfbc2 JVM_IR prevent clash of unsubstituted special bridges 2021-11-23 12:05:13 +00:00
Dmitry Petrov 2179987de7 FIR2IR fix enum special methods generation 2021-11-23 06:34:33 +00:00
Dmitry Petrov 2a263eca65 FIR2IR strip annotations from IrConst type 2021-11-23 06:34:03 +00:00
Roman Artemev 3bef04cf5e Fix test and unmute it for JVM 2021-11-22 19:00:43 +03:00
Dmitriy Novozhilov 9807c67ae4 [FIR] Properly collect overriddens for method enhancement
If some java class has multiple supertypes then we need to collect
  overriddens from all those types directly, even if superTypeScope
  (which is FirTypeIntersectionScope in this case) returns only
  one symbol from one of this types (not intersection one)

This is needed to proper enhancement in cases when some type occurs
  multiple times in supertypes graph with different nullability
  of arguments:

class ConcurrentHashMap<K, V> : AbstractMap<K!, V!>, MutableMap<K, V>

If we try to find method `get(key: K): V` supertype scope returns
  `AbstractMap.get(key: K!): V!` (because it actually overrides
  `MutableMap(key: K): V?`), but we need to get both symbols to
  properly enhance types for `ConcurrentHashMap.remove`
2021-11-22 17:01:17 +03:00
Ilya Goncharov f48436b35e rra/ilgonmic/eager-like-native
[JS IR] Leave JsEagerInitialization until bootstrap update

[JS IR] Fix js stdlib api

[JS IR] Change annotation on eager initialization in sources

[JS IR] Make eager initialization consistent with native

Merge-request: KT-MR-5030
2021-11-22 12:45:37 +00:00
Ilya Goncharov 24bc1fe1b4 [JS IR] Add test with extending exported interface 2021-11-22 12:40:28 +00:00
Ilya Goncharov 6f3985be47 [JS IR] Add test on frontend check with enum exportness
^KT-49754 fixed
2021-11-22 12:40:28 +00:00
Victor Petukhov a6fd14d4e6 [FE 1.0] Eliminate resolution ambiguity on inherited SAM-interfaces
^KT-17765 Fixed
2021-11-22 14:18:30 +03:00
Victor Petukhov a5c6d370dd [FE 1.0] Eliminate resolution ambiguity with external type parameters
^KT-10926 Fixed
2021-11-22 14:18:29 +03:00
Victor Petukhov 5c3835ab39 [FE 1.0] Don't use identifier in WhenMissingCase.kt if it wasn't provided
^KT-49702 Fixed
2021-11-22 10:44:06 +03:00
Victor Petukhov 42805db989 [FE 1.0] Take into account import aliases during hidden member resolution 2021-11-22 10:43:43 +03:00
Dmitry Petrov e525e25518 JVM KT-47851 fix redundant checkcast elimination 2021-11-20 23:29:19 +03:00
Dmitry Petrov 8b066fd345 JVM add tests for KT-49615 2021-11-20 23:29:18 +03:00
Mikhail Glukhikh cf104c8433 FIR: add status line to all failing black box tests 2021-11-20 03:37:31 +03:00
Sergej Jaskiewicz 060074a9d6 [JS IR] Don't concatenate string template segments with '' when possible
If concatenating with an empty string is a sure no-op, just don't do it.
2021-11-19 11:16:33 +00:00
Roman Artemev 7d8f71d107 [JS IR] Add CLI flag and configuration key about partial linkage
- make possible to turn on/off linkage if klib contains unbound symbols
 - update jsExtraHelp test data
2021-11-19 01:16:32 +03:00
Anton Bannykh 58bd4ffd71 [JS IR] disable some AST checks for now 2021-11-19 00:38:55 +03:00
Anton Bannykh d565cc4262 [JS IR] support new Ir2Js in tests and in K2JsTranslator 2021-11-19 00:38:42 +03:00
Alexander Udalov 1b5e3f5d51 Deserialize repeated annotations inside implicit container
#KT-49651 Fixed
2021-11-18 15:33:34 +01:00
Dmitriy Novozhilov da02d25278 [FE 1.0] Implement deprecation warning for private constructors of sealed classes
^KT-44866
^KT-49729 Fixed
2021-11-18 13:54:05 +03:00
Artem Kobzar d5dd35cb20 feat(@JsExport for interfaces): add ability to export interfaces in TypeScript. 2021-11-18 10:07:38 +00:00
Svyatoslav Kuzmich f833fc4bcb [Wasm] Default parameter values for external functions
+ import top-level external functions wrapped in lambdas
2021-11-17 19:28:14 +00:00
Dmitry Petrov 30ceb49442 JVM_IR KT-48945 generate special bridge with unsubstituted signature 2021-11-17 17:44:01 +03:00
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00
Alexander Udalov a7fef487c1 JVM IR: fix support of cyclic module dependencies
Previous episode was at 987a3460 (KT-45915).

Apparently, it's not enough to run psi2ir for all modules, and then
backend for all modules. If there are several modules in the chunk, IR
in any one of them can reference IR of any other one after psi2ir.

So we would end up in a situation where we're running codegen for the
first module, but the second module is completely unlowered. This would
break some assumptions in the codegen, for example in KT-49575, codegen
would see a reference to a top-level function from another module, and
would fail because the function has no containing class (since file
facades have not been generated yet!), and thus must be an intrinsic,
yet no such intrinsic is known to the codegen.

The solution is to run lowerings first on all modules, and then run
codegen on all modules. The kind of error explained above shouldn't be
possible anymore, because lowerings have to deal both with lowered and
unlowered code from other files all the time, so lowerings can't assume
that reference from other module is lowered either (or unlowered).

The code is not very nice, but hopefully it can be improved as soon as
we get rid of the old JVM backend (and maybe later with the migration to
FIR too).

 #KT-49575 Fixed
2021-11-16 20:20:20 +01:00
Ivan Kochurkin f05436b939 [FIR] Fix false positive case of CANNOT_CHECK_FOR_ERASED
Restore CANNOT_CHECK_FOR_ERASED as error
2021-11-16 18:15:49 +03:00
Alexander Udalov 850d76f6bf Remove error on annotated types as arguments to typeOf
Instead, document that `KType.annotations` returns an empty list for
types created with `typeOf`. Annotations might be supported in the
future.

 #KT-49573 Fixed
 #KT-29919
2021-11-16 15:02:50 +01:00
Svyatoslav Scherbina 2f5706597a IR: fix offsets in irTemporary
The variable generated by IrStatementBuilder.irTemporary doesn't inherit
startOffset and endOffset from the builder. In particular, as a result,
temporary variables generated for elvis operator left operand have
UNDEFINED_OFFSET.

Additionally, ProvisionalFunctionExpressionLowering copies the offsets
of a variable to lowered lambda in the variable initializer. With the
problem described above, this causes invalid debug information in
Kotlin/Native, see KT-49360.

Fix irTemporary by using builder's offsets for the variable.

^KT-49360 Fixed
2021-11-16 11:59:55 +00:00
Dmitriy Novozhilov 62b774b2e3 [FE 1.0] Properly report INTEGER_OPERATOR_RESOLVE_WILL_CHANGE
^KT-38895
2021-11-16 13:29:12 +03:00
Igor Yakovlev a7f0f62f69 [WASM] Generate missing WASM tests and mute failing ones 2021-11-15 19:53:49 +03:00
Igor Yakovlev ee7f4c7278 [WASM] Implementation typeOf support 2021-11-15 19:53:48 +03:00
Igor Yakovlev ce360bb10b [WASM] Implementation of Class references 2021-11-15 19:53:46 +03:00
Igor Yakovlev d9f2bd7963 Revert "[Wasm][Temporary] Stubs for typeOf and ::class constructs"
This reverts commit 8dc81b6c57.
2021-11-15 19:53:45 +03:00
Nikolay Lunyak 2fb066e261 KT-47101: Fix companion supertypes 2021-11-15 13:22:38 +00:00
Steven Schäfer a6dae0b37b JVM IR: Fix value class mangling in SAM wrappers from different modules
KT-49659
2021-11-14 21:52:39 +01:00
Xin Wang b24c3a106e CLI: Allow running class files with '.class' extension in 'kotlin' script
Catch NoClassDefFoundError and print message with cause.

 #KT-11164 Fixed
 #KT-46171 Fixed
2021-11-14 18:50:39 +01:00