Commit Graph

106514 Commits

Author SHA1 Message Date
Mikhail Glukhikh 2cea2b9098 K2/Java: add private enum constructor for MPP matching
#KT-62961 Fixed
2023-11-28 13:30:26 +00:00
Evgenii Mazhukin 563c878f20 [KGP] Fix sharing build cache between Windows and Linux
On Windows, path() uses backslash as a file separator, and Mac/Linux
are using forward slashes. If friendPathsSet differs, remote build outputs
from other platforms can't be reused.

This patch uses invariant paths to address the issue.

^KT-63460 Fixed


Merge-request: KT-MR-13261
Merged-by: Evgenii Mazhukin <evgenii.mazhukin@jetbrains.com>
2023-11-28 12:09:39 +00:00
Evgeniy.Zhelenskiy 5258e2044d [FIR] Forbid annotations on anonymous initializers and destructuring declarations
#KT-59896


Merge-request: KT-MR-13197
Merged-by: Evgeniy Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>
2023-11-28 11:59:26 +00:00
Svyatoslav Kuzmich e901629cf0 [Wasm] Support WASI target in K2
- Support WASI mode in CLI and test infrastructure
- Add external declaration checker
- Split Fir diagnostic lists into Base, JS and WASI

#KT-56849 Fixed
2023-11-28 11:51:53 +00:00
Artem Kobzar f26b0a5be6 [K/JS] Fix case with boxing/unboxing inside the BlockDecomposerLowering ^KT-63808 Fixed 2023-11-28 11:51:08 +00:00
Ilya Goncharov 8c95665e27 [Gradle, JS] Deprecate specific Node.js properties
^KT-62780 fixed
2023-11-28 10:36:36 +00:00
Igor Chevdar 1805f322f8 [K/N] Do not use LazyIr for per-file caches
#KT-63789 Fixed
2023-11-28 09:22:36 +00:00
Igor Chevdar b264cf2119 [K/N] Reformat 2023-11-28 09:22:36 +00:00
Anastasia.Nekrasova 00119c6a97 [K2] Disappeared UNSUPPORTED
Prohibit named parameters in function types in supertype position

^KT-59881
2023-11-28 07:55:15 +00:00
Roman Efremov 5147a5e805 [Test] Add test for current behavior of resolution of nested class type
...when it is actualized via typealias.

^KT-31636
2023-11-27 18:23:43 +00:00
Roman Efremov 205690b220 [IR] Fix incorrect matching of nested classes when actualized via typealias
Also, add tests for the cases when expect and actual nested classes
have no compatible matching to check new logic doesn't crash.

^KT-31636
2023-11-27 18:23:42 +00:00
Roman Efremov d343e40ac5 [FIR] Actualize expect nested classes in type arguments in expect actual
...checker.

^KT-31636
2023-11-27 18:23:42 +00:00
Roman Efremov cec644e9db [Test] Add test for expect nested classes unwrapping
...in type arguments, when they were actualized via
typealias.

^KT-31636
2023-11-27 18:23:42 +00:00
Roman Efremov 4aaf290c99 [FIR] Fix incorrect matching of nested classes when actualized via typealias
There are still some places in `.fir.kt` where false-positive reports
remained. This is because of IR checker, which will be fixed in next
commit.

^KT-31636
2023-11-27 18:23:42 +00:00
Roman Efremov a768ece70d [Tests] Add tests for other checkers having same problem with
...nested classes marching.

^KT-31636
2023-11-27 18:23:42 +00:00
Roman Efremov bfc775faf5 [Tests] Create test for nested classes matching when actualized via typealias
^KT-31636
2023-11-27 18:23:42 +00:00
Svyatoslav Kuzmich 6b6353f3b9 [Wasm] Add external file checker to K2
#KT-56849
2023-11-27 16:55:04 +00:00
Svyatoslav Kuzmich 7687b86654 [Wasm] Add JsModule checker to K2
#KT-56849
2023-11-27 16:55:04 +00:00
Sebastian Sellmair 977d1c0e41 [K/N] Implement objc export header test: functionWithErrorType 2023-11-27 16:39:15 +00:00
Sebastian Sellmair 04df33eec1 [K/N] Implement ObjCExportNamerTest and ObjCExportMapperTest
... to provide simple and quick validation
for their corresponding entities.

Those tests can also act as convenient entry points
for debugging.
2023-11-27 16:39:15 +00:00
Stanislav Ruban 269b60b420 [tests] Add a test case for KT-61978
^KT-61978 Obsolete
2023-11-27 15:50:46 +00:00
Ilya Gorbunov 28c1049518 [stdlib] KT-55619 provide samples and extend documentation for String.format 2023-11-27 15:04:51 +00:00
Alexander Korepanov b1465fbfb8 [JS FIR] Enable warnings and infos for JS FIR tests 2023-11-27 14:31:31 +00:00
Alexander Korepanov 862be5a787 [JS FIR] Fix FIR NON_EXPORTABLE_TYPE diagnostic bugs
- use a declaration source if a parameter source is null;
 - ignore constructor return type to avoid
   double-checking of the class itself;
 - ignore constructor type parameters
   obtained from the class declaration;
 - ignore enum entries property (it is not checked in K1 at all);
 - fix exportability check for function types;

 ^KT-63089 Fixed
2023-11-27 14:31:30 +00:00
Artem Kobzar 6615b77213 [K/JS] Rework symbol hash calculation to make IC works with @JsExport and @JsName changes 2023-11-27 13:49:56 +00:00
Leonid Startsev f7d87f6d70 Use type parameters' source information for kotlinx.serialization diagnostics
To be more consistent with K1, certain diagnostics should be reported
not on the whole properties' types, but on type arguments inside them.

Note that there is still a difference with K2 because K2 reports on a type argument
including its annotations, while K1 used KtTypeReference.typeElement.

IMO, K2 conveys the same or better meaning here, so I am willing to leave this
difference instead of providing PositioningStrategy.

#KT-53861 Fixed
2023-11-27 13:32:44 +00:00
Dmitriy Novozhilov a22a254c1e [Test] Fix passing useIrFakeOverrideBuilder flag in tests 2023-11-27 10:17:54 +00:00
Dmitriy Novozhilov 039baf95fc [Test] Add empty platform module for MPP diagnostic test with only one module
After previous commits IrActualizer runs only there are at least two modules
  in backend input. So to check diagnostics from Actualizer all tests
  should contain at least two modules

Diagnostics in test `extendExpectedClassWithAbstractMember.kt` were
  changed because there is an exception from IrActualizer caused by
  errors from frontend (`ABSTRACT_METHOD_NOT_IMPLEMENTED`), which is
  swallowed by this kind of tests
2023-11-27 10:17:54 +00:00
Dmitriy Novozhilov 62d269b3b9 [AA] Use convertToIrAndActualize in KtFirCompilerFacility
It was the last place that manually called parts of fir2ir
2023-11-27 10:17:54 +00:00
Dmitriy Novozhilov ffe5b4c40d [Test] Update some IR dumps after previous changes
Now IR dump handlers receiver actualized IR with removed expected
  declarations, so corresponding tests should be updated accordingly
2023-11-27 10:17:54 +00:00
Dmitriy Novozhilov 48c3313e67 [Test] Inline processAllIrModuleFragments utility
After previous changes IR output artifact contains only one IrModuleFragment
2023-11-27 10:17:54 +00:00
Dmitriy Novozhilov 06af6adf4f [Test] Unify all fir2ir facades for non-jvm platforms
Setup of fir2ir for JS, Native and Wasm is very similar, so it makes
  sense to extract all common parts of it into common base facade
2023-11-27 10:17:54 +00:00
Dmitriy Novozhilov e38b25c278 [FIR2IR] Make convertAndActualize method the only entrypoint to fir2ir
Fir2Ir conversion consists of multiple steps with complex logic (like
  conversion of each module, actualization, plugins application, constant
  evaluation), and to ensure that they all are executed correctly it's
  convenient to have the single entry point for all this machinery
2023-11-27 10:17:54 +00:00
Dmitriy Novozhilov 075010b14e [Test] Get rid of some properties in IrBackendInput
`fir2IrComponents`, `irActualizerResult` and `dependentIrModuleFragments`
  were used in `IrActualizerAndPluginsFacade`, which was removed in the
  previous commit
2023-11-27 10:17:54 +00:00
Dmitriy Novozhilov 1303a33bea [Test] Get rid of IrActualizerAndPluginsFacade
IR actualization and IR plugins will be moved into base Fir2Ir facades
  in the following commits, so this facade is not needed anymore

It was easier and cleanlier to remove this facade first and only after
  that modify base facades
2023-11-27 10:17:54 +00:00
Sebastian Sellmair ddd97e84b9 [K/N] Implement lightweight tests for ObjC header generation 2023-11-27 09:08:54 +00:00
Kirill Rakhman 06811dfc2f [FIR] Add enum entry to body resolve context containers
This fixes processing of annotations on enum entries.
Before, the check in BodyResolveContext.forAnnotation would set the
tower data mode to CLASS_HEADER_ANNOTATIONS because no containers were
present.
This would lead to some tower data elements like nested classifiers
missing, which would lead to false positive unresolved references.

#KT-63761 Fixed
2023-11-27 09:00:17 +00:00
Anton Lakotka bb5e219c1d [Gradle] Explain reason for (isCanBeResolved && isCanBeConsumed) check 2023-11-26 18:47:29 +01:00
Anton Lakotka 7673434ccd [Gradle] Keep "-publishable" configurations as dependencyScope
As they would clash with the ones that is intended to be consumed as
project dependencies. It will not be compatible with future Gradle
versions. This should be fixed with KT-49919

^KT-60879
2023-11-26 18:47:29 +01:00
Anton Lakotka e73441843b [Gradle] Don't make native compilation api configuration resolvable
Instead, create a resolvableDetached configuration for that purpose.
Changing configuration roles is deprecated since Gradle 8.2

^KT-60879
2023-11-26 18:47:29 +01:00
Anton Lakotka 5d46e45da7 [Gradle] Fix tests for Gradle 8.2 compatibility
* Dependency scope configurations can't have attributes
* ConfigurationInternal.path is removed

^KT-60879
2023-11-26 18:47:29 +01:00
Anton Lakotka 2ab30d8880 [Gradle] Add role-based configuration method factories
Starting from Gradle 8.2 there is deprecation diagnostic that
disallows changing configuration roles after creation.

With Gradle 8.4 there is an Incubating API that introduces
role factories for Configuration. For consistency reasons names that
introduced in this commit match the names that Gradle introduces in 8.4
version.

^KT-60879
2023-11-26 18:47:29 +01:00
Abduqodiri Qurbonzoda e94b247835 Introduce Common StringBuilder.append/insert(Byte/Short) extensions #KT-63341 2023-11-26 02:48:19 +02:00
Abduqodiri Qurbonzoda db6a662631 Remove Common StringBuilder.append/insert(Byte/Short) members #KT-63341 2023-11-26 02:48:18 +02:00
Aleksei.Cherepanov c002af6365 Make plugin classpath serialization path agnostic
This is needed for correct usage of portable caches

^KT-63799 Fixed
2023-11-25 10:46:49 +00:00
Aleksei.Cherepanov ea85b30f88 Make CompilerSettings open to add listeners on IJ side
Workspace Model will return a copy of CompilerSettings instead of reference to the original one. Thats why we need to add listeners on it on IJ side

Relates to KTIJ-24647
2023-11-24 22:58:13 +00:00
Artem Kobzar 55d41db2ce [K/JS] Include jsFirEs6Test into jsFirCompilerTest tests 2023-11-24 22:09:43 +00:00
Mikhail Glukhikh e391e68ea3 K2: drop TypeParameterAsCallable check for reified in ::class
Related to KT-63377
2023-11-24 21:28:16 +00:00
Mikhail Glukhikh 83cfcc30c6 K2: handle type parameter vs nested class conflict in body resolve properly
This commit does two things:
- prioritize type parameter scopes against static scopes in body resolve
(effectively it's a revert of KT-58028 fix)
- consider type parameters as inapplicable callable, so during callable
resolve we can go up the tower and still resolve to static scope

This allows both KT-58028 and KT-63377 to work properly
#KT-63377 Fixed
2023-11-24 21:28:16 +00:00
Mikhail Glukhikh 4e938d852c K2: add some more tests around KT-63377 and KT-58028 2023-11-24 21:28:16 +00:00