Commit Graph

105633 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 07c4cd231c [FIR2IR] Lazily load all classes in FIR2IR builtins which may appear in sources
If some of builtin classes is declared in sources, trying to load it in
  IrBuiltInsOverFir before fir2ir pass which generates IR for source
  declarations will lead to creating lazy class instead of normal one

Without this change the following tests are failing:
- `FirLightTreeBlackBoxInlineCodegenWithBytecodeInlinerTestGenerated.Signature`
  - `testByteIteratorWithWhileLoop`
  - `testByteIteratorWithForLoop`
2023-10-24 15:35:05 +00:00
Dmitriy Novozhilov 81821d4cd4 [FIR2IR] OptIn to using IrClass.declarations in all appropriate places 2023-10-24 15:35:05 +00:00
Dmitriy Novozhilov 38a7f2bc07 [IR] Mark utilities, which use IrDeclarationContainer.declarations with @IrSymbolInternals
Only those utilities are marked because only them are accessible in fir2ir.
  And in other modules it's allowed to access .declarations from anywhere
2023-10-24 15:35:05 +00:00
Dmitriy Novozhilov 78a705a1bc [Build] Opt in to IrSymbolInternals for some backend-specific modules 2023-10-24 15:35:05 +00:00
Dmitriy Novozhilov c8b7dbd352 [IR] Add optIn to IrDeclarationContainer.declarations
Accessing list of declaration may trigger lazy declaration list computation for lazy class,
   which requires computation of fake-overrides for this class. So it's unsafe to access it
   before IR for all sources is built (because fake-overrides of lazy classes may depend on
   declaration of source classes, e.g. for java source classes)

So this OptIn is needed to carefully handle all cases of .declarations access in FIR2IR
2023-10-24 15:35:05 +00:00
Troels Bjerre Lund 3556533d95 [K/N] Fix K2 detection in native tests
This updates how the requested language version is detected in native
tests, after language version 2 has become the default.
2023-10-24 14:00:34 +00:00
Kirill Rakhman 56f53fbd0b [FIR] Make ClassId not null in enum call mapped from java 2023-10-24 13:27:02 +00:00
Ilya Goncharov c9e328528e [Gradle,JS]make downloadBaseUrl nullable to work with FAIL_ON_PROJECT_REPOS
^KT-56300 fixed
^KT-55620 fixed
2023-10-24 13:10:12 +00:00
Evgeniy.Zhelenskiy f4d18da6a0 [FIR] Introduce OPERATOR_CALL_ON_CONSTRUCTOR diagnostic
#KT-59943
2023-10-24 12:24:52 +00:00
Ilya Kirillov 649bbcf35f [Analysis API] fix common code resolution which requires getting symbols from builtin session
A common platform builtin session before were created with `::wrapScopeWithJvmMapped`.
This required some other JVM session components to be registered.
We cannot register all JVM components in builtin session;
it would lead to problems like KT-62777.

So we use `::wrapScopeWithJvmMapped` only for true JVM sessions.

This commit fixes a test added in the previous commit for KT-62768.

^KT-62768 fixed
2023-10-24 11:44:42 +00:00
Ilya Kirillov 80fda25c58 [Analysis API] fix common code resolution which requires FirSyntheticPropertiesStorage
Added test `FirSourceLazyDeclarationResolveTestGenerated.Classes.testClassDelegatedInCommonCode`
now fails with another exception (KT-62772). It's fixed in the following commit.

^KT-62768 fixed
2023-10-24 11:44:42 +00:00
Dmitriy Novozhilov 0325ffaa01 [FIR] Properly handle nested annotations on compiler-required annotation phase
There was a case when we visited the same declaration multiple times
  because of forward-referencing and visiting with designation
So because of this there were two changes required:
- remove assertion about visiting the same declaration twice (it's fine
  since we don't actually resolve annotations twice)
- not skipping resolution of class children if annotations on this class
  are already resolved

^KT-61388 Fixed
KT-62854
2023-10-24 11:44:21 +00:00
Matt Groth 80257dc58f Remove print statement
This print statement should either be delated, as I did here, or if it must be kept should be properly logged at an INFO level so that gradle builds that are at the WARN level do not see this.
2023-10-24 11:16:32 +00:00
Svyatoslav Kuzmich aeeb5d5c48 [Wasm] Disallow dynamic type in K2 (KT-56849) 2023-10-24 10:54:58 +00:00
Anna Kozlova 5cac013d8c [AA] approximate inplace type parameters bounds
^ KTIJ-27211 fixed
2023-10-24 10:54:15 +00:00
Ivan Kochurkin f37f1e6d91 [FIR] Add a comment that explains why FirErrorTypeRefImpl is written manually 2023-10-24 10:53:33 +00:00
Ivan Kochurkin bb937a8a21 [FIR] Initialize annotations in FirErrorTypeRef
^KT-62447 Fixed
^KT-62628 Fixed
2023-10-24 10:53:33 +00:00
Dmitrii Gridin ec3cfdefcb [LL FIR] add missing file node to control flow graph
The file

^KT-62834 Fixed
2023-10-24 10:30:55 +00:00
Dmitrii Gridin a1ee07603a [FIR] add cfg dump to script test
^KT-62834
2023-10-24 10:30:55 +00:00
Dmitrii Gridin 2eb761adae [LL FIR] generate resolution tests over codegen/box testData
Such testData can contain contract violations and other resolution
problems, so we should check them as well

^KT-62776
^KT-62832
^KT-62834
^KT-62836
2023-10-24 10:30:55 +00:00
Dmitrii Gridin 052b9f01af [tests] TestRunner: wrap exceptions from preAnalysisHandlers
Some exceptions (like contract violations) can be thrown from preAnalysisHandlers
2023-10-24 10:30:55 +00:00
Dmitrii Gridin 5a786e25c2 [codegen] testData: move WITH_STDLIB to global scope 2023-10-24 10:30:55 +00:00
Dmitrii Gridin 09a1df9ee5 [codegen] testData: add missing directory structure for Java classes 2023-10-24 10:30:55 +00:00
Dmitrii Gridin bb00326197 [LL FIR] mark AbstractFirLazyDeclarationResolveTest test as thread safe 2023-10-24 10:30:55 +00:00
Sergej Jaskiewicz 9eacdb3314 [FIR generator] Print builder property name in generated classes' KDocs
Just like we do when generating the IR tree
2023-10-24 10:29:43 +00:00
Sergej Jaskiewicz fa20e401f8 [IR generator] Rename kdoc -> kDoc property in FieldConfig 2023-10-24 10:29:43 +00:00
Sergej Jaskiewicz 7e7f4811bd [FIR/IR generator] Add kDoc property to AbstractElement & AbstractField 2023-10-24 10:29:43 +00:00
Xin Wang 51325ba630 [IR] Implement getContextReceiverParameters for IrBasedPropertyDescriptor
Fixes: KT-59590
2023-10-24 10:07:08 +00:00
cristiangarcia 03ad981dea Make ClangFrontend cacheable
Co-authored-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>


Merge-request: KT-MR-11479
Merged-by: Cristian Garcia <Cristian.Garcia-Marin@jetbrains.com>
2023-10-24 09:50:02 +00:00
Alexander Shabalin b3e13fb2c2 [K/N] Migrate runtime/collections tests to new testing infra ^KT-61259 2023-10-24 09:27:46 +00:00
Dmitrii Krasnov 10a6d8fd2c [Gradle IT] Added configuration for running IT with k/n from master
[Gradle] Updated kotlin-build-gradle-plugin to 0.0.40

#KT-45978 Ready for Review


Merge-request: KT-MR-12509
Merged-by: Dmitrii Krasnov <Dmitrii.Krasnov@jetbrains.com>
2023-10-24 08:38:51 +00:00
Nataliya.Valtman 80485809d9 Add runtimeOnly and compileOnly dependencies to FUS
#KT-62617 Fixed
2023-10-24 08:22:28 +00:00
Nataliya.Valtman e66f41da95 Add build report usage to FUS
#KT-62264 Fixed
2023-10-24 08:20:22 +00:00
Roman Golyshev 44d48510b4 KTIJ-26057 [AA] Ignore implicit receivers scope when dealing with types in reference shortener
Implicit receivers generally do not affect the resolution of types.
However, they generate scopes which might contain undesirable
classifiers, which can confuse reference shortener.

Dropping all the implicit receivers when dealing with type references
allows completely avoid such undesirable scopes instead of filtering
them by `instanceof` checks.

Also, temporary move `hasTypeParameterFromParent` check higher to the
`findClassifierElementsToShorten`, because ATM we don't know how to
properly decide whether to shorten the fully-qualified inner types
with implicit parameters or not (see KTIJ-26072).

^KTIJ-26057 Fixed
2023-10-24 07:47:30 +00:00
Kirill Rakhman 65ff684589 [FIR] Don't discriminate generics in conflict resolution for callable references
#KT-59430 Fixed
2023-10-24 07:27:07 +00:00
Igor Chevdar 141dc96067 [gradle][tests] Disabled K/N incremental compilation tests on Windows 2023-10-24 06:02:21 +00:00
Alexander Udalov b5ba9ee671 IR: refactor resolveFakeOverride call sites
Split it to 4 functions for clarity: resolveFakeOverride,
resolveFakeOverrideOrFail, resolveFakeOverrideMaybeAbstract,
resolveFakeOverrideMaybeAbstractOrFail. Remove/inline duplicated
utilities and remove unused parameters.
2023-10-23 23:38:47 +00:00
Marco Pennekamp e52529a1d1 [AA] Regenerate script tests for added KDoc reference resolve tests 2023-10-23 23:08:01 +00:00
Marco Pennekamp f04b27b90b [AA] Add additional KDoc reference resolution tests for callables
- This adds KDoc reference resolution tests for callables in nested and
  inner classes, overloaded functions, and private callables.
- Private declarations are visible in KDoc from outside their containing
  classes. This is in line with K1 KDoc behavior.

^KTIJ-22324
2023-10-23 23:08:01 +00:00
Marco Pennekamp ef484c7518 [AA] Fix KDoc reference resolution of non-imported companion object members
- Similar to the fix for KTIJ-25995, the name interpretation collector
  needs to consider the companion object's member scope as well.

^KTIJ-25995
2023-10-23 23:08:01 +00:00
Marco Pennekamp 0add17d9da [AA] Fix KDoc reference resolution of companion object members
- The nested scope construction in `getSymbolsFromMemberScope` was
  missing the companion object member scope.

^KTIJ-25995 fixed
2023-10-23 23:08:01 +00:00
Marco Pennekamp 71792f9ad6 [AA] Add test for KDoc reference resolution of sibling nested class 2023-10-23 23:08:00 +00:00
Marco Pennekamp 367b84d45e [AA] Add tests for KDoc reference resolution of companion object members
^KTIJ-25995
2023-10-23 23:08:00 +00:00
Marco Pennekamp 3dbae89cdd [AA] Add tests for KDoc reference resolution of non-static callables
^KTIJ-26003
2023-10-23 23:08:00 +00:00
Marco Pennekamp 2acee69908 [AA] Fix KDoc reference resolution for non-static callables from supertypes
- We should use member scopes to find symbols from supertypes.
- The issue was already fixed for static callables because the declared
  member scope was composed with the static member scope. See
  KTIJ-25960.

^KTIJ-26003 fixed
2023-10-23 23:08:00 +00:00
Svyatoslav Kuzmich 2694326ef8 [Wasm] Add EXTERNAL_TYPE_EXTENDS_NON_EXTERNAL_TYPE K2 diagnostic
Prohibit extending non-external types with external types (same as K1)

Issue KT-56849
2023-10-23 17:31:04 +00:00
cristiangarcia cc2280a146 Make KonanCompileLibraryTask cacheable
Merge-request: KT-MR-11117
Merged-by: Cristian Garcia <Cristian.Garcia-Marin@jetbrains.com>
2023-10-23 16:55:14 +00:00
Brian Norman 29807af9cb [FIR] Extract symbol from candidates for function contract DFA
^KT-61055 Fixed
2023-10-23 16:29:47 +00:00
Evgenii Mazhukin 6ed7e83378 [IC][MPP] Upgrade tests for incremental scenarios with expect-actual
Existing tests were k1-only in CI. Simplified test project, added
assertions for native. Switched to the new test Dsl.

^KT-61845 duplicates KT-61590
^KT-56963 in progress

Merge-request: KT-MR-12651
Merged-by: Evgenii Mazhukin <evgenii.mazhukin@jetbrains.com>
2023-10-23 13:24:08 +00:00
Alexander.Likhachev 1556925358 [Gradle] Unify a bit logic of retrieving task loggers 2023-10-23 13:04:17 +00:00