Commit Graph

103241 Commits

Author SHA1 Message Date
Alexander Udalov 9c03dcd230 Do not write version requirements for suspend functions
Previous attempt was at 6807ed6642, but it was reverted in 7771e5914d
(see that commit for the explanation). Now it should be fine to remove
these version requirements.

No issue reported because it's mostly not a user-visible change. The
main effect is that it reduces differences in metadata between K1 and
K2, namely it fixes the ValueClass.kt kotlinp test.
2023-07-31 13:05:29 +00:00
Alexander Udalov 06e370b012 K2: use Any? as last argument when serializing suspend types
K1 uses `Any?` in `transformSuspendFunctionToRuntimeFunctionType`, so
use `Any?` in K2 too.

This type is not used for anything, it's just an artifact of how suspend
types are represented in metadata. It's removed during deserialization
(see `TypeDeserializer.createSuspendFunctionType` or
`FirTypeDeserializer.createSuspendFunctionType`). So it's not a
user-visible change. The only effect is that it reduces differences in
metadata between K1 and K2, namely in the test
`libraries/tools/kotlinp/testData/ValueClass.kt`.
2023-07-31 13:05:29 +00:00
Alexander Udalov afd35accd8 Do not write version requirements for InlineClasses
Language feature InlineClasses is enabled since 1.3. The current lowest
supported language version is 1.4, so any compiler that can read
binaries produced by the current compiler also supports inline classes,
which means that the version requirement is not needed anymore.

No issue reported because it's mostly not a user-visible change. The
main effect is that it reduces differences in metadata between K1 and
K2, because K2 never supported writing this version requirement properly
due to the TODO in `hasInlineClassTypesInSignature`.
2023-07-31 13:05:29 +00:00
aleksandrina-streltsova 9e50a3b71d [FIR] create snapshot of collected tower data context for declaration
KTIJ-26113
2023-07-31 10:50:12 +00:00
aleksandrina-streltsova af6672c87d [FIR] store tower data context for operand in and/or binary expression
KTIJ-26113
2023-07-31 10:50:12 +00:00
aleksandrina-streltsova 2f2eb86195 [FIR] save tower data context for expression in when entry
^KTIJ-26113 Fixed
2023-07-31 10:50:11 +00:00
Alexander.Likhachev 18aa7f4d4b [BT] Implement non-incremental compilation within the daemon
#KT-57398 In Progress
2023-07-31 10:38:35 +00:00
Johan Bay fafea27283 [klib tool] Add option to print ir
Dumping the IR from a klib is useful for debugging klib compilations.

^KT-58877
2023-07-31 09:45:19 +00:00
Kirill Rakhman b0f1746012 [FIR] Set actual modifier on implicitly actual primary constructors
... of annotations and inline classes.

#KT-60139 Fixed
2023-07-31 09:35:51 +00:00
Nataliya.Valtman fb04356829 Add JPS iteration metric
#KT-58026 In progress


Co-authored-by: Nataliya Valtman <Nataliya.Valtman@jetbrains.com>


Merge-request: KT-MR-11365
Merged-by: Aleksei Cherepanov <aleksei.cherepanov@jetbrains.com>
2023-07-31 09:15:28 +00:00
Ivan Kylchik ecdb08952b [IR] Restore compatibility with IDEA after moving toIrConst function
#KT-60744 Fixed
2023-07-31 09:01:19 +00:00
Ilya Kirillov de4224296d [Analysis API FIR] fix reference resolve to reified type parameter 2023-07-31 08:43:59 +00:00
Stanislav Erokhin b3236c5824 [mpp] Set the minimum supported gradle to 6.8.3 (same as in KGP)
KGP supports only Gradle since 6.8.3, and we run tests on
buildserver only since this version, so we shouldn't try to work if
gradle < 6.8.3.
And in general in MPP plugin we shouldn't support version that is not
supported in KGP

#KT-59278
2023-07-31 08:25:37 +00:00
Kirill Rakhman 0a469ff3b9 [FIR] Use class scope to get constructors for redeclaration check
#KT-60793 Fixed
2023-07-31 08:13:49 +00:00
Dmitrii Krasnov e7c589a573 Added FUS statistics for applied plugins: kotlin-js, cocoapod plugin
#KT-59324 In Progress


Merge-request: KT-MR-11360
Merged-by: Dmitrii Krasnov <Dmitrii.Krasnov@jetbrains.com>
2023-07-31 07:33:17 +00:00
Alexander Udalov 3ff21db77f Tests: remove unused .diag.txt file 2023-07-29 23:06:23 +00:00
Alexander Udalov 0a748f8ea0 Tests: remove .txt dumps from diagnostic tests with JVM backend
They are mostly useless now.
2023-07-29 23:06:23 +00:00
Alexander Udalov 965946d3ef K2: report JVM backend errors in the same way in PSI as LT
Do not try to find PSI element, but always use the IR element offsets
instead. This greatly simplifies test data because we don't need to have
custom PSI- and LT- based diagnostic ranges in every test, and K1/K2
behavior also is mostly the same.

The exact offset ranges are not as important for backend diagnostics, so
it's better to have K2+PSI and K2+LT behaving the same.
2023-07-29 23:06:23 +00:00
Alexander Udalov 6069aaee9c K2: report JvmMultifileClass+JvmSynthetic error in JVM backend
Specifically, the case when not all parts of a multifile class are
annotated with `@JvmSynthetic`. Report the error on the
`@JvmMultifileClass` annotation instead of the package directive,
because the latter is difficult to find via IR. This fixes the test
FirLightTreeDiagnosticsTestWithJvmIrBackendGenerated.MultifileClasses.testJvmSynthetic.

 #KT-59586
2023-07-29 01:14:29 +02:00
Alexander Udalov 96ddd9bbf3 K2: report INLINE_CALL_CYCLE error in JVM backend
This fixes the following
FirLightTreeDiagnosticsTestWithJvmIrBackendGenerated tests:

  testPropertyInlineCycle
  testInlineCycle
  testSuspendInlineCycle
  testIndirectInlineCycle

 #KT-59586
2023-07-29 01:14:29 +02:00
Alexander Udalov 5f2ff06296 Add tests for JVM backend diagnostics with K2 light tree
In the vast majority of tests, diagnostics are reported at a slightly
different location in LT vs PSI. This is because in the light tree mode,
backend errors are reported basically on the start of the IR element,
which is for example the keyword "class" for a class and not its name as
in K1 or in K2+PSI. Similarly, the end of the diagnostic is at the
ending offset of the IR element.

Normally it would be a bit user-unfriendly to highlight the whole class
as red, starting from the keyword "class" and ending with the closing
brace "}". But remember that these are backend diagnostics in the K2+LT
mode, which is only possible in the compiler scenario, not in the IDE.
And in this case, the ending offset doesn't matter at all because it's
not presented to the user, and minor change in the starting offset is
not a problem as well.

There are some tests which legitimately fail in the LT mode because the
corresponding diagnostics haven't been supported. They will be dealt
with in subsequent commits:

  testPropertyInlineCycle
  testInlineCycle
  MultifileClasses.testJvmSynthetic
  testSuspendInlineCycle
  testIndirectInlineCycle

 #KT-59586
2023-07-29 01:14:29 +02:00
Alexander Udalov 69c698134b Tests: do not depend on PSI in JvmBackendDiagnosticsHandler
#KT-59586
2023-07-29 01:14:29 +02:00
Alexander Udalov b81c637fed Minor, simplify FirDiagnosticsCompilerResultsReporter.reportByFile 2023-07-29 01:14:29 +02:00
Igor Yakovlev f2ea2021d7 [Wasm] Add wasi target attribute 2023-07-28 20:19:55 +02:00
Sebastian Sellmair db5655d6ce [Gradle] Implement InternalKotlinTargetPreset
^KT-59321 In Progress
2023-07-28 17:53:45 +00:00
Timofey Solonin 969deb639c [MPP] Deprecate preset APIs
^KT-59321
2023-07-28 17:53:45 +00:00
Timofey Solonin a580d4e5aa [MPP] Validate fromPreset API changes 2023-07-28 17:53:45 +00:00
Timofey Solonin 0ad8407b57 [MPP] Add TargetPreset APIs deprecation tests
^KT-59321
2023-07-28 17:53:45 +00:00
Dmitrii Gridin da71a152cd [FIR] update FirRenderer for scripts
^KT-60728
2023-07-28 17:49:14 +00:00
Dmitrii Gridin 2bacba5a9a [LL FIR] add one more complex test case for scripts
^KT-60728
2023-07-28 17:49:14 +00:00
Zalim Bashorov 0bdee00ca2 [Wasm] Use Node.js with "canary" v8 (11.7.310.0) in tests
There are no other non-canary Node.js versions using fresh enough v8.
2023-07-28 16:16:34 +00:00
Zalim Bashorov cead5c8aae [Wasm] Update Binaryen to 114
This version supports new br_on_cast* instructions.

Also, stop passing to binaryen no longer supported option.
2023-07-28 16:16:34 +00:00
Zalim Bashorov a1115236f9 [Wasm] Disable deprecated instructions while running tests in V8
To make sure that our implementation is up-to-date with the spec.
2023-07-28 16:16:34 +00:00
Zalim Bashorov 4572680877 [Wasm] Migrate to the latest br_on_cast* instructions
#KT-59722 Fixed
2023-07-28 16:16:33 +00:00
Zalim Bashorov 9254f70c2a [Wasm] Update SpiderMonkey to 2023-07-24-09-16-21 2023-07-28 16:16:33 +00:00
Yan Zhulanow 6c6cf9977b [fir2ir] Disable resolve contract check in FIR/IR builtins
In the compiler, 'FirLazyDeclarationResolver' assumes
'lazyResolveToPhase()' appear only during code analysis. So there is
a check that requires calls to be wrapped with 'startResolvingPhase()'
and 'finishResolvingPhase()'. Checkers and backend are run on fully
analyzed code, so there is no need in calling 'lazyResolveToPhase()'
in the first place.

In the IDE, however, it's impossible to analyze all code in a project
before running the backend. Generally, it's not a problem as files that
are explicitly passed to the backend go through all FIR phases.
'IrBuiltInsOverFir', though, perform symbol lookups, so unresolved-yet
declarations might appear.
2023-07-28 16:05:34 +00:00
Yan Zhulanow 22fc147d60 [fir2ir] Refactoring, use 'createIrTypeParameterWithoutBounds()' utility 2023-07-28 16:05:34 +00:00
Yan Zhulanow 82855fbf0f [fir2ir] Add missing 'lazyResolveToPhase()' to FIR/IR builtins 2023-07-28 16:05:34 +00:00
Yan Zhulanow 8286ffd232 [fir2ir] Create separate symbols for serialized parameters 2023-07-28 16:05:34 +00:00
Yan Zhulanow a92c479344 [fir2ir] Pass 'ProcessCancelledException' 2023-07-28 16:05:34 +00:00
Yan Zhulanow 2600dc7f1e [fir2ir] Allow non-cached source parents for non-cached declarations
In the IDE, there might come declarations from other files/modules
that we link against, but not pass to the backend. As only declarations
from the compiled files end up being in the cache, the consistency check
should be relaxed.
2023-07-28 16:05:34 +00:00
Yan Zhulanow f5c9c1d78e [fir2ir] Use the correct 'FirProvider' for fetching the containing file
In the IDE, declarations may come from different modules.
2023-07-28 16:05:34 +00:00
Yan Zhulanow ba0f8c8735 [fir2ir] Generate facade stubs for external source declarations
In the IDE, it's impossible to pass classes from all modules to the
backend, so symbols for 'external' source declarations need to be
generated ad-hoc.

Such declarations do not go through the lowering phase, including one
that replaces the containing package fragment with a facade class.
2023-07-28 16:05:34 +00:00
Yan Zhulanow 7d88ade005 [fir2ir] Allow non-cached type parameters
In the IDE, there might come declarations from other files/modules
that we link against, but not compile. Type parameters are one of such
declaration kinds.
2023-07-28 16:05:34 +00:00
Yan Zhulanow 14f83566d0 [fir2ir] Support stub-based FIR declarations
In the IDE, FIR declarations for libraries are built on top of binary
stubs. This helps to improve memory usage significantly, as Protobuf
metadata isn't loaded all the time. However, the containing file type
for stubs is different.
2023-07-28 16:05:34 +00:00
Kirill Rakhman dc9e4f8d99 [FIR2IR] Fix UninitializedPropertyAccessException
#KT-60735 Fixed
2023-07-28 15:59:24 +00:00
Sebastian Sellmair 8aee8ad3c4 [Gradle] KpmLocalModuleIdentifier: Migrate to 'BuildIdentifier.getBuildPath'
^KT-58157 Verification Pending
2023-07-28 15:55:52 +00:00
Sebastian Sellmair d7d6d7ebca [Gradle] Implement MppCompositeBuildIT to check shape of project coordinates across different versions of Gradle
^KT-58157 Verification Pending
2023-07-28 15:55:52 +00:00
Sebastian Sellmair 749f13ca09 [Gradle] Implement CurrentBuildIdentifier to replace 'BuildIdentifier.isCurrentBuild()' usages
^KT-58157 Verification Pending
2023-07-28 15:55:52 +00:00
Sebastian Sellmair e9e0a4741c [Gradle] Implement 'BuildIdentifier.isCurrentBuildCompat'
^KT-58157 In Progress
2023-07-28 15:55:51 +00:00