Commit Graph

106009 Commits

Author SHA1 Message Date
Roman Golyshev 2f50267d3f KT-63096 [LL] Make KotlinStaticAnnotationsResolver more correct
By using `KotlinDeclarationProvider`, it can now check that the
annotation is actually present in the scope
2023-11-09 23:39:32 +00:00
Roman Golyshev a1155204c7 KT-63096 [LL] Remove KtModuleScopeProvider
It has no usages anymore
2023-11-09 23:39:32 +00:00
Roman Golyshev bda677d2ad KT-63096 [LL] Use full module resolution scope to create KotlinAnnotationsResolver
`KotlinAnnotationsResolver` must see everything that is resolvable from
the current module; otherwise it will not work properly.

The previous scope was the module itself + its binary dependencies
(jars).
Now the scope will contain the module itself and ALL its dependencies,
including other modules.

^KT-63096 Fixed
2023-11-09 23:39:31 +00:00
Vladimir Sukharev 296d7153e6 Revert "Use IntelliJ inspection "PublicApiImplicitType""
This reverts commit dd5f6a7619.
2023-11-09 21:59:03 +01:00
Brian Norman 6df97dd199 [FIR] Add test cases to prove resolution of backlog tickets
^KT-41728 Fixed
^KT-46586 Fixed
^KT-49696 Fixed
^KT-51160 Fixed
^KT-53308 Fixed
2023-11-09 19:28:26 +00:00
Nikita Bobko 2b82726f1d Cleanup: rename getSingleExpectForActualOrNull w.r.t. KT-62590
New name makes slightly more sense after KT-6259 is fixed
2023-11-09 17:58:43 +00:00
Jaebaek Seo e80f044847 K2: Update reference shortener to handle import alias
The existing reference shortener does not use import alias when it
shortens a symbol. Instead, it adds a new import directive for the
symbol that is already imported. This commit updates reference shortener
to let it reuse the existing import alias rather than adding a new one:

 1. When shortening a symbol, check whether the symbol is already
    imported.
 2. If it is already imported by an import alias, keep the symbol
    reference expression and the import alias as a string together in
    `ShortenCommand`.

The actual PSI update (shortening) based on the ShortenCommand is done
by IntelliJ.

^KTIJ-27205
2023-11-09 14:34:38 +00:00
Sergej Jaskiewicz 02c12ae26f [FIR generator] Write kDocs for accept & transform methods in FirElement 2023-11-09 13:30:25 +00:00
Sergej Jaskiewicz ed28923282 [IR generator] Don't use kotlinpoet for auto-generating IR tree classes
KT-61970 Fixed
KT-61703 Fixed
2023-11-09 13:30:25 +00:00
Sergej Jaskiewicz 63e9dd588c [FIR generator] Factor out element printer to common module
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-11-09 13:30:25 +00:00
Sergej Jaskiewicz 84bd12c667 [FIR generator] Factor out field printer into the common code
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-11-09 13:30:25 +00:00
Sergej Jaskiewicz bca35c0015 [FIR/IR generator] Add default arguments to TypeVariable constructor 2023-11-09 13:30:25 +00:00
Marco Pennekamp 730f98ba38 [FIR] Fix top-level property initialization checks in scripts
- While `collectionInitializationInfo` unwrapped a script's top-level
  declarations, `check` forgot to do it, so a script effectively had no
  top-level properties in the mind of the checker.

^KT-63286 fixed
2023-11-09 13:09:39 +00:00
Marco Pennekamp 1cc2390af6 [FIR] Add tests for top-level property initialization in scripts
- The test data is missing initialization checks and will be fixed with
  the subsequent commit.
- The test data is originally taken from
  `backingField/TopLevelPropertyInitialization` and has been simplified.
- I didn't add `const val` properties to the test data (compared to the
  original) due to KT-20110.

^KT-63286
2023-11-09 13:09:39 +00:00
Dmitrii Gridin 891e1fb59b [LL FIR] do not render redundant phases during lazy resolution tests
There is no sense to rendering phases which are lower than the base one
because the output will be the same as the baseline

^KT-63042
2023-11-09 13:07:14 +00:00
Dmitrii Gridin b0d72c6292 [LL FIR] add lazy resolve tests for substitution override on function
^KT-63042
2023-11-09 13:07:14 +00:00
Dmitrii Gridin 9506f3d1f4 [LL FIR] extract base logic of lazy resolution tests
^KT-63042
2023-11-09 13:07:14 +00:00
Dmitrii Gridin a25bac4bf9 add tests on implicit type with inaccessible annotations
^KT-63042
2023-11-09 13:07:14 +00:00
Dmitrii Gridin 80fcf9b09e [LL FIR] render all files during lazy resolution tests
This helps to find implicit changes

^KT-63042
2023-11-09 13:07:13 +00:00
Troels Bjerre Lund 58a99da54f [K/N] Pack instance fields better
This change reorders declared fields such that LLVM can pack each class
space optimally, minimizing the padding required. The guarantee is that
an objects body will take up space equal to the sum of the sizes of its
fields (inherited and declared) rounded up to a multiple of 8 bytes.
This also implies that no object will contain more than 7 bytes of
padding.
2023-11-09 12:34:30 +00:00
Alexander.Likhachev 0333985445 [Build] Remove kotlin-gradle-plugin-compiler-dependencies
We should consider the information from the removed buildscript to resolve KT-61706
^KT-62650 Fixed
2023-11-09 12:19:23 +00:00
Alexander.Likhachev defa0b955b [Gradle] Use kotlin-compiler-embeddable instead of kotlin-gradle-plugin-compiler-dependencies
^KT-62650 In Progress
2023-11-09 12:19:23 +00:00
Ivan Kochurkin 64db96eda3 [K1, K2] Use safe names when accessing to type parameters
^KT-57529 Fixed
2023-11-09 12:21:43 +01:00
Ivan Kochurkin 3188f01720 [FIR] Handle ConeIntersectionType in createSimpleType
^KT-62819 Fixed
2023-11-09 11:19:07 +00:00
Dmitriy Novozhilov 11586975e8 [FIR2IR] Add KDoc to Fir2IrConfiguration.linkViaSignatures flag 2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov 687f5fc20d [Native] Add fast check that stdlib is present in klib dependencies
Previous changes uncovered a problem with lacking of stdlib in
  dependencies, which was quite hard to debug and determine.
  So this check is supposed to discover similar issues in the future
  much more easily.
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov b4d29aa583 [Native] Enable linkViaSignatures for K2/Native compiler
Setting `linkViaSignatures = false` leads to the situation when fir2ir
  provides no guarantees about how SymbolTable is filled, so if some
  backend relies on symbol table content (JS and Native does) then
  it's required to set this flag to `true`

The issue was uncovered by previous commits because previously fir2ir
  created symbols with signatures for some declarations even with
  disabled flag, which was fixed by those commits
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov 740dcfe3c5 [FIR2IR] Manage enum entry symbols in declaration storage instead of declaration generator
This is needed to be able to implement creation of unbound symbols
 for references of corresponding declarations (KT-62856)
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov 10ad526936 [FIR2IR] Manage typealias symbols in declaration storage instead of declaration generator
This is needed to be able to implement creation of unbound symbols
 for references of corresponding declarations (KT-62856)
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov d4b0627640 [FIR2IR] Manage class symbols in declaration storage instead of declaration generator
This is needed to be able to implement creation of unbound symbols
 for references of corresponding declarations (KT-62856)
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov 7652752e3f [FIR2IR] Pass proper typeOrigin to implicitCastOrExpression
Without it the following test is failing:
- `org.jetbrains.kotlin.test.runners.ir.FirPsiJvmIrTextTestGenerated.Types#testGenericPropertyReferenceType`
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov 78259e3ee0 [FIR2IR] Manage type parameter symbols in declaration storage instead of declaration generator
This is needed to be able to implement creation of unbound symbols
 for references of corresponding declarations (KT-62856)
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov 36c0ed3c9e [FIR2IR] Get rid of last usage of symbolTable in Fir2IrCallableDeclarationsGenerator 2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov aab5664c5b [FIR2IR] Manage script symbols in declaration storage instead of declaration generator
This is needed to be able to implement creation of unbound symbols
  for references of corresponding declarations (KT-62856)
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov cd0baef087 [FIR2IR] Manage field symbols in declaration storage instead of declaration generator
This is needed to be able to implement creation of unbound symbols
  for references of corresponding declarations (KT-62856)
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov aadc9ce6d5 [FIR2IR] Manage property symbols in declaration storage instead of declaration generator
This is needed to be able to implement creation of unbound symbols
  for references of corresponding declarations (KT-62856)
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov fe66f3a384 [FIR2IR] Manage constructor symbols in declaration storage instead of declaration generator
This is needed to be able to implement creation of unbound symbols
  for references of corresponding declarations (KT-62856)

There was an exception from FIR2IR that was fixed with this change,
 so fir2ir test SuperClass started to pass along with IrActualizer,
 which reported some new errors
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov 3c0f153de4 [FIR2IR] Manage function symbols in declaration storage instead of declaration generator
This is needed to be able to implement creation of unbound symbols
  for references of corresponding declarations (KT-62856)

There was an exception from FIR2IR that was fixed with this change,
  so fir2ir test expectDeclarationWithWeakIncompatibilities started to
  pass along with IrActualizer, which reported some new errors
2023-11-09 10:43:31 +00:00
Alexander Udalov 953f6ba6b6 K2: keep FlexibleNullability on enhanced type parameter types
Types based on type parameters which have both hasEnhancedNullability
and hasFlexibleNullability were incorrectly converted to IR: only
`@EnhancedNullability` annotation was added to the IR type. This means
that the nullability of the type started to matter, which is incorrect
because the type is supposed to be flexible.

This backfired in the IR fake override builder mode, where nullability
of methods inherited from both Kotlin maps and Java maps clashed, which
resulted in the exception from FakeOverrideRebuilder.

If the type is both flexible and enhanced, we're now adding
`@FlexibleNullability` to the IR type. Note that `@EnhancedNullability`
is not needed because it only affects primitive types which need to be
handled as wrapper types on JVM, but `@FlexibleNullability` already has
that effect.

IR still slightly differs from K1 for collection subclasses, which can
be seen for example in the changed IR text tests. This is to be
investigated later.

The change in tests is needed because the `kt48495*.kt` tests are now
passing on K2 in the IR fake override builder mode, while failing on the
vanilla K2.

This is related to KT-61370 but does not entirely fix it, although
curiously it fixes all remaining tests which were muted because of it.
2023-11-09 09:13:28 +00:00
Anton Lakotka fe87f41c39 [Gradle] Correct valueSourceProviderCompat
* rename it to valueSourceWithExecProviderCompat
* After Gradle 7.5 use provider.of

^KT-63044
2023-11-09 08:09:56 +00:00
Dmitrii Gridin ba7c341338 [LL FIR] annotation calculator for scripts should process only script inself
We shouldn't calculate annotations inside unrelated declarations without lock

^KT-63042
^KT-63282
2023-11-08 23:22:19 +00:00
Dmitrii Gridin 4f2750a189 [LL FIR] add missed annotation arguments resolution for script generated declarations
^KT-63282 Fixed
2023-11-08 23:22:19 +00:00
Dmitrii Gridin dc158d2b29 [LL FIR] add lazy resolve test on propagated type in $$result
^KT-63282
2023-11-08 23:22:19 +00:00
Vladimir Sukharev dd5f6a7619 Use IntelliJ inspection "PublicApiImplicitType" 2023-11-08 21:05:52 +00:00
Igor Yakovlev 38695ff14c Fix Wasm gradle plugin DSL invalid behaviour
Fixed #KT-63315
2023-11-08 18:48:33 +01:00
Ilya Kirillov d2b9b487c7 [Analysis API] add test for resolution into declarations with the kotlin. package
^KT-63223
2023-11-08 17:32:49 +00:00
Ilya Kirillov 063d73fa73 [Analysis] migrate analysis modules to use cliArgument helper instead of hardcoded CLI argument names
^KT-63294
2023-11-08 17:32:48 +00:00
Ilya Kirillov 6f097dc8f6 Introduce utility function for specifying compiler argument names
^KT-63294
2023-11-08 17:32:48 +00:00
Ilya Kirillov c54d83dcad [Analysis API] fix resolution to declarations inside kotlin*. packages
`kotlin*.` packages should be always allowed.
`kotlin.` packages should be allowed if `AnalysisFlags.allowKotlinPackage` is `true`

^KT-63223 fixed
2023-11-08 17:32:48 +00:00
Aleksei.Glushko d22218e4e4 [K/N] Non-worker work source in ParalleProcessor
To be used as thread-local mark queue in concurrent mark.


Merge-request: KT-MR-12723
Merged-by: Alexey Glushko <aleksei.glushko@jetbrains.com>
2023-11-08 17:20:15 +00:00