Commit Graph

108384 Commits

Author SHA1 Message Date
Yahor Berdnikau d0b0774c6d [Gradle] Fix warnings in KotlinBrowserJsIr
^KT-56904 In Progress
2024-01-30 11:49:07 +00:00
Yahor Berdnikau f4d9d98a5e [Gradle] Fix warnings in D8Exec
^KT-56904 In Progress
2024-01-30 11:49:07 +00:00
Yahor Berdnikau 5cf1572995 [Gradle] Fix warnings in KotlinJsCompilation
^KT-56904 In Progress
2024-01-30 11:49:07 +00:00
Yahor Berdnikau 0f29ae48ee [Gradle] Fix warnings in InternalKotlinTargetPreset
^KT-56904 In Progress
2024-01-30 11:49:07 +00:00
Marco Pennekamp 9a4bf0601e [AA] Add KtClass-based KotlinSealedInheritorsProvider
- The compiler's `SealedClassInheritorsProvider` should not be exposed
  outside LL FIR, as it is an internal compiler component and also
  exposes `FirRegularClass`. `KotlinSealedInheritorsProvider` is an
  Analysis API provider for sealed inheritors that accepts a `KtClass`
  instead.

^KT-64718 fixed
2024-01-30 11:48:09 +00:00
Yan Zhulanow e001fa4e72 [Analysis API] Explicitly specify the context module in a directive 2024-01-30 11:41:26 +00:00
Yan Zhulanow 892212bdf6 [Analysis API] Add type code fragment test for a local class 2024-01-30 11:41:26 +00:00
Yan Zhulanow 3cd04a9e9e [Analysis API] Migrate existing code fragment tests to the new API 2024-01-30 11:41:26 +00:00
Yan Zhulanow ef890e9b76 [Analysis API] Add reference resolution tests for code fragments 2024-01-30 11:41:26 +00:00
Yan Zhulanow c548bed6f6 [Analysis API] Fix 'getContainingDeclaration()' for code fragments
^KT-65075 Fixed
2024-01-30 11:41:26 +00:00
Yan Zhulanow 1c883c93fc [Analysis API] Minor, prettify 'getContainingPsiDeclaration()' 2024-01-30 11:41:26 +00:00
Yan Zhulanow 83ad6eca08 [Analysis API] Minor, prettify 'hasParentSymbol()' 2024-01-30 11:41:26 +00:00
Yan Zhulanow 01ca31a061 [Analysis API] Add test infrastructure for code fragments
Now, Analysis API tests can define modules with code fragments.
The preceding module will be used as a context module.
2024-01-30 11:41:26 +00:00
Yan Zhulanow 7298289e4e [FIR] Support type code fragments in 'PsiRawFirBuilder'
For type code fragments, which essentially contain a single type
reference, we add a single statement 'null is Type'.

^KT-61332 Fixed
2024-01-30 11:41:26 +00:00
Ilya Goncharov 0350533189 [Gradle, JS] Do not use project on execution phase 2024-01-30 10:38:09 +00:00
Jinseong Jeon 42e8245007 AA: take into account type arguments if available
...when computing receiver type for double colon expression
2024-01-30 06:57:27 +00:00
Jinseong Jeon 2429d09edd AA: use explicit qualifier type if available
...when computing receiver type for double colon expression

^KT-65150 fixed
2024-01-30 06:57:27 +00:00
Sergej Jaskiewicz 2277c1ba97 [FIR] Fix metadata dump in a compiler plugin-related test
The previous commit also fixed the inconsistency between the test and
production compiler configuration, which led to the metadata dump in
this test to be correct.

See the commit message of 49071374b4
for details.
2024-01-29 21:07:43 +00:00
Sergej Jaskiewicz f39335b3f7 [klib] Don't pass around metadata serialization closure
Pass the metadata serializer instance instead. This allows to further
reduce code duplication by introducing the common interface
`KlibSingleFileMetadataSerializer` for abstracting away K1 and K2
representation of a source file, as well as reusing
`Fir2KlibMetadataSerializer` across different backends.

KT-64392
2024-01-29 21:07:43 +00:00
Sergej Jaskiewicz 5a6f51e474 [klib] Move KlibMetadataSerializer to serialization.js
It's used only in JS compilation.
2024-01-29 21:07:43 +00:00
Sergej Jaskiewicz abc53b2ee3 [klib] Inline the makeSerializedKlibMetadata function
It's used in only one place, and it doesn't really make the code easier
to read.
2024-01-29 21:07:43 +00:00
Sergej Jaskiewicz 93a1ceae75 [klib] Deduplicate KLIB serialization logic in K/JS and K/N
Introduce the new `serializeModuleIntoKlib` function that all KLIB-based
backends can use to serialize a module to a KLIB.

^KT-64392 Fixed
2024-01-29 21:07:43 +00:00
Sergej Jaskiewicz c335cd0b1e [IR] Remove unused IrMessageLogger from serialization logic 2024-01-29 21:07:43 +00:00
Sergej Jaskiewicz f88d09a2f6 [IR] Move KtDiagnosticReporterWithImplicitIrBasedContext to ir.tree
So that it could be accessible from the `ir.serialization.common` module
2024-01-29 21:07:43 +00:00
Ilya Goncharov 6b6ed12df1 [Gradle, JS] Add test on source map config
^KT-59523 fixed
2024-01-29 20:43:01 +00:00
Artem Kobzar 8c69ffe8c9 [K/Wasm] Generate wasm-specific unsigned implementations ^KT-58039 Fixed 2024-01-29 20:11:41 +00:00
Artem Kobzar b59993d88a [K/Wasm] Prepare for splitting unsigned implementation helpers into expect/actuals KT-58039 2024-01-29 20:11:41 +00:00
Brian Norman 7f9774819c Revert "[FIR] Do not smartcast class delegation implemented properties"
This reverts commit bb6f466162.

Reverting the fix for KT-57417 as it causes failures in IntelliJ and
Space projects. May reintroduce fix after failures are investigated and
resolved.
2024-01-29 19:24:03 +00:00
Alexander.Likhachev e8be5b4b0b [Gradle] Fix "lib with tests" tests
The tests `NewMultiplatformIT.testLibWithTests` and `NewMultiplatformIT.testLibWithTestsKotlinDsl` were broken for a while, but this was unnoticed because of the TC bug. Java targets were removed from the test project in 34f4e3cbf6. The fix just removes the Java target tests from the expected test report.
2024-01-29 18:39:41 +00:00
Alexander.Likhachev a065b7adf8 [Gradle] Escape TC service messages in debug logs unconditionally
Those messages are not required for the real TC reporting. They are printed just for debugging purposes of integration with K/N and K/JS test runners.
^KT-65295 Fixed
2024-01-29 18:39:41 +00:00
Dmitriy Dolovov e021411768 [Commonizer] Metadata comparator: More verbose output (with more details)
^KT-62753
2024-01-29 17:34:55 +00:00
Dmitriy Dolovov 5f3eee7267 [Commonizer] Metadata comparator: Fully support contracts comparison
^KT-62753
2024-01-29 17:34:55 +00:00
strangepleasures 4c8b5c699e [KAPT] [CLI] KT-65251 Run Kapt CLI with -Xmx512M by default 2024-01-29 15:47:36 +00:00
strangepleasures 17955ce7d9 Revert "Remove flaky Kapt4ToolIntegrationTestGenerated test"
This reverts commit 58fd558308.
2024-01-29 15:47:36 +00:00
Nikita Bobko 19c46662c6 [FIR] Fix missing ACTUAL_WITHOUT_EXPECT when expect is fake-override
^KT-65270 Fixed
KT review: https://jetbrains.team/p/kt/reviews/14064/timeline
IJ review: https://jetbrains.team/p/ij/reviews/124657/timeline
2024-01-29 14:56:49 +00:00
Nikita Bobko c214c5445a [FIR] Implement EXPECT_AND_ACTUAL_IN_THE_SAME_MODULE
^KT-60367 Fixed
KT review: https://jetbrains.team/p/kt/reviews/14064/timeline
IJ review: https://jetbrains.team/p/ij/reviews/124657/timeline
2024-01-29 14:56:48 +00:00
Artem Olkov b317a88536 add Initial support for comments in SIR #KT-65174 Fixed
Merge-request: KT-MR-14007
Merged-by: Artem Olkov <artem.olkov@jetbrains.com>
2024-01-29 14:22:42 +00:00
Brian Norman bb6f466162 [FIR] Do not smartcast class delegation implemented properties
When a property is implemented via class delegation, it should be
considered unstable for smart-casting. This is because it is unknown
what kind of stability the underlying class delegate property has. It
could be a stable property, or it could be implemented via a custom
getter and unstable.

^KT-57417 Fixed
2024-01-29 14:20:11 +00:00
Alexander Shabalin ce291b45b9 [K/N][tests] Cache executors based on testTarget 2024-01-29 14:12:14 +00:00
Alexander Shabalin 65abb5de46 [K/N][tests] Remove now unused LocalTestRunner 2024-01-29 14:12:14 +00:00
Alexander Shabalin f2ba4a3e6e [K/N][tests] Use HostExecutor in new test infra 2024-01-29 14:12:14 +00:00
Roman Efremov 8c000b8319 [LightTree] Stop reporting LOCAL_VARIABLE_WITH_TYPE_PARAMETERS on
...destructuring declarations to make it similar to PSI.

^KT-62704
2024-01-29 14:09:59 +00:00
Roman Efremov d22cc01638 [LightTree] Stop reporting NAME_IN_CONSTRAINT_IS_NOT_A_TYPE_PARAMETER on
...local properties to make it similar to PSI.

See this logic in `org.jetbrains.kotlin.fir.builder.PsiRawFirBuilder.Visitor.toFirProperty`

^KT-62704
2024-01-29 14:09:59 +00:00
Roman Efremov 3c8855c152 [LightTree] Fix positioning of VAR_TYPE_MISMATCH_ON_OVERRIDE in LT
The problem is that `override var b: String` in constructor has token
type `VALUE_PARAMETER`, thus was not considered as declaration.

^KT-62704
2024-01-29 14:09:59 +00:00
Roman Efremov 8edb1842a5 [Tests] Add spec tests in FIR + LightTree configuration
In some tests PSI and LT differ. Test data was fixed accordingly.

In the following tests I consider that difference is acceptable:
- compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/3.1.kt
- compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/4.1.kt

This is because:
- It only happens when recovering from syntax errors happened above in
code. I was unable to reproduce it in valid code.
- It doesn't break parsing further, the rest of the errors in file are
reported identically.

The rest of the tests will be fixed in subsequent commits.

^KT-62704 Fixed
2024-01-29 14:09:59 +00:00
Roman Efremov 18b9cf3bc6 [Tests] Update spec tests autogenerated files
Just run `./gradlew generateSpecTests`.

^KT-62704
2024-01-29 14:09:59 +00:00
Nataliya.Valtman fc8c6dadc9 Don't run testProjectWithBuildSrcForGradleVersion7 on windows
#KT-65227
2024-01-29 14:04:51 +00:00
Alexander Udalov 7ca2df3ff9 Kapt: minor, remove unneeded check
Most likely it has been made obsolete by KT-27936 where we started to
generate all inner class names correctly.

 #KT-61080 Fixed
2024-01-29 12:58:06 +00:00
Artem Kobzar 1fe77705b0 [K/Wasm] Convert non-capturing lambdas into singletons ^KT-64803 Fixed 2024-01-29 12:52:18 +00:00
Dmitrii Gridin e03f8b503f [LL FIR] implement lock resolution algorithm for jumping phases
This commit extends `LLFirLockProvider` API functionality to provide
`withJumpingLock`, which can be safely used in multithreaded scenarios.
Comparing to regular `withWriteLock`/`withReadLock`, the new API has a
bit more overhead as we have to maintain `jumpingResolutionStatesStack`
and `FirInProcessOfResolvingToJumpingPhaseState` even without contention.
See KDoc of `LLFirLockProvider#withJumpingLockImpl` for implementation
details.

The implicit type phase has been migrated to the new approach, so
now it is safe to drop the last global phase lock.
Potentially, we can have some benefits from migration of other
jumping phases to this API.

^KT-56551 Fixed
^KT-55750 Fixed
2024-01-29 12:39:09 +00:00