Commit Graph

105736 Commits

Author SHA1 Message Date
Dmitriy Dolovov 02f52371c1 [KLIB tool] Rename "contents" to "dump-metadata"
To make KLIB tool command names more uniform.
2023-10-27 09:27:59 +00:00
Dmitriy Dolovov d8d95fdf4b [KLIB tool] Deprecate usage of KLIB repositories
^KT-61098
2023-10-27 09:27:59 +00:00
Dmitriy Dolovov 5961710db3 [KLIB tool] Don't print stack trace on trivial errors
1. Don't need to print stack trace on trivial errors such as invalid
CLI argument or incompatible library version.

2. Re-organization of `logWarning()` & `logError()` calls inside
the klib tool.
2023-10-27 09:27:59 +00:00
Dmitriy Dolovov 8ca62ad656 [KLIB tool] Fail with an adequate error message on IR-less KLIBs
^KT-62341
2023-10-27 09:27:59 +00:00
Dmitriy Dolovov f276fe6506 [KLIB] Add a reliable mechanism to check if KLIB has IR inside
^KT-62341
2023-10-27 09:27:59 +00:00
Dmitriy Dolovov 4b2776e126 [KLIB tool] Introduce new command: dump-ir-signatures
^KT-62341
2023-10-27 09:27:59 +00:00
Dmitriy Dolovov 447b0eddac [KLIB tool] Drop useless arg: -target 2023-10-27 09:27:59 +00:00
Dmitriy Dolovov b0c1cbff32 [KLIB tool] Minor. Reformat usage info 2023-10-27 09:27:59 +00:00
Bart van Helvert f31c93132e [AA] Fall back on fir building when getting type from reference
#KTIJ-26215 Fixed
2023-10-27 09:17:12 +00:00
Roman Golyshev ece43fe9c6 KT-62859 [LL FIR] Compute origin per declaration in StubBasedFirDeserializedSymbolProvider
Since `createStubBasedFirSymbolProviderForClassFiles` works for
builtins (after 866368cf), the provider sometimes has to handle
declarations from builtins (`Any?.toString()` or `arrayOf`, for example)

To provide correct origin for such declarations, we have to compute
the origin on the per-declaration basis instead of always setting
`Library` or `BuiltIn` origin

Providing correct origins should improve the consistency of
deserialized fir declarations

To reduce duplication, `getContainerSource` now also uses
`getDeclarationOriginFor`
2023-10-27 08:28:30 +00:00
Roman Golyshev 16608c8a1f KT-62859 [LL FIR] Introduce JvmStubDeserializedBuiltInsContainerSource
If deserialized declarations from built-ins have a container source
which implements `FacadeSource`, it might cause different problems
during IR compilation.

For example, IR lowering of `Any?.toString()` function call was broken
because IR assumed that this declaration belonged to a facade class
"kotlin.kotlin", which does not exist.

We introduce a special kind of container source for the built-ins
declarations, and there are in fact no real facade classes for such
declarations.

Also, `LLFirModuleWithDependenciesSymbolProvider` is modified to
correctly handle such sources. Previously it only handled
`FacadeSource`s, and now it knows about our special source for
built-ins.

^KT-62859 Fixed
2023-10-27 08:28:30 +00:00
Dmitrii Krasnov 1a9cd81a85 [KGP] Changed type of determining maturity version for k/n
#KT-62927 Fixed

Merge-request: KT-MR-12742
Merged-by: Dmitrii Krasnov <Dmitrii.Krasnov@jetbrains.com>
2023-10-27 08:20:44 +00:00
Kirill Rakhman 8821f8d1a4 [FIR] Expand type alias when checking for type parameters from outer declaration
This fixes a false positive OUTER_CLASS_ARGUMENTS_REQUIRED when
referring to an inner class of a supertype that is extended using a
typealias.

#KT-62099 Fixed
2023-10-27 08:05:58 +00:00
Kirill Rakhman 907ebb36d0 [FIR] Filter out SAM constructors from MemberScopeTowerLevel
This tower level is for calls on a dispatch receiver, and it's not
allowed to call SAM constructors on a dispatch receiver.

#KT-60983 Fixed
2023-10-27 08:03:00 +00:00
Marco Pennekamp 576d8d1c10 [AA] Allow declaration provider package set computation to return null
- This is in line with the API of `FirSymbolNamesProvider`. It only
  makes sense to compute package sets for source and library modules.
  Also, source module package set computation in the IDE is currently
  broken, so it's good to be able to return `null` in the meantime.
- This also allows the removal of the workaround for source modules in
  `LLFirProviderHelper`, as the IDE declaration provider can now return
  `null` itself in this case.

^KTIJ-27411
2023-10-26 21:07:28 +00:00
Marco Pennekamp 5c091f611e [LL] Pass contextual module to stub-based Kotlin declaration providers
- This will allow the Kotlin declaration provider to compute package
  sets based on the library module associated with the stub-based symbol
  provider.

^KTIJ-27411
2023-10-26 21:07:28 +00:00
Marco Pennekamp 485a4cebb2 [AA] createDeclarationProvider: Document usages of the contextual module
^KTIJ-27411
2023-10-26 21:07:28 +00:00
Marco Pennekamp 2e5ee28681 [LL] Remove unused declaration provider from LLFirIdePredicateBasedProvider 2023-10-26 21:07:28 +00:00
Marco Pennekamp 2ec77822e2 [AA] createDeclarationProvider: Rename module to contextualModule
^KTIJ-27411
2023-10-26 21:07:28 +00:00
Evgeniy.Zhelenskiy a77349edb4 [FIR] Report INAPPLICABLE_INFIX_MODIFIER on vararg parameter, position INAPPLICABLE_INFIX_MODIFIER on infix keyword
#KT-59974
2023-10-26 20:07:50 +00:00
Vladimir Sukharev aebbdeaf92 [K/N] Fix OS file handles leak in DependencyProcessor
Merge-request: KT-MR-12705
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-10-26 20:03:34 +00:00
Mikhail Glukhikh f82c3c3bf7 K2: add test confirming finished migration in KT-33917
Related to KT-62918, KT-60086
2023-10-26 19:41:13 +00:00
Mikhail Glukhikh dda7004d66 K2: add test to confirm behavior described in KT-62918
#KT-62918 Obsolete
Related to: KT-60086, KT-59920
2023-10-26 19:41:13 +00:00
Ilya Kirillov a90562c0da [Analysis API] support creating KtSymbol by K/JS dynamic scope
^KT-61257 fixed
2023-10-26 19:28:27 +00:00
Alexander Korepanov 91edbeb747 [JS IR] Add tests for checking constant inlining with JS IR IC
^KT-62425
2023-10-26 19:22:14 +00:00
Alexander Korepanov 4ebfed04d3 [JS IR] Add tests for JS code KLIB diagnostics
^KT-62425
2023-10-26 19:22:14 +00:00
Alexander Korepanov 261527939b [JS IR] Fix JS code diagnostics tests according to new KLIB checks
^KT-62425
2023-10-26 19:22:14 +00:00
Alexander Korepanov 04809a6b3b [JS IR] Move tests for JS code diagnostics
^KT-62425
2023-10-26 19:22:14 +00:00
Alexander Korepanov 78aa34b3e8 [JS IR] Fix JS box tests
^KT-62425
2023-10-26 19:22:14 +00:00
Alexander Korepanov b9c7a672b8 [Common IR] Get rid of inlineConstVal flag
The hack involving disabling constant inlining via the inlineConstVal
flag was necessary to avoid a JS IR incremental compilation issue.
Since the issue has been fixed, the hack is no longer needed.
2023-10-26 19:22:14 +00:00
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