Commit Graph

104460 Commits

Author SHA1 Message Date
Marco Pennekamp 3fa2ca7ddd [AA] Add specific implementation for KtFirEnumEntryInitializerSymbol
- Previously, `KtFirAnonymousObjectSymbol` was a
  `KtEnumEntryInitializerSymbol`, which carried the risk that an
  anonymous object unrelated to enum entries might be used as an enum
  entry initializer. This commit introduces a specific symbol for FIR
  enum entry initializers.
- As a nice side effect, anonymous object symbol creation is simplified
  and `KtFirEnumEntryInitializerSymbolPointer` can restore the symbol
  via `KtFirEnumEntrySymbol.enumEntryInitializer`.

^KT-61425
2023-09-08 11:13:28 +00:00
Marco Pennekamp 536e172d0e [AA] Add declared member scope tests for enum entry initializers
^KT-61425
2023-09-08 11:13:28 +00:00
Marco Pennekamp 72de86a8ba [AA] Add tests for enum class member scopes
^KT-61405
2023-09-08 11:13:28 +00:00
Marco Pennekamp 3aefeb0fc5 [AA] Add tests for enum entry initializer member scopes
^KT-61425
2023-09-08 11:13:28 +00:00
Marco Pennekamp 3add7f9db5 [AA] Support enum entry initializers in member scope tests
- Now that the enum entry initializer provides a member scope, not the
  enum entry, we need a way to get to the enum entry initializer in
  tests. This can only be done via the enum entry's name, because the
  initializer is anonymous.

^KT-61425
2023-09-08 11:13:28 +00:00
Marco Pennekamp 80efa34926 [AA] Add KtEnumEntryInitializerSymbol
- An enum entry's body is an initializer with members only accessible
  within that body. Because users of the Analysis API might want to
  analyze the members of the enum entry initializer, we expose this
  initializer via `KtEnumEntrySymbol`. The initializer only exists if
  the enum entry has a body.
  - We already have some usages of the initializer inside symbol light
    classes, which generate a light class for each enum entry, which
    includes the enum entry's hidden members.
- To hide the implementation detail that initializers are anonymous
  objects, `KtEnumEntryInitializerSymbol` is simply a
  `KtSymbolWithMembers`.
- The advantage of making it a `KtSymbolWithMembers`, instead of
  providing a custom way to get a member scope, is that we can pass
  around the initializer easily, e.g. in `KtEnumEntrySymbolRenderer`.
- We implement `KtEnumEntryInitializerSymbol` directly as a
  `KtFirAnonymousObjectSymbol` without a wrapper. This has a few
  advantages:
  1. We can directly benefit from the anonymous object symbol being a
     `KtSymbolWithMembers`, so we don't have to handle enum entry
     initializers specially in e.g. `KtFirScopeProvider`.
  2. We don't have to implement a new symbol restoration mechanism for
     the initializer.
  3. This implementation matches the actual FIR tree structure (with a
     simplification that the connecting anonymous object expression
     between the enum entry and the initializing anonymous object is
     omitted).

^KT-61425 fixed
2023-09-08 11:13:28 +00:00
Marco Pennekamp e72a38dc82 [AA] Remove KtSymbolWithMembers from KtEnumEntrySymbol
- An enum entry is a variable which doesn't declare any additional
  members. It must not be confused with its implementing anonymous
  object initializer, which may declare additional members, but is an
  implementation detail hidden outside the enum entry's initializer.
  Hence, the enum entry variable should not have a (declared) member
  scope.
- A following commit will add the ability to get the enum entry's
  initializer, so that a member scope for this initializer can be
  obtained (which might be relevant for local analysis).

^KT-61405 fixed
2023-09-08 11:13:28 +00:00
Marco Pennekamp f64cc184f4 [FIR] Refactoring: Introduce base implementations for delegating scopes
- The implementations of some FIR scopes contain a significant amount of
  delegation to some original scope. This pollutes the implementation of
  such scopes and makes them harder to read.
  `FirDelegatingContainingNamesAwareScope` and `FirDelegatingTypeScope`
  can be used as base classes which delegate by default.
2023-09-08 11:13:28 +00:00
Nikita Bobko 3c73331821 KMP: Put "prohibit actual typealias to special annotations" under the flag
^KT-61668 Fixed

Review: https://jetbrains.team/p/kt/reviews/12062/timeline
2023-09-08 10:51:43 +00:00
Nikita Bobko e742d43ee0 KMP: Put "prohibit expect/actual tailrec/external" under the flag
^KT-61668 Fixed

Review: https://jetbrains.team/p/kt/reviews/12062/timeline
2023-09-08 10:51:43 +00:00
Nikita Bobko 172c04c96a KMP: Put "prohibit expect actual OptIn annotations" under the flag
^KT-61668 Fixed

Review: https://jetbrains.team/p/kt/reviews/12062/timeline
2023-09-08 10:51:43 +00:00
Nikita Bobko 0922833b46 KMP: Put "prohbit actual typealias to Nothing and Nullable" under the flag
^KT-61668 Fixed

Review: https://jetbrains.team/p/kt/reviews/12062/timeline
2023-09-08 10:51:42 +00:00
Nikita Bobko 141bc9cac9 KMP: Put "prohbit actual typealias if expect has default params" under the flag
^KT-61668 Fixed

Review: https://jetbrains.team/p/kt/reviews/12062/timeline
2023-09-08 10:51:42 +00:00
Nikita Bobko 6868c95263 KMP: Put "prohbit expect/actual different annotations" under the flag
^KT-61668 Fixed

Review: https://jetbrains.team/p/kt/reviews/12062/timeline
2023-09-08 10:51:42 +00:00
Nikita Bobko 3a0c4d1087 KMP: Put "prohbit implicit Java actualization" under the flag
^KT-61668 Fixed

Review: https://jetbrains.team/p/kt/reviews/12062/timeline
2023-09-08 10:51:42 +00:00
Nikita Bobko 7667b36aa0 KMP: Put "prohibit member scope mismatch for non-final expect" under the flag
^KT-61668 Fixed

Review: https://jetbrains.team/p/kt/reviews/12062/timeline
2023-09-08 10:51:42 +00:00
Alexander Korepanov 238344758b [FIR] Fix the inability to retrieve an annotation argument
Fix an issue where an inherited @JsName from
another module was not accessible in a child class.

The issue can only be reproduced in the codegen box tests
and cannot be reproduced in the FIR FE checker tests.
2023-09-08 09:55:25 +00:00
Alexander Korepanov ea9e2eb41a [FIR JS] Add more tests for JS_NAME_CLASH and JS_FAKE_NAME_CLASH
^KT-59425 Related
^KT-59370 Related
2023-09-08 09:55:25 +00:00
Alexander Korepanov 6bb939c6cb [FIR JS] Support JS_NAME_CLASH and JS_FAKE_NAME_CLASH diagnostics
^KT-59425 Fixed
^KT-59370 Fixed
2023-09-08 09:55:25 +00:00
Alexander Korepanov 5ac277d058 [FIR JS] Generate diagnostic componentss for JS FIR FE checks
Generate components for JS_NAME_CLASH and JS_FAKE_NAME_CLASH

^KT-59425 Related
^KT-59370 Related
2023-09-08 09:55:25 +00:00
Roman Golyshev f5307173b5 KTIJ-26959 [AA] Do not ignore underscore named properties in KtFirImportOptimizer
After the fix for the KT-60904 issue (c963eadb),
there are unnamed declarations created even for
the unused variables in destructuring declarations

Because of this, we can actually align testData
for K1 and K2. It seems like KT-59504 is no
longer relevant and can be marked as obsolete
because of the KT-60904 fix

^KTIJ-26959 Fixed
2023-09-08 09:19:06 +00:00
Kirill Rakhman 9a2307ad44 [FIR] Fix expression types in java annotations
#KT-61518 Fixed
2023-09-08 07:40:30 +00:00
aleksandrina-streltsova f18d600dc8 [LL FIR] Return class as structure element for super type reference
^KT-61755 Fixed
2023-09-08 07:25:36 +00:00
Denis.Zharkov 3aa635a766 K2: Fix compilation after making Candidate::symbol a var
See the previous commits

Explicit cast became necessary as the smart cast stopped working there
2023-09-08 07:11:48 +00:00
Denis.Zharkov 034671ad78 K2: Update substituted member candidate if it contains type variables
See the comment at updateSubstitutedMemberIfReceiverContainsTypeVariable

It became necessary after delegate inference is rewritten, since before
that happened, stub types were being left there and FIR2IR handled
them accidentally properly because stub types are equal to anything.

But that wasn't really correct even there because stub types are not
intended to leak out of the FIR

^KT-61060
2023-09-08 07:11:48 +00:00
Denis.Zharkov 0f6a51fd97 K2: Adjust lazy test data after delegate inference rewritten
It's been changed because `getValue` might be not completed after
exiting from call transformation while contracts processing seems to be
working only with completed calls

^KT-61055 Related
2023-09-08 07:11:48 +00:00
Denis.Zharkov 033ff38fef K2: Adjust diagnostic test data after delegate inference is rewritten
In all tests, some red-code diagnostics have changed insignificantly
to some other combination or red-code diagnostics

^KT-61060 Related
2023-09-08 07:11:48 +00:00
Denis.Zharkov a02cb16fb2 K2: Rewrite delegate inference
The main idea is getting rid of stub types and using just type variables
See more detailed description at docs/fir/delegated_property_inference.md

The problem with stub types is that they need really special treatment
in many places, and on the other hand, there are no clear contracts on
how they should work (that regularly leads to bugs like KT-59529)

^KT-61060 Fixed
^KT-61075 Fixed
^KT-61077 Fixed
^KT-59529 Fixed
^KT-61633 Related
^KT-61618 Related
^KT-61740 Related
^KT-59107 Related
^KT-61747 Related
^KT-61077 Related
^KT-61781 Related
2023-09-08 07:11:48 +00:00
Denis.Zharkov cd5105c133 K2: Reformat FirCallCompletionResultsWriterTransformer.kt 2023-09-08 07:11:48 +00:00
Denis.Zharkov 06b0fc7e4c K2: Minor. Add comment for Candidate::substitutor 2023-09-08 07:11:48 +00:00
Denis.Zharkov f4004fb06a Add kdoc for ConstraintSystemCompletionMode.PARTIAL 2023-09-08 07:11:48 +00:00
Ivan Kylchik 6048d52a97 [K2] Avoid field inlining during FIR2IR phase
Before const inlining for fields, we actually want to remember a given
field in `InlineConstTracker`. We are doing it already in const
evaluation. So we just need to ignore const inlining in
`CallAndReferenceGenerator` and delegate it to const evaluation.

#KT-60737
2023-09-07 19:12:18 +00:00
Alexander.Likhachev 9dd4241a70 [Build, IGS] Make the consent checker tests parameterized tests 2023-09-07 17:32:37 +00:00
Alexander.Likhachev c7b2240c8e [Build, IGS] Add support for checking global consent 2023-09-07 17:32:37 +00:00
Alexander Shabalin a8cec11772 [K/N] Protect filecheck tests for KT-53261 from DCE. 2023-09-07 15:35:57 +00:00
Nikolay Lunyak f434228244 [FIR] Fix false positive POSITIONED_VALUE_ARGUMENT_FOR_JAVA_ANNOTATION
The original Java checker has an early return in
case of `resultingDescriptor !is JavaClassConstructorDescriptor`.
It fires if the descriptor is
`TypeAliasConstructorDescriptor`, thus further
diagnostics are not reported.
2023-09-07 13:48:22 +00:00
Rustam Musin 1efa9abf57 Add missing space in GradleStyleMessagerRenderer.render()
In `GradleStyleMessagerRenderer.render` method, when there is `location` pointing to some file and coordinates `line:column = 0:0`, then a space between the location and the message was not printed.
#KT-61737 Fixed
2023-09-07 13:34:59 +00:00
Nikolay Krasko 96a798d400 Revert "Ignore compose experimental modules during artifacts check"
This reverts commit a1250e838b.

KTI-1360
2023-09-07 13:26:38 +00:00
strangepleasures 88453a05f1 KT-53551 KT-52213 KT-58476 Fix handling of suspend functional types with context receivers 2023-09-07 12:40:01 +00:00
Nataliya.Valtman c2ee9bb1a4 Dont add languageVersion for KotlinNativeLink tasks
#KT-61401: Fixed
2023-09-07 12:34:22 +00:00
Dmitriy Novozhilov 37aad51438 [Build] Regenerate verification-metadata.xml in bootstrap-update script
This is needed for two purposes:
- sometimes dependencies may differ because of changes in KGP, and it's
  better to find it right after version-update commit, not only at remote run
- there is a plan to drop `trusted` section from `verification-metadata.xml`
  and always set specific versions of used dependencies even for bootstrap
  dependencies, so running it in regular bootstrap update routine won't
  allow forgetting about it (see KTI-1374)
2023-09-07 11:53:30 +00:00
Dmitriy Novozhilov 32cd4b7bad [Build] Update verification-metadata.xml to workaround KT-61766 2023-09-07 11:53:29 +00:00
Dmitriy Novozhilov db23c11e0b [Build] Update verification-metadata.xml 2023-09-07 11:53:29 +00:00
Dmitriy Novozhilov e69c9e2fc6 Advance bootstrap to 1.9.30-dev-2548 2023-09-07 11:53:28 +00:00
Vyacheslav Gerasimov 7d96623c37 Build: Extract toolchain resolve into a separate task
#KTI-72
2023-09-07 10:50:02 +00:00
Alexander Shabalin 49814ecb8a [K/N] Remove std_support allocation code ^KT-59008 2023-09-07 09:32:00 +00:00
Anton Bannykh 002cd011d4 [JS] add CLI test for KT-60531 2023-09-07 08:21:34 +00:00
Johan Bay 1e66f25546 [K/N] Link small bitcode modules together first
Repeatedly linking many smaller bitcode modules into one large is very
slow. We are seeing a 10x improvement by instead linking all the small
modules together first and link the result into the larger main module.
This commit implements this optimization in the
LinkBitcodeDependenciesPhase phase.

^KT-61604 Fixed


Co-authored-by: Johan Bay <jobay@google.com>
2023-09-07 07:44:31 +00:00
Alexander.Likhachev 6eaccc997f [Build] Fix the typo junit jupyter -> jupiter 2023-09-06 22:47:34 +00:00
Alexander.Likhachev a6f3dbb5f4 [Build] Remove unused AggregateTest 2023-09-06 22:47:34 +00:00