Commit Graph

3165 Commits

Author SHA1 Message Date
Dmitrii Gridin b59e66c217 [LL FIR] add test on annotation type copy
^KT-60387
2023-07-19 11:50:12 +00:00
Dmitrii Gridin 14327d51ed [LL FIR] invalidateAfterInBlockModification: do not treat adding of body as in-block modification
It is an out-of-block modification because some diagnostics depend
on a fact of a body's existence

^KT-60518
2023-07-19 10:32:10 +00:00
Dmitrii Gridin 5f24ad114c [LL FIR] AbstractInBlockModificationTest: add more tests
^KT-60518
2023-07-19 10:32:10 +00:00
Dmitrii Gridin f0d8a1cbe9 [LL FIR] AbstractInBlockModificationTest: cover getNonLocalReanalyzableContainingDeclaration
^KT-60518
2023-07-19 10:32:10 +00:00
Dmitrii Gridin c2fd245ca1 [LL FIR] getSelectedElement should return PsiElement
^KT-60518
2023-07-19 10:32:10 +00:00
Dmitrii Gridin 32ad4380b3 [FIR] make java annotation mapping lazily
to avoid contract violations from getDeprecation

^KT-59342 Fixed
^KT-60520
2023-07-18 16:48:53 +00:00
Alexander Korepanov 08d158f901 [JS FIR] Support JS module system FE diagnostics
Support CALL_TO_JS_MODULE_WITHOUT_MODULE_SYSTEM diagnostic
^KT-59377 Fixed

Support CALL_TO_JS_NON_MODULE_WITH_MODULE_SYSTEM diagnostic
^KT-59381 Fixed

Support CALL_FROM_UMD_MUST_BE_JS_MODULE_AND_JS_NON_MODULE diagnostic
^KT-59417 Fixed
2023-07-18 14:02:30 +00:00
Alexander Korepanov 6034d32d7c [JS FIR] Support DYNAMIC_NOT_ALLOWED diagnostic
^KT-59384 Fixed
2023-07-18 14:02:30 +00:00
Alexander Korepanov 39fba56de9 [JS FIR] Support PROPERTY_DELEGATION_BY_DYNAMIC diagnostic
^KT-59406 Fixed
2023-07-18 14:02:30 +00:00
Alexander Korepanov f6b7a07efe [JS FIR] Support EXTERNAL_INTERFACE_AS_REIFIED_TYPE_ARGUMENT diagnostic
^KT-59416 Fixed
2023-07-18 14:02:30 +00:00
Ilya Kirillov 08400d930f [Analysis API, FIR] migrate ::class.java -> ::class inside error messages
They seem to provide similar results and the `.java` part is redundant
2023-07-18 11:49:21 +00:00
Ilya Kirillov 24db4e62f5 Migrate some FIR/Analysis API KotlinExceptionWithAttachment usages to buildErrorWithAttachment API 2023-07-18 11:49:21 +00:00
Ilya Kirillov a9cd881a07 [FIR] add utilities to FIR compiler to throw error with attachment 2023-07-18 11:49:20 +00:00
Ilya Kirillov c5014d4765 Move PsiElement.getElementTextWithContext to psi module with small adjustments
* replace existing function (the new one makes it more clear which element was printed)
* prints position for element
* handles invalid psi element
2023-07-18 11:49:20 +00:00
Ilya Kirillov 4b3bff3344 Rework checkWithAttachment/requireWithAttachment
* better naming
* throw corresponding KotlinIllegalStateExceptionWithAttachments/KotlinIllegalArgumentExceptionWithAttachments instead of general KotlinRuntimeExceptionWithAttachments
2023-07-18 11:49:20 +00:00
Ilya Kirillov 2d791eb292 Rename buildErrorWithAttachment -> errorWithAttachment to emphasise the similar semantics to kotlin.error 2023-07-18 11:49:20 +00:00
Ilya Kirillov 15f6fe2627 Move ExceptionAttachmentBuilder near KotlinExceptionWithAttachments so it's accessible from KotlinExceptionWithAttachments 2023-07-18 11:49:20 +00:00
Ilya Kirillov 25911b1fec Move SmartPrinter to kotlin.core.util.runtime so it's accessible from KotlinExceptionWithAttachments 2023-07-18 11:49:20 +00:00
Ilya Kirillov 6f429ec072 [Analysis] migrate ExceptionAttachmentBuilder to use SmartPrinter
So it can be moved to a compiler module
2023-07-18 11:49:20 +00:00
Ilya Kirillov 4b523825be [Analysis API] forbid providing custom KtLifetimeToken for every analyze call
^KT-60488 fixed
2023-07-18 08:47:34 +00:00
Dmitriy Novozhilov 73b580572b [FE] Move @PrivateForInline optIn into :core:compiler.common
This is needed to be able to use it in backend modules too
2023-07-17 21:02:40 +00:00
Dmitrii Gridin 38b55c659b [LL FIR] LLFirResolveSessionDepended: add missing mapping for resolveToFirSymbol
We should try to find a declaration from our mapping firstly
Otherwise we can find an invalid element

^KT-60451 Fixed
2023-07-17 17:15:35 +00:00
Mikhail Zarechenskiy 3cdb28e95f Remove last usage of ModelBranch API
It was decided to remove ModelBranch completely from Intellij API, see IDEA-309887
2023-07-17 13:52:53 +00:00
Dmitrii Gridin 1642eaa48a [FIR] getValueClassUnderlyingParameters: fix TODO
^KT-53573 Obsolete
2023-07-17 08:59:17 +00:00
Justin Paupore 9f85739599 [AA] Add KtResolveExtensionInfoProvider to AA.
This provider is responsible for answering queries related to resolve
extensions. At the moment, this includes retrieving a KtScope with all REx
top-level declarations (moved from KtSymbolFromResolveExtensionProvider), and
retrieving information necessary to supply a GeneratedSourcesFilter for REx
generated code. Future REx-related functions can be added to this interface.

^KT-59329
2023-07-14 19:32:09 +02:00
Justin Paupore fa0209a322 [AA] Expand functionality of TestScopeRenderer.
- Add package and constructor listings
- Add single-scope renderForTests() implementation, including a lambda
  to provide additional information about each symbol
- Remove special handling for empty scopes (interfered with single-scope
  rendering)

^KT-59329
2023-07-14 19:32:08 +02:00
Justin Paupore f01b824751 [AA] Show symbol origins in REx tests.
This is in preparation for adding a separate KtSymbolOrigin for
resolve extension symbols.

^KT-59351
2023-07-14 19:32:08 +02:00
Justin Paupore 734b87b97e [AA] Allow specifying REx file contents in testdata.
Tests can now specify the code generated by a resolve extension from
within the test's testdata. Module-level directives control whether
resolve extensions are enabled for that module, as well as package names
and source shadowing regexes. File-level directives allow a `// FILE:`
block within the testdata to be converted into a KtResolveExtensionFile
and removed from the module as a whole. (This requires a new
`ModuleStructureTransformer`, because we need to be able to entirely
remove the files in question.)

Any test can add support for these directives by calling
`KtResolveExtensionTestSupport.configure` from within their
`configureTest` stanza. This allows this functionality to be used in
conjuction with any test base class.

^KT-59329
2023-07-14 19:32:08 +02:00
Mikhail Glukhikh 00b4ae6ae9 K2: expand type before isSomeType checks properly
Related to KT-60229
2023-07-14 16:38:47 +00:00
Mikhail Glukhikh 402e1de5fe K2: reproduce KT-60229 2023-07-14 16:38:47 +00:00
Brian Norman d2ad426350 [FIR] Fix node ordering for delegating constructor graph
Inject delegated constructor and other in-place initializer sub-graphs
after the delegated constructor call node. This ensures property
initialization and use is calculated correctly when there are complex
calculations for the arguments to the delegated constructor.

#KT-59708 Fixed
#KT-59832 Fixed
2023-07-14 13:42:29 +00:00
Egor Kulikov 70d49999ac [FIR] Generate an error primary constructor when super call is invalid
Merge-request: KT-MR-11026
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-07-13 17:37:48 +00:00
Roman Efremov a79282cec1 [FE] Prohibit actual typealias to certain compiler annotations
^KT-58554
2023-07-13 16:12:59 +00:00
Stanislav Ruban 5c644bcac8 [test infra] Add a directive for type checking utils that use @Exact 2023-07-13 13:41:36 +00:00
Andrei Klunnyi 0323b0fb19 KT-59801 [FIR] scripting: tests for reference shortening 2023-07-13 15:21:39 +02:00
Dmitrii Gridin 3d40eba379 [LL FIR] LLFirContractsLazyResolver: add isResolved check
Currently, FirLegacyRawContractDescription is a valid class for
resolved contract in case of error description.
This condition should be dropped after KT-60310

^KT-60310
2023-07-13 12:27:02 +00:00
Dmitrii Gridin 4b330e88be [LL FIR] LLFirLazyResolver: implement checkIsResolved
To simplify logic and avoid boilerplate
2023-07-13 12:27:02 +00:00
Dmitrii Gridin 5b6e6b7a4e [LL FIR] LLFirLazyResolver: implement updatePhaseForDeclarationInternals
To avoid code duplication in each implementation
2023-07-13 12:27:02 +00:00
Dmitrii Gridin 660385b67d [LL FIR] move annotation type checks to TYPES phase resolver
LLFirTypeTargetResolver in general is responsible for annotation
type resolution, so such checks should be done on its phase.

Also, there is no sense to trying to check a type of annotation mapping
values because they will be initialized only during
LLFirAnnotationArgumentsMappingTargetResolver so, in most cases,
current check during LLFirAnnotationArgumentsLazyResolver is useless

^KT-60295 Fixed
2023-07-13 12:27:02 +00:00
Jinseong Jeon 5596c3ae80 AA: better error message for file w/o containing module
...instead of throwing NoSuchElementException
2023-07-13 11:51:23 +02:00
Dmitrii Gridin b67b37cdb3 [FIR] FirJavaFacade: do not duplicate record constructor
The fresh version of intellij has all record-related declarations,
so an additional fake constructor leads to errors like
KTIJ-25364 (OVERLOAD_RESOLUTION_AMBIGUITY)

^KTIJ-25366 Fixed
^KTIJ-25364 Fixed
^KTIJ-25368 Fixed
^KTIJ-25370 Fixed
2023-07-13 09:21:38 +00:00
Mikhail Glukhikh 17da09bf17 K2: add ConeKotlinType argument for NULL_FOR_NONNULL_TYPE 2023-07-13 09:07:39 +00:00
Mikhail Glukhikh 9d9d7880af K2: render types in quotes in diagnostic messages 2023-07-13 09:07:39 +00:00
Mikhail Glukhikh c839cd3c11 K2: don't use debugging type renderer in error messages 2023-07-13 09:07:39 +00:00
Roman Efremov 4a598afc36 [FE] Prohibit expect or actual opt-in annotations
^KT-58554
2023-07-13 08:15:42 +00:00
Anna Kozlova a2cefbc6be [LL] retrieve module by original file
originalDeclaration is set for non-local declarations only,
thus requesting symbols for local declarations still goes
with non-physical elements
This lead to ModuleKind.BINARY_MODULE
for `NotUnderContentRootModule`s, because the declaring file is different

KT-60377
2023-07-12 15:37:53 +00:00
Ivan Kochurkin ca93165044 [FIR] Remove useless code discovered by code coverage 2023-07-12 13:11:24 +00:00
Brian Norman 10ed26991d [FIR] Extract LHS receiver of assignment operator statements
#KT-53490 Fixed
2023-07-12 11:41:33 +00:00
Anastasia.Nekrasova fcba0ad75e [Test] Add a test covering for resolution to subsumed members for raw types
^KT-57620
2023-07-12 09:11:01 +00:00
Timofey Solonin e12e78d96b Add an explicit diagnostic for when expect/actual modifiers are used in
an unsupported compilation

^KT-31281
2023-07-12 08:29:28 +00:00