Commit Graph

109432 Commits

Author SHA1 Message Date
Ilya Chernikov 6288bdbd3f K2 scripting, IDE: add missing extension registration
The commit "K2 scripting: treat default import similarly to K1"
introduced the new extension that provides default imports for scripts,
instead of the previous approach of explicit `FirImport` elements
creation. But registering it for the IDE case was forgotten. This
commit adds missing registration.

#KTIJ-28960 fixed
2024-02-29 12:35:18 +00:00
Artem Olkov ac403a466e add support for classes with packages #KT-65909 fixed
Merge-request: KT-MR-14623
Merged-by: Artem Olkov <artem.olkov@jetbrains.com>
2024-02-29 12:04:23 +00:00
Wojciech Litewka 4d2aadb925 [IR] Remove old @IDEAPluginsCompatibilityAPI constructor 2024-02-29 11:22:57 +00:00
Alexander Udalov 939a74add3 CLI: improve error message for -Xjdk-release=1.6/1.7
#KT-66174 Fixed
2024-02-29 11:05:20 +00:00
Alexander Udalov 5f261d3ad0 CLI: fix "unknown JVM target version" error message
Do not list 1.6 as supported because it was removed in KT-45165.

 #KT-66175 Fixed
2024-02-29 11:05:20 +00:00
eugene.levenetc e65caee26b [ObjCType] Add vararg translation
KT-66056
2024-02-29 10:24:40 +00:00
Alexander Udalov dfd9aabf8e JVM: update test data after enabling IR fake override builder
#KT-61514 Fixed
2024-02-29 10:14:31 +00:00
Alexander Udalov f98a22e8e4 Fir2Ir: enable IR-based fake override builder
Invert the logic of IR/FIR2IR-based generators: change the CLI argument
to -Xuse-fir-fake-override-builder, test directive to
USE_FIR_BASED_FAKE_OVERRIDE_GENERATOR, etc.

The changes in test data caused by using IR fake override builder by
default are in the subsequent commit.

 #KT-61514
2024-02-29 10:14:31 +00:00
Mikhail Glukhikh 09db7dbd22 K2: add tests to confirm current behavior of KT-65679 examples 2024-02-29 10:02:06 +00:00
Artem Kobzar 4f4c98ec73 [K/JS] Allow parameter properties inside external declarations ^KT-65965 Fixed 2024-02-29 09:46:59 +00:00
Kirill Rakhman 5e83350576 [Infrastructure] Assert dumps don't exist without directive
#KT-58697 Fixed
2024-02-29 08:36:16 +00:00
Andrey Yastrebov 42f6eb4eb4 KT-66156 add KotlinRuntime to Swift Export Synthetic 2024-02-29 08:11:29 +00:00
Jaebaek Seo a17ad6bc55 Fix K2 CodeGen annotation parameter resolution failure
When we have parameters of annotation like
```
// FILE: Anno.kt
package p3

@Target(AnnotationTarget.FUNCTION)
annotation class Anno(vararg val x: String)

// FILE: main.kt
import p3.Anno

@Anno("A", "B")
fun foo(): Int = 10
```
the K2 CodeGen causes an exception reporting the unresolved type
reference. A lazy resolution call fixes the issue.

In addition, FIR for the value parameter to IR conversion fails because
`Fir2IrLazyProperty` for the value parameter tries to resolve the
initializer before creating the `IrParameterSymbol`. When it checks the
`localStorage`, it reports an error for the missing `IrParameterSymbol`.
This commit adds `IrParameterSymbol` before resolving the initializer.

^KT-65099 Fixed
2024-02-29 06:44:05 +00:00
Yahor Berdnikau 3511733aa7 [Gradle] Deprecate kotlinOptions in KotlinNativeLinkArtifactTask task
^KT-63419 Verification Pending
2024-02-28 21:20:18 +00:00
Yahor Berdnikau 48a84e5b79 [Gradle] Deprecate kotlinOptions in KotlinNativeLinkArtifactTask task
^KT-63419 In Progress
2024-02-28 21:20:18 +00:00
Yahor Berdnikau 6719a437f7 [Gradle] Deprecate kotlinOptions in KotlinNativeLink task
^KT-63419 In Progress
2024-02-28 21:20:18 +00:00
Yahor Berdnikau 6e874340e9 [Gradle] Deprecate Kotlin*Options types
^KT-63419 In Progress
2024-02-28 21:20:18 +00:00
Yahor Berdnikau 4921a29aa5 [Gradle] Deprecate dceOptions in KotlinJsDce task
^KT-63419 In Progress
2024-02-28 21:20:18 +00:00
Yahor Berdnikau 24acf800d6 [Gradle] Deprecate KotlinCompile DSL
^KT-63419 In Progress
2024-02-28 21:20:18 +00:00
Yahor Berdnikau 2f70478e67 [Gradle] Deprecate kotlinOptions DSL in KotlinCompile DSL
^KT-63419 In Progress
2024-02-28 21:20:18 +00:00
Yahor Berdnikau 433bec3700 [Gradle] Deprecate kotlinOptions DSL in KotlinCompilation
^KT-63419 In Progress
2024-02-28 21:20:18 +00:00
Yahor Berdnikau 2e3a209d0d [Gradle] Fix usages of kotlinOptions in BuildKotlinToolingMetadataTask
Replaced them with compiler options DSL.

^KT-63419 In Progress
2024-02-28 21:20:18 +00:00
Yahor Berdnikau 66a39952ee [Gradle] Fix usages of kotlinOptions in KotlinJsIrTarget
Replaced them with compiler options DSL.

^KT-63419 In Progress
2024-02-28 21:20:18 +00:00
Yahor Berdnikau 0986733f29 [Gradle] Remove unused method
^KT-63419 In Progress
2024-02-28 21:20:18 +00:00
Marco Pennekamp beb40484dd [LL] Add LLFirSession invalidation tests
- This commit moves all session invalidation tests from the IDE which
  are non-cyclic to the Analysis API. Cyclic session invalidation tests
  cannot be moved because the Kotlin test infrastructure doesn't support
  cyclic module dependencies.
- In fact, these new tests cover more cases, because the IDE tests only
  covered global module state and module out-of-block modification
  events. Crucially, global source modification events are now
  supported, which require libraries to be left alone.
- Module out-of-block modification for libraries is technically
  undefined, but the test still checks this behavior. The current
  session invalidation implementation behaves the same for any kind of
  module-level modification event, so it is possible to publish a module
  OOBM event for libraries. If this changes in the future, we can
  disable those tests. But for now, it's good that these tests run,
  because they will alert us to (accidental) changes to this behavior.

^KT-56288 fixed
^KT-65265 fixed
2024-02-28 21:08:18 +00:00
Marco Pennekamp 56a08319ec [AA] Add toString implementation for KtLibraryModuleImpl
- This allows stable mentions of test module libraries in output test
  data.

^KT-56288
2024-02-28 21:08:18 +00:00
Marco Pennekamp 56fd4b562b [AA] Improve modification event test directives
- Rewrite `TestModule.publishModificationEventByDirective`: we can get
  the `KtModule` to publish an event for via the test module. The
  directive can now be made optional, which is necessary when we want to
  specify it in potentially multiple modules.
- Introduce the `WILDCARD_MODIFICATION_EVENT` directive, which allows
  specifying THAT some modification event should be raised for a module,
  but not WHICH one. This allows generating multiple tests which raise
  different modification events over the same test data.
- Add various convenience functions for publishing wildcard modification
  events. `publishWildcardModificationEventsByDirective` for the test
  module structure is quite opinionated, but takes a lot of work from
  test implementations.
- Because `ModificationEventDirectives` are part of the analysis test
  framework, we register them as a general Analysis API test directive.

^KT-56288
2024-02-28 21:08:17 +00:00
Marco Pennekamp 3044941201 [AA] Add TestModule.getKtModule convenience function
^KT-56288
2024-02-28 21:08:17 +00:00
Timofey Solonin 1435fcc50f Add an IT for consumption of multiplatform resources
^KT-65540
2024-02-28 20:19:08 +00:00
Timofey Solonin 2fda16f526 Add APIs to resolve multiplatform resources in variant publications
^KT-65540
2024-02-28 20:19:08 +00:00
Sonya Valchuk 4c8febf10d FIR DFA: slightly refactor smart cast state tracking
Instead of always looking up smart casts on `lastNode` and separately
tracking the receiver state, simply track which flow the smart casts
belong to right now. This tracked flow is auto-advanced when new
`lastNode`s are created, but can be manually rolled back for things like
KT-63709.
2024-02-28 18:36:08 +00:00
Nikita Bobko 052baf1b04 Revert "[FIR] Enable ForbidInferringTypeVariablesIntoEmptyIntersection in 2.0"
^KT-66196 Fixed
Keep it a warning in 2.0

This reverts commit be232d3e6f.
2024-02-28 18:08:11 +00:00
Alexander Shabalin 5c2017fa5f [K/N] Fix CC in Xcode usage ^KTI-1553
- Perform all calls to xcrun in XcodeValueSource.
- Use the fully computed Xcode instance as the current Xcode instance.
- Hide all of this inside a Gradle plugin and apply it to kotlin-native
  project.
2024-02-28 17:58:41 +00:00
Dmitrii Gridin f246d1c037 [LL FIR] introduce NonLocalAnnotationVisitor
- Unified and optimized visitor instead of transformer with many
  redundant operations.
- `LLFirAnnotationArgumentsTargetResolver` now has the correct state
  keeper for nested declarations – e.g., property accessors or value
  parameters.
- `FirAllLazyAnnotationCalculatorVisitor` in tests now almost the same
  as in the production as now it uses the same visitor without recursive
  visiting

^KT-63606 Fixed
^KT-64000 Fixed
^KT-64579 Fixed
2024-02-28 17:10:33 +00:00
Dmitrii Gridin 410dbcb4cf [LL FIR] LLFirTypeLazyResolver: add missed type checks for context receivers 2024-02-28 17:10:33 +00:00
Dmitrii Gridin 7048184acf [LL FIR] LLFirAnnotationArgumentsLazyResolver: add missed checks for context receivers 2024-02-28 17:10:33 +00:00
Dmitrii Gridin fe4ead751f [LL FIR] LLFirTargetResolver: do not resolve file annotation container before each declaration
We don't have to resolve `FirFileAnnotationsContainer` before each
declaration.
This became possible after KT-65345 as now `FirDesignation` has `FirFile`
in its path so, `PersistenceContextCollector#collectContext` resolves
it as well as we don't have problems with unresolved annotations
during diagnostics processing

^KT-65876
2024-02-28 17:10:32 +00:00
Dmitrii Gridin dc898fdf5c [LL FIR] LLFirTargetResolver: add missed checkThatResolvedAtLeastToPreviousPhase check for jumping phase 2024-02-28 17:10:32 +00:00
Artem Kobzar 6a2e785abd [K/JS, TEST] Enable TS export tests for FIR ^KT-64421 Fixed 2024-02-28 16:52:27 +00:00
Timofey Solonin 55e61f6631 [Native] Support Xcode 15.3 — add back the TargetConditional.h macros
^KT-65542
2024-02-28 16:38:37 +00:00
Roman Golyshev 69426e2129 [kotlin] Add a small KDoc to getAllSuperClassifiers function 2024-02-28 16:16:40 +00:00
Igor Yakovlev a5ef668e3c [Wasm] Boolean boxed instances are the same
Fixed #KT-65411
2024-02-28 15:23:21 +00:00
Timofey Solonin a171f774be Validate that resources from new source sets are published 2024-02-28 15:22:58 +00:00
Timofey Solonin 01ff4a597a Validate consuming a project with multiplatform resources
^KT-65540
2024-02-28 15:22:58 +00:00
Timofey Solonin 0f20e39475 Add an IT for publication of multiplatform resources in wasm target
^KT-65540
2024-02-28 15:22:58 +00:00
Timofey Solonin e35e2eaa48 Add an IT for publication of multiplatform resources in a native target
^KT-65540
2024-02-28 15:22:58 +00:00
Timofey Solonin b145796e14 Publish multiplatform resources as variants for wasm, js and native targets
^KT-65540
2024-02-28 15:22:58 +00:00
Kirill Rakhman 5bbec23123 [Test gen] Consolidate file reads for checking directives 2024-02-28 15:20:30 +00:00
Kirill Rakhman 3c23319f70 [Test gen] Remove duplicate checks if file is equal to some string 2024-02-28 15:20:30 +00:00
Kirill Rakhman cba65d7186 [Test gen] Reduce string copying 2024-02-28 15:20:30 +00:00