Commit Graph

38341 Commits

Author SHA1 Message Date
Anton Bannykh 7d7dd3fe97 [JS IR] better tags + bare parameter names 2021-11-19 00:39:29 +03:00
Anton Bannykh f9e62f8ffa [JS IR] expose currentStage via the stageController
Otherwise the signatures for the declarations, created in lowerings,
will be miscalculated.
2021-11-19 00:39:24 +03:00
Anton Bannykh f413d7fd75 [JS IR] make using the original parameter names possible 2021-11-19 00:39:18 +03:00
Anton Bannykh e342ade00a [JS IR] fix inline graph tracker for file-local signatures 2021-11-19 00:39:15 +03:00
Anton Bannykh 56e1c4e38f [JS IR] IrFactory which saves signatures for declarations created in BE 2021-11-19 00:39:12 +03:00
Anton Bannykh e972ad9855 [JS IR] improved missing body reporting for inliner 2021-11-19 00:39:03 +03:00
Anton Bannykh 58bd4ffd71 [JS IR] disable some AST checks for now 2021-11-19 00:38:55 +03:00
Anton Bannykh 953089a4b9 [JS IR] suport SuspendN.invoke functions 2021-11-19 00:38:51 +03:00
Anton Bannykh 1ae042edc3 [JS IR] make old Ir2Js pass all tests 2021-11-19 00:38:46 +03:00
Anton Bannykh d565cc4262 [JS IR] support new Ir2Js in tests and in K2JsTranslator 2021-11-19 00:38:42 +03:00
Anton Bannykh 3c859138d1 [JS IR] support source maps in new Ir2Js 2021-11-19 00:38:33 +03:00
Anton Bannykh a7d8c34927 [JS IR] support generateScriptModule 2021-11-19 00:38:30 +03:00
Anton Bannykh 0506d422a3 [JS IR] support per-module in the new Ir2JS 2021-11-19 00:38:27 +03:00
Anton Bannykh 1f55dc73d2 [JS IR] don't inline property accessors across files 2021-11-19 00:38:24 +03:00
Anton Bannykh 03b9caa439 [JS IR] export external declarations 2021-11-19 00:38:15 +03:00
Anton Bannykh ee8351b9c9 [JS IR] remove unused property 2021-11-19 00:38:11 +03:00
Anton Bannykh 0b0ed5241c [JS IR] remove unused method 2021-11-19 00:38:09 +03:00
Anton Bannykh 3617c1388c [JS IR] improve the hacky fix 2021-11-19 00:38:06 +03:00
Anton Bannykh 46a23c70df [JS IR] hacky fix for local variables name binding 2021-11-19 00:38:03 +03:00
Anton Bannykh e4c668462c [JS IR] fix field namer 2021-11-19 00:38:00 +03:00
Anton Bannykh 5100cb058f [JS IR] local var clashes 2021-11-19 00:37:55 +03:00
Anton Bannykh 05e8bfcd2a [JS IR] split fqn-ish JsNames before resolving temporary names 2021-11-19 00:37:45 +03:00
Anton Bannykh a5d9cb0cc6 [JS IR] copy class models 2021-11-19 00:37:40 +03:00
Ivan Gavrilovic 684273783f Kotlin Gradle Plugin - clean caches for in-process compilation
This is to prevent file handle leaks on Windows. This
commit disposes KotlinCoreEnvironment used during
in-process compilation.

^KT-49772 Fixed
2021-11-18 16:20:10 +01: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
Dmitriy Novozhilov 93378b1a04 [FE 1.0] Resolve private constructors of sealed classes same as for regular classes
^KT-44866
^KT-49729
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
Alexander Udalov 5012aeba7c JVM IR: move codegen out of the main phases
This is needed in order to be able to invoke lowerings and codegen
separately, for cyclically dependent modules (KT-49575).

A side effect is that the two codegen phases are no longer configurable
via the phaser, i.e. absent in the -Xlist-phases and can't be disabled
or made verbose.
2021-11-16 20:20:19 +01:00
Alexander Udalov f701f04326 JVM IR: move jvmPhases to backend.jvm.entrypoint
This will be used for two purposes:
1) call lowerings and codegen separately from
   KotlinToJVMBytecodeCompiler to support cyclical module dependencies
   (KT-49575)
2) split lowerings and codegen into separate modules
2021-11-16 20:20:19 +01:00
Roman Golyshev 79f9bd9c29 Add javadoc to KtAnnotation 2021-11-16 21:34:57 +03:00
Artem Kobzar af924fd3d1 feat: add implicit export support for Kotlin/JS 2021-11-16 16:59:18 +00: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
Dmitriy Novozhilov 2aa027639c [FIR] Fix access to fields from super class
^KT-49654 Fixed
2021-11-16 15:48:08 +03:00
Dmitriy Novozhilov e7c9d76163 [FIR] Use SupertypeSupplier in type resolver for calculating supertypes
This is needed to avoid problems with checking visibility of types which
  are used in supertypes during supertypes resolution in IDE, when
  supertypes of some class can be already computed, but not saved in
  class itself, but still lay in supertypeComputationSession

There were 4 failing tests before this changes (all in
  `DiagnosisCompilerTestFE10TestdataTestGenerated$Tests$Exposed`):
- testInternal
- testInternalAndProtected
- testProtected
- testProtectedSameWay
2021-11-16 15:48:07 +03:00
Dmitriy Novozhilov 499b97d51e [FIR] Fix setting file in supertypes resolution
^KT-49652 Fixed
2021-11-16 15:48:06 +03:00
Svyatoslav Scherbina e11ffc75e4 IR: remove default undefined offsets from createTemporaryVariableDeclaration
Scope.createTemporaryVariableDeclaration has default values for
startOffset and endOffset parameters, which are UNDEFINED_OFFSET.

This is error-prone. Caller should typically be able to pass proper
offsets. If not, let using undefined offsets at least be explicit.

Remove default values for startOffset and endOffset parameters in
Scope.createTemporaryVariableDeclaration
2021-11-16 11:59:56 +00: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
Mikhail Glukhikh fb859c0270 FIR: add error messages for new inference errors 2021-11-16 14:18:25 +03:00
Mikhail Glukhikh 4ad790874e Drop empty FirDefaultErrorMessages.kt 2021-11-16 14:18:25 +03:00
Dmitriy Novozhilov 167a4c6b97 [Build] Add dependency on :core:descriptors.runtime to spec tests
This is needed to run those tests via JPS
2021-11-16 13:29:13 +03:00
Dmitriy Novozhilov 62b774b2e3 [FE 1.0] Properly report INTEGER_OPERATOR_RESOLVE_WILL_CHANGE
^KT-38895
2021-11-16 13:29:12 +03:00
Alexander Udalov 38273e6b3c Minor, remove comments in JvmContentRoots.kt, suppress unused
The kdocs were almost self-evident, as opposed to the fact that
JvmClasspathRoot is unused in the project, which could make it a victim
of an innocent refactoring.
2021-11-16 02:20:52 +01:00
aragos 466acc6132 Allow the usage of virtual JVM content roots in kotlinc (#4645) 2021-11-16 02:20:40 +01:00
Ivan Kochurkin 6ec0d94f1d [FIR] Temporary convert CANNOT_CHECK_FOR_ERASED to warning 2021-11-16 01:07:37 +03:00