Commit Graph

98849 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 79e4df72bf [CLI] Introduce utilities for creating FirSession hierarchy in CLI for all platforms
Also support session creation and compilation for HMPP projects

^KT-56209 Fixed
2023-02-17 11:08:51 +00:00
Dmitriy Novozhilov 30ea4b6b53 [FIR2IR] Adapt IrActualizer to HMPP modules
Previously it collected actual declaration only from platform module
2023-02-17 11:08:51 +00:00
Dmitriy Novozhilov d4bb740a62 [CLI] Store information about HMPP module for source files 2023-02-17 11:08:50 +00:00
Dmitriy Novozhilov 77caa31640 [CLI] Add CLI arguments to pass HMPP module structure to the compiler
^KT-56209
2023-02-17 11:08:50 +00:00
Svyatoslav Scherbina ec59cc050c [K/N][tests] Support tag expressions for :native:native.tests:test
This commits adds a Gradle project property 'kotlin.native.tests.tags',
which can be used when running :native:native.tests:test task to filter
tests by tags. The property value can contain an arbitrary JUnit tag
expression. See
https://junit.org/junit5/docs/current/user-guide/#running-tests-tag-expressions
for more details.
2023-02-17 10:37:04 +00:00
Svyatoslav Scherbina 74c39df0d8 [K/N][tests] Allow running :native:native.tests:test on TeamCity
With this task, we can be more sure that TeamCity runs all the tests.
Other test tasks in :native:native.tests project run only tests with
specific pre-defined tags, so running them on TeamCity was discovered to
be more error-prone in that regard, and is generally less flexible.
2023-02-17 10:37:04 +00:00
Svyatoslav Scherbina 72f9cdf49b Native: fix curl sample test
Don't publish libcurl to a local Maven repo, but consume it directly
as a project dependency.

Publishing appears to be fragile here, and the intention of the test
does not involve checking Gradle anyway.
2023-02-17 10:35:02 +00:00
Svyatoslav Scherbina dd7a1a8c1c [CODEOWNERS] Move kotlin-native/backend.native/tests/**.gradle.kts to Native
These files are in fact tests.
The **.gradle files in this directory are already owned by the
Kotlin Native team.
2023-02-17 10:33:30 +00:00
Ilya Kirillov 4c3672de0a [LL FIR] optimize FirCacheValue, do not create ConcurrentHashMap to store a single value
^KTIJ-24640
^KTIJ-24641
2023-02-17 10:24:20 +00:00
Aleksei.Cherepanov 57da858810 [JPS] Don't use non-optimal Files.exist() in JPS context check on dry start-up
After moving JPS from the IJ repo back to the Kotlin repo, some file operations were accidentally changed to non-optimal ones.

#KTIJ-21161 Fixed
2023-02-17 09:58:00 +00:00
Aleksei.Cherepanov 772745b0ad [JPS] Don't compute compiler args on start-up of the build process
Initialization of compiler arguments takes a long time because of its copying, but for initial context check, there is no need to do it at all for all targets except Common.

#KTIJ-21161 In Progress
2023-02-17 09:58:00 +00:00
Nikolay Lunyak 516efe77c9 [FIR] KT-56612: Fully-expand types when casting bare types
^KT-56612 Fixed

Merge-request: KT-MR-8849
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-02-17 09:15:59 +00:00
Nikolay Krasko 0963bd25a8 Test links reference existing files 2023-02-16 22:56:21 +00:00
Nikolay Krasko 3c6e64b560 Test links definitions in license/README.md 2023-02-16 22:56:21 +00:00
Polina Mitrikovskaia 0484f7b108 Complete license links
Add links for [jspecify].
2023-02-16 22:56:20 +00:00
Matt McClure 800afa8817 Link to Sun, asmble licenses 2023-02-16 22:56:20 +00:00
Nikolay Lunyak 3c36a4fabd [FIR] KT-56665: Filter-out valid cycles
^KT-56665 Fixed

Merge-request: KT-MR-8861
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-02-16 17:48:38 +00:00
Ilya Kirillov c60fd38e05 [LL FIR] allow recursive access to the same FirThreadSafeCache
^KT-56721 fixed
2023-02-16 17:42:29 +00:00
Egor Kulikov d670e5a695 [FIR] Do not get expressions from contract effect list in lazy mode
Eleventh step for ^KT-52615
2023-02-16 17:18:10 +00:00
Leonid Startsev c564dd973b Add declarations from serialization plugin to FIR metadata declarations provider.
These declarations should not be visible to users (and therefore are not added to FIR),
but plugin itself can reference them in already compiled serializable classes,
and therefore they should be available in metadata:

- synthetic deserialization constructor
- static write$Self function

See also:
^KT-55885
2023-02-16 15:36:18 +00:00
Leonid Startsev 8953b25c5b Improve documentation for FIR builders 2023-02-16 15:36:18 +00:00
Sebastian Sellmair 1cce57b50b [Gradle] KT-56712: Add assertions for ide dependencies
^KT-56712 Verification Pending
2023-02-16 13:51:10 +00:00
Sebastian Sellmair b83a490034 [Gradle] MppDependencyProjectStructureMetadataExtractorFactory: Cache on rootProject...
Because composite builds might have isolated classloaders,
therefore caching the MppDependencyProjectStructureMetadataExtractorFactory
on a compositeBuildRoot will lead to ClassCastExceptions

^KT-56712 Verification Pending
2023-02-16 13:51:10 +00:00
Sebastian Sellmair 70a44ccc67 [Gradle] ExtraPropertiesExtension.getOrPut: Use castIsolatedKotlinPluginClassLoaderAware
To provide better error messages for users when this function
fails due to isolated classpaths

... for KT-56712
2023-02-16 13:51:10 +00:00
Sebastian Sellmair 45a99d197a [MPP] MppCompositeBuildIT: Implement sample6-KT-56712-umbrella-composite test
... for KT-56712
2023-02-16 13:51:09 +00:00
Pavel Punegov 83d1de56bf [K/N][build] Add coroutines dependency for bootstrap test
Bootstrap test builds compileKotlin that fails to resolve
coroutines.
2023-02-16 11:56:35 +00:00
Pavel Punegov cc258934c4 [K/N][build] Cleanup obsolete build tasks
* Remove obsolete reporting
* Remove old build tasks: BuildPusher and CollisionDetector
* Gradle build file cleanup
* Remove old wrappers

Merge-request: KT-MR-8788
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
(cherry picked from commit a9cae3fe87)
2023-02-16 11:56:34 +00:00
Alexander Udalov 0e767a7020 Log Kotlin compiler classpath with File.pathSeparator in Gradle
To make it easier to copy-paste it to run the compiler outside of
Gradle.
2023-02-16 11:29:30 +00:00
Alexander.Likhachev 0ab8d07e23 [Gradle] Don't trigger all root project properties evaluation on FUS report
`Project.properties` triggers all the properties computation to return them as `Map`. We should query only for a required property instead.
#KT-56421 Fixed
2023-02-16 11:25:27 +00:00
Marco Pennekamp 5d391bc261 [FIR] KT-56505 Fix checkVisibilityModifier taking wrong modifier list
- KT-56505 occurred because `source.getChild(KtNodeTypes.MODIFIER_LIST)`
  returns any modifier list in the subtree of the source element, not
  necessarily the modifier list belonging to the checked element.
  `depth = 1` restricts the search to the modifier list belonging to the
  checked element itself.
- For example, given `f1` from KT-56505, `getChild` would return the
  modifier list of `public var foo = 0`. Because it contains a
  visibility modifier, `f1` wasn't marked with
  `NO_EXPLICIT_VISIBILITY_IN_API_MODE`.

^KT-56505 fixed
2023-02-16 10:50:48 +00:00
Marco Pennekamp e86c877733 [FIR] Explicit API mode: No REDUNDANT_VISIBILITY_MODIFIER for public
- In explicit API mode, the `public` visibility modifier is not
  redundant unless a declaration is hidden by a container. The
  `REDUNDANT_VISIBILITY_MODIFIER` diagnostic is now not reported in such
  cases.

^KTIJ-24485 fixed
2023-02-16 10:50:48 +00:00
Marco Pennekamp 5909b191a5 [FIR] KT-54507 Report REDUNDANT_MODALITY_MODIFIER for open interface
- `REDUNDANT_MODIFIER_FOR_TARGET` is already reported for `open`
  interfaces, but for consistency and IDE support, the compiler now
  reports `REDUNDANT_MODALITY_MODIFIER` as well via the extended
  checker.
- `REDUNDANT_MODIFIER_FOR_TARGET` cannot be disabled for this case
  because it's reported via a basic checker while
  `REDUNDANT_MODALITY_MODIFIER` is reported via an extended checker.
- Rename `implicitModality` to `redundantModalities` and return a set of
  modalities. The idea of a *single* implicit/redundant modality doesn't
  stand up to scrutiny. For example, for interfaces with `ABSTRACT`
  implicit modality, `OPEN` is also a redundant modifier. But this is
  not necessarily the case for all kinds of declarations.
  Hypothetically, if it was possible to declare a class that is abstract
  by default, adding an `open` modifier to that class would not be
  redundant, as it would make the class instantiable.
2023-02-16 10:50:48 +00:00
Alexander.Likhachev 76ca96d2e2 [Gradle, JS] Apply module name setup regardless of enabled stats
#KT-56705 Fixed
2023-02-16 10:29:23 +00:00
Dmitriy Novozhilov bdf8e6f3a5 [FIR] Extend capacity of ArrayMapImpl until it fits required size
There are cases when we have some indices in TypeRegistry left from
  previous compilations, so registering new service may increase index
  not by one
So such situation is possible:
First compilation (jvm project): register 20 different jvm services in
  session + one from compiler plugin (with index 21)
Second compilation (common project): register only 10 common services in
  session + one from compiler plugin (with index 21)
*numbers are imaginary

And in this situation increasing `ArrayMapImpl.data` size only one time
  may not cover required index

^KT-56685 Fixed
2023-02-16 10:25:20 +00:00
Ilya Chernikov 27db8ce1bb FIR LT: extract syntax diagnostic info from error element
#KT-56701 fixed
2023-02-16 10:21:04 +00:00
Ilya Chernikov e39eb62e6e FIR LT: Fix diagnostic location calculation on the last line
it was calculated incorrectly on the last line that do not end
with EOL.
#KT-56649 fixed
2023-02-16 10:21:03 +00:00
Roman Efremov d120d83d60 Fix navigation in IDE to synthetic methods in compiled Kotlin
For some synthetic methods from compiled Kotlin classes, it is
not possible to find the PsiElement, when navigating to declaration
in the IDE.

For other methods it works like this:
1. There is a SourceElement with a psi inside
2. Or for K1, the element is searched in the decompiled text
   (see ByDescriptorIndexer),
3. Or for K2, the element is searched by Stub taken from metadata
   (see FirDeserializedDeclarationSourceProvider)

However, these approaches do not apply to synthetic methods which have
no SourceElement and are not written into decompiled text and metadata.

These are methods values, valueOf, entries from enum and
copy, equals, hashCode, toString from data classes.

Therefore, it was decided to handle their cases separately
at the resolve stage.

Tests (in idea repository):
- org.jetbrains.kotlin.idea.resolve.ReferenceResolveWithLibTestGenerated#testDataClassSyntheticMethods
- org.jetbrains.kotlin.idea.resolve.ReferenceResolveWithLibTestGenerated#testEnumSyntheticMethods
- org.jetbrains.kotlin.idea.fir.resolve.FirReferenceResolveWithLibTestGenerated#testDataClassSyntheticMethods
- org.jetbrains.kotlin.idea.fir.resolve.FirReferenceResolveWithLibTestGenerated#testEnumSyntheticMethods

^KTIJ-24413 Fixed
2023-02-15 19:56:08 +00:00
Aleksei.Cherepanov f640a7be2e Add the possibility to mute Gradle IC tests by folder
If you need to mute a test for Gradle IC, the only way is to add exclude pattern and regenerate tests aka remove unnecessary tests. But the filter is absolute, so if you have the same test name in different subfolders (e.g. `pureKotlin/classRemoved/` and `classHierarchyAffected/classRemoved`) you cannot disable only one of them. This commit adds logic to specify which name pattern in which subfolder should be excluded
2023-02-15 18:33:27 +00:00
Vladimir Sukharev 1c055b3b23 Use proper way to remove Windows \r char for LF(EOL)
Merge-request: KT-MR-8850
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-02-15 18:08:08 +00:00
Dmitriy Novozhilov 81c1014391 Advance bootstrap to 1.9.0-dev-1777 2023-02-15 16:35:15 +00:00
Jérôme Prinet 24d39ec815 Add task dependency from kotlin-compiler:sourcesJar to :compiler:ir.tree:generateTree
This allows cache hits for `:kotlin-compiler:sourcesJar`

#5094
2023-02-15 17:09:23 +01:00
Justin Paupore fa517180b7 [AA-FIR] Add support for constant evaluation of string templates.
Support FirStringConcatenationCall in FirCompileTimeConstantEvaluator.
This allows string templates ("foo${bar}") to be evaluated as constants,
assuming the interpolated expressions are themselves constant.

In addition, fixes some handling bugs with KtConstantEvaluationMode,
where some expressions that are not valid in a `const val` declaration
were being supported for `CONSTANT_EXPRESSION_EVALUATION`, including
non-static final Java fields in FIR, and composite expressions of
non-const properties in FE1.0.
2023-02-15 16:45:22 +01:00
Simon Ogorodnik 0193c83b05 Modularized tests. Remove obsolete parameters from run configurations
^KT-56075
2023-02-15 15:43:31 +00:00
Simon Ogorodnik a69bc5939f Modularized tests. Remove obsolete PassEventReporter
^KT-56075
2023-02-15 15:43:31 +00:00
Simon Ogorodnik 8a0f3c4f1c Modularized tests. Remove use of -Xuse-k2 argument in FP test
Use just language version to configure frontend, as -Xuse-k2 flag
is deprecated

^KT-56075
2023-02-15 15:43:31 +00:00
Simon Ogorodnik 6ffd3ed970 Modularized tests. Support configuring known compiler plugins in FP test
Construct compiler plugins classpath based on original
compiler arguments
Support of plugins in full pipeline test allows us to test projects
where some common compiler plugins are used without excluding modules

^KT-56075
2023-02-15 15:43:30 +00:00
Simon Ogorodnik 59e69481a3 Modularized tests. Support parsing of original compiler arguments
Now testData contains info about original compiler arguments, which can
be reused to support plugins and various other arguments

Support original arguments in modularized tests
- Properly support JDK9 modules
- Opt-ins from original arguments
- jdkHome from module data or arguments, as well as noJdk option
- Fix friendPaths not configured
- jvmDefault now handled properly

^KT-56075
^KT-55879
2023-02-15 15:43:30 +00:00
Simon Ogorodnik 36c3d62ba1 Modularized tests. Fix java source scope for light tree mode
We should use appropriate java source scope for java files,
not kotlin files

^KT-56075
2023-02-15 15:43:30 +00:00
Simon Ogorodnik 233469d249 Modularized tests. Extract common arguments for full-pipeline tests
^KT-56075
2023-02-15 15:43:29 +00:00
Simon Ogorodnik 780fe4848f Modularized tests. Migrate to JDOM for model loading
Previously org.w3c was used
In order to reuse intellij serialization migrate to JDOM

^KT-56075
2023-02-15 15:43:29 +00:00