Commit Graph

105706 Commits

Author SHA1 Message Date
Alexander Korepanov 188cdf2f98 [JS IR] Allow constant inlining in JS IR
Fixed the incremental compilation issue,
which had prevented enabling const inlining during constant
evaluation and folding a constant expression with JS code.

^KT-62425
2023-10-26 19:22:14 +00:00
Alexander Korepanov 629e0628d6 [JS IR] Implemented a set of JS code checks before klib serialization
The diagnostics cannot be implemented with the FIR frontend checker
because it requires constant evaluation over FIR.
Therefore, the diagnostics are implemented as a set of klib checks over IR.

For the diagnostics, the js() call argument must be
evaluated and inlined as IrConst<String> into IR
in the same way as const val initializers and annotation arguments.

^KT-59388 Fixed
^KT-59399 Fixed
^KT-62425 Fixed
2023-10-26 19:22:14 +00:00
Alexander Korepanov 71eaf651e8 [JS FIR] Implement JSCODE_ARGUMENT_NON_CONST_EXPRESSION FIR checker
The meaning of this check is the same as K1
JSCODE_ARGUMENT_SHOULD_BE_CONSTANT and JSCODE_ARGUMENT_NON_CONST_EXPRESSION
diagnostics.

The main difference is that K2 JSCODE_ARGUMENT_NON_CONST_EXPRESSION
diagnostic checks the js() argument in the same way as
const val initializers or annotation arguments are checked.

This means that, the K2 diagnostic is stricter than original
K1 JSCODE_ARGUMENT_SHOULD_BE_CONSTANT diagnostic,
which allows the use of non-constant vals.

^KT-59435 Fixed
2023-10-26 19:22:14 +00:00
Alexander Korepanov 2d934f6357 [JS FIR] Generate FIR checker components
Generate components for JSCODE_ARGUMENT_NON_CONST_EXPRESSION

^KT-59435
2023-10-26 19:22:14 +00:00
Alexander Korepanov 720fe2ac89 [JS PSI] Deprecate using not constant variables in js() calls
Added JSCODE_ARGUMENT_NON_CONST_EXPRESSION warning which
checks non constant variable usages in js() argument expressions.

The fix is related to KT-57156.
2023-10-26 19:22:13 +00:00
Aleksei.Glushko 2b2b8dd090 [K/N] Make runtime logs enablement compile-time evaluatable 2023-10-26 17:40:06 +00:00
Aleksei.Glushko beeb016a9f [K/N] Test runtime logging performance overhead 2023-10-26 17:40:06 +00:00
Sergej Jaskiewicz 325b152efa [FIR generator] Remove unused class ImplementationWithArg 2023-10-26 17:33:59 +00:00
Sergej Jaskiewicz 7b7bcb8ffa [FIR/IR generator] Introduce ImportCollector
This class enables printing the import list in generated files
in a smarter way.

Also, refactor `Importable` interface hierarchy, namely, don't inherit
`TypeRef` from `Importable`, since we have types like `TypeRef.Star`
which are not really importable.

Replace the `Importable#typeWithArguments` property with
the `TypeRef#render` method to utilize `ImportCollector` while rendering
types.
2023-10-26 17:33:59 +00:00
Ilya Kirillov bec6d38490 [build] fix Fleet tests
Fleet is using `:compiler:ir.objcinterop` which was removed in e91e1a7729 from IDE dependency publishing
2023-10-26 13:11:23 +00:00
Svyatoslav Kuzmich a8e5655ffe [Wasm] K2 port of definedExternally diagnostic (KT-56849) 2023-10-26 12:40:17 +00:00
Artem Kobzar 847178d382 [K/JS, K/Wasm] Use Unix-style separator inside the "main" field of a package.json file 2023-10-26 11:41:56 +00:00
Evgeniy.Zhelenskiy ce396f4ab6 [FIR] Add check inline declaration inside constructor calls
#KT-59933
2023-10-26 11:29:26 +00:00
Evgeniy.Zhelenskiy 6a5b356d30 [FIR] Add check of abstractness and existence of receiver parameters for lateinit var; add lacking lateinit modifier
#KT-59973
2023-10-26 11:08:27 +00:00
Anastasia.Nekrasova e789e08fb7 [K2] Disappeared FORBIDDEN_VARARG_PARAMETER_TYPE
^KT-59991
2023-10-26 10:51:48 +00:00
Artem Kobzar 6cd42eeb71 [K/JS] Fix reexport with CommonJS and incremental compilation 2023-10-26 09:58:35 +00:00
Ilya Goncharov 2bb3b84e7e [Gradle,JS] Make customFields nullable in type adapter 2023-10-26 09:43:59 +00:00
Artem Kobzar 4101d01744 Revert "[K/JS] Fix ES6-classes compilation for objects without constructor generated by plugins" 2023-10-26 09:06:19 +00:00
Bart van Helvert 793e7aa1d1 [AA] Add tests for retrieving field and parameter annotation types 2023-10-26 07:48:18 +00:00
Nataliya.Valtman b9090e12b8 Remove all project iteration for projectIsolation support
KT-62131 Fixed
2023-10-26 07:30:17 +00:00
Roman Golyshev 21c46a6ddb KTIJ-26423 [AA] Remove KtImportOptimizerResult.unusedImports
This information is computed on the `intellij` side, and no there is
no code left in `kotlin` which still requires it
2023-10-25 20:53:15 +00:00
Roman Golyshev bd92224aec KTIJ-26423 [AA] Ignore artificial Array type from varargs parameters in KtFirImportOptimizer 2023-10-25 20:53:15 +00:00
Roman Golyshev ef31eeae52 KTIJ-26423 [AA] Get rid of the old testdata for KtImportOptimizer
This testdata is some form will be transferred to the `intellij` repo
2023-10-25 20:53:14 +00:00
Roman Golyshev 4e4f3075bd KTIJ-26423 [AA] Get rid of FE10 implementation of KtImportOptimizer
As of now, this implementation is not supposed to be used at all

If (for some reason) it becomes relevant again, please refer
to the 7fd441f1 commit which contained a FE10 implementation
of this service (copied from the old FE10 implementation of
import optimizer)
2023-10-25 20:53:14 +00:00
Roman Golyshev a6668919b0 KTIJ-26423 [AA] Remove FE10 tests for KtImportOptimizer
We don't plan to seriously support the FE10 implementation of
`KtImportsOptimizer` service, since it's not going to be used in IDE
(it has its own old version of import optimization logic)
2023-10-25 20:53:13 +00:00
Roman Golyshev 306f404a69 KTIJ-26423 [AA] Get rid of local declarations in KtFirImportOptimizer
Adjust `computeImportableName` to return null for when passed symbol
is local
2023-10-25 20:53:13 +00:00
Roman Golyshev 421793673b KTIJ-26423 [AA] Extend KtImportOptimizer testdata with imports usage information
`KtImportOptimizerResult.unusedImports` should be removed soon, and
part of the testdata for the import optimizer service should go
to `intellij` repository
2023-10-25 20:53:12 +00:00
Mikhail Glukhikh f90831398c K2: temporarily comment unstable part of FlagDelegatesTest.testDelegation
Related to KT-62581
2023-10-25 20:19:39 +00:00
Mikhail Glukhikh d42ae35624 K2: support DELEGATION member kind for properties #KT-62581 Fixed 2023-10-25 20:19:39 +00:00
Mikhail Glukhikh 19bf11f041 FlagDelegatesTest: accept K2 behavior for KT-62582 2023-10-25 20:19:39 +00:00
Dmitrii Gridin ab393d0340 [LL FIR] add more lazy resolution tests on property from constructor
^KTIJ-26215
2023-10-25 19:54:56 +00:00
Dmitrii Gridin f66bb1bcb7 [FIR] FirScriptConfiguratorExtensionImpl: avoid creation of dummy elements
This will reduce memory and CPU consumption

^KT-61186
2023-10-25 19:00:20 +02:00
Ivan Kylchik e827f260e7 [IR] Simplify IrProperty?.isConst check in interpreter 2023-10-25 16:43:25 +00:00
Ivan Kylchik a97c0bab0b [IR] Simplify access to IrProperty from IrCall and IrField in interpreter 2023-10-25 16:43:25 +00:00
Vladimir Sukharev 604c8edd1c [K/N] Fix kt53261_* tests to be dummy in debug mode
^KT-62157 Fixed


Merge-request: KT-MR-12720
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-10-25 16:07:01 +00:00
Ilya Goncharov 065733e87c [FIR] Add UNINITIALIZED_ENUM_ENTRY on access qualifier of local enum
^KT-59967 fixed
2023-10-25 15:36:11 +00:00
Jinseong Jeon 1ccb085e68 SLC: use fully expanded type when computing nullability
^KT-62757 fixed
2023-10-25 14:59:50 +00:00
Ilya Goncharov 573bc34b56 [JS] Invoke processing separately for suspend and non-suspend function
^KT-62771 fixed
2023-10-25 13:28:58 +00:00
Alejandro Serrano Mena f227447837 [K2] Disallow named functions as expressions
^KT-62573 Fixed
^KT-59945 Fixed
2023-10-25 13:24:30 +00:00
Sergej Jaskiewicz aaf7ccbebd [util] Introduce IndentingPrinter interface
This interface is more convenient to pass around so that it's easier
to replace different printer implementations.
2023-10-25 13:04:15 +00:00
Sergej Jaskiewicz 895d107ac5 [util] Convert Printer from Java to Kotlin 2023-10-25 13:04:14 +00:00
Sergej Jaskiewicz c442d0e159 [util] Rename Printer.java to Printer.kt before converting it to Kotlin
This is to preserve the Git history of the file.
2023-10-25 13:04:14 +00:00
Christoph Loy cf8b41970e [Gradle, Kapt] Run kapt even when all dependencies are indirect
Previously, kapt skipped the execution, if the "kapt" configuration had
no direct dependencies (via `kapt.dependencies.isEmpty()`).
This lead to kapt not working, if all
annotation processors are declared in a super-configuration of kapt.

With this change, we also consider super-configurations
(via `kapt.allDependencies.isEmpty`) and fix the described bug.

^KT-62518 Fixed
2023-10-25 12:25:41 +00:00
Dmitriy Novozhilov fb8bf19091 [IR] Rename IrSymbolInternals to UnsafeDuringIrConstructionAPI
The new name more precisely describes the meaning of this opt-int
2023-10-25 11:32:46 +00:00
Marco Pennekamp 38ebe60e9f [FIR] Refactoring: Move set utility functions to setUtils.kt 2023-10-25 11:04:36 +00:00
Marco Pennekamp 8d2bf8828c [LL FIR] Remove LLFirProviderHelper.getTopLevelClassNamesInPackage
- We shouldn't bypass the symbol names cache, as the IDE declaration
  provider doesn't cache name sets.

^KT-57314
2023-10-25 11:04:36 +00:00
Marco Pennekamp efe587691b [FIR] Type "top-level classifier names in package" as Name
- This is more consistent with "top-level callable names in package" and
  simplifies the set construction quite a bit, as we can avoid a lot of
  `asString` conversions.
2023-10-25 11:04:36 +00:00
Marco Pennekamp 8034d522b9 [LL FIR] Respect allowKotlinPackage in LLFirKotlinSymbolNamesProvider
- `LLFirProviderHelper` is guarded by `allowKotlinPackage` and the
  symbol names provider should reflect that in the name sets.
- Note that this does not apply to stub-based deserialized symbol
  providers, because they do not pass any value to `allowKotlinPackage`.

^KT-57314
2023-10-25 11:04:36 +00:00
Anna Kozlova e79bc5bb59 [AA] KtExpressionInfoProvider.getMissingCases: fix no subject case
return missing else branch (even if it's present, see kdoc)

^ KT-62875 fixed
2023-10-25 09:41:38 +00:00
Hung Nguyen 19104f73bf Fix casting of extraProperties in PropertiesBuildService
`project.extraProperties` may contain values that are not `String`s. To
avoid failing on those values, we should cast the value with
`as? String` instead of `as String?`.

Test: New PropertiesBuildServiceTest
^KT-62496 Fixed
2023-10-25 09:17:34 +00:00