Commit Graph

87494 Commits

Author SHA1 Message Date
sebastian.sellmair bec2f89a07 [Gradle, MPP] Fix 'getCommonizerTarget' for source sets participating in multiple compilations of the same konanTarget
The previous implementation would return a 'SharedCommonizerTarget'
containing just a single leaf target. This would trigger the commonizer.
The new implementation will correctly return just a single
LeafCommonizerTarget instead.

^KT-49735 Verification Pending
2021-11-16 23:07:47 +00:00
konstantin.tskhovrebov cb37424831 Update K/N to "1.6.20-dev-5356". 2021-11-16 23:10:10 +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
Elena Lepilkina c06875b8e9 [K/N] Added test for exceptions behaviour in case of dynamic libs (KT-47828) 2021-11-16 10:44:53 +00: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
Pavel Kunyavskiy 21444d6be8 [K/N] Optimize and get rid of recursion in SCC search in Devirtualization 2021-11-16 08:27:41 +00: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
Nikolay Krasko 4dc45a4118 Drop sources and javadoc artifacts for kotlin-test-wasm
There's a source and javadoc validation in sonatype that
once *-sources.jar or *-javadoc.jar is found expect main
jar must be present as well.

This doesn't work when instead of jar we publish klib.
2021-11-15 19:54:56 +03:00
Igor Yakovlev 71bf36b613 [JS] Fix test testdata for InlineMultiFile.testTrait test 2021-11-15 19:53:50 +03:00
Igor Yakovlev a7f0f62f69 [WASM] Generate missing WASM tests and mute failing ones 2021-11-15 19:53:49 +03:00
Igor Yakovlev ec9fcce1bc [WASM] Add hashCode, equals and toString to KClass and KType implementations 2021-11-15 19:53:48 +03:00
Igor Yakovlev ee7f4c7278 [WASM] Implementation typeOf support 2021-11-15 19:53:48 +03:00
Igor Yakovlev 39a389c49a [WASM] Implementation qualifiedOrSimpleName 2021-11-15 19:53:47 +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
sebastian.sellmair 7d56ef1925 [Gradle, MPP] Implement kotlin.mpp.absentAndroidTarget.nowarn flag
^KT-41641 Verification Pending
2021-11-15 16:15:18 +00:00
sebastian.sellmair c56c503426 [Gradle] Implement 'Project.kotlinPropertiesProvider' extension
This extension should increase discoverability over the previous
'PropertiesProvider(project)' API
2021-11-15 16:15:17 +00:00
sebastian.sellmair 373dcef45d [Gradle, MPP] Mention multiplatform in absent android target warning
^KT-41641 Verification Pending
2021-11-15 16:15:17 +00:00
sebastian.sellmair bf04f821d6 [Gradle, MPP] Print warning on absent 'android' targets
^KT-41641 Verification Pending
2021-11-15 16:15:16 +00:00
sebastian.sellmair db21bfe13b [Gradle, MPP] findAndroidTarget: Return null when missing
Prior to this change a 'Collection is empty.' error was reported
when the Android plugin was applied without an Android Kotlin target
being registered.

^KT-41641 Verification Pending
2021-11-15 16:15:16 +00:00
Igor Laevsky c7cfa97748 [Wasm] Implement Any::hashCode() 2021-11-15 18:26:46 +03:00
Igor Laevsky 9e00a2c5b4 [Wasm] Implement platform random in stdlib 2021-11-15 18:26:45 +03:00
Igor Laevsky 1bdc9edb20 [Wasm] Implement Jasmine adapter for kotlin.test 2021-11-15 18:26:44 +03:00
Dmitriy Dolovov 7ed3941580 [Native][tests] Update generated tests 2021-11-15 18:24:58 +03:00
Dmitriy Dolovov 503f159f4d [Native] External tests: Preserve original line offsets 2021-11-15 18:15:43 +03:00
Dmitriy Dolovov cc667189ec [Native] External tests: Don't clean up test directives
This does not make sense anymore since external test data files are patched during test execution on the fly.
2021-11-15 18:15:43 +03:00
Dmitriy Dolovov 61b8fb8fc2 [Native][tests] Allow overriding test properties via Gradle properties 2021-11-15 18:15:43 +03:00
Dmitriy Dolovov a029b50755 [Native][tests] Enable codegen_box_callableReference/genericConstructorReference.kt 2021-11-15 18:15:42 +03:00
Dmitriy Dolovov 4900aa673b [Native][tests] Fix formatting of error message about failed test 2021-11-15 18:15:42 +03:00
Dmitriy Dolovov 9c70d5088c [Native][tests] Don't warn when committed TestFile is committed again
Actually, there is nothing wrong with calling commit() again: Some TestFiles are created as uncommitted and require calling commit(), while others are created as committed from the very beginning.
2021-11-15 18:15:42 +03:00
Dmitriy Dolovov 407e82adbb [Native][tests] Minor. Make computePackageName() a bit more comprehensive 2021-11-15 18:15:42 +03:00
Dmitriy Dolovov e30f33b18d [Native][tests] Minor. Prefer to use raw string literals for better readability 2021-11-15 18:15:42 +03:00
Dmitriy Dolovov e5bb16c750 [Native][tests] Minor. Comments formatted 2021-11-15 18:15:42 +03:00
Dmitriy Dolovov 24f00f8fda [Native][tests] Warn when committed TestFile is committed again 2021-11-15 18:15:42 +03:00