Commit Graph

3976 Commits

Author SHA1 Message Date
Anna Kozlova 5cac013d8c [AA] approximate inplace type parameters bounds
^ KTIJ-27211 fixed
2023-10-24 10:54:15 +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 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 bb00326197 [LL FIR] mark AbstractFirLazyDeclarationResolveTest test as thread safe 2023-10-24 10:30:55 +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
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
Brian Norman 29807af9cb [FIR] Extract symbol from candidates for function contract DFA
^KT-61055 Fixed
2023-10-23 16:29:47 +00:00
Vladimir Sukharev f98451e381 rrn/sukharev/kt59433-add-text-for-NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE
Follow-up to https://jetbrains.team/p/kt/reviews/12502/timeline which was incomplete for https://youtrack.jetbrains.com/issue/KT-59433/K2-Missing-NESTEDCLASSACCESSEDVIAINSTANCEREFERENCE
- Fix test DefaultMessagesTest by adding a text for new diagnostic.
- Move diagnostic's definition into better place

Merge-request: KT-MR-12680
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-10-20 18:04:21 +00:00
Ivan Kylchik 69a888b431 [FIR] Add diag test to verify const checker in Java world
Currently, this test is not working for FIR.

#KT-57802 Fixed
2023-10-20 16:33:21 +00:00
Marco Pennekamp 72438f4969 [AA] Remove obsolete memberScopeByFqName test data
- The test data was already moved to `memberScope`, but some files were
  not deleted (see: 67ac985be7).
2023-10-20 13:28:12 +00:00
Roman Golyshev 0747fc36de KTIJ-27434 [AA] Unwrap safe call expression when resolving implicit invoke calls
`FirSafeCallExpression` does not implement `FirResolvable`, so we need
to unwrap it to correctly resolve calls like `foo?.bar()` when `bar` is
a lambda with receiver parameter or a functional type property

^KTIJ-27434 Fixed
2023-10-20 13:27:31 +00:00
Pavel Kirpichenkov 770332152b [LL] Don't register Java components for built-ins of non-JVM modules
This is the cause for the 'missing dependency supertype: Serializable'
issue: symbols from built-ins will have the additional Serializable
supertype provided by FirJvmDeserializationExtension that shouldn't
be used for non-JVM. In regular modules it is correctly not added by
the non-JVM sessions, leading to difference in supertypes and the error.

KTIJ-27449
2023-10-20 10:35:13 +00:00
Dmitrii Gridin 0b45c6ce23 [FIR] FirScriptConfiguratorExtensionImpl: provide source for script parameters
We need this source to be able to find the parent declaration

^KT-62693 Fixed
2023-10-20 09:27:21 +00:00
Dmitrii Gridin 17ab005668 [Analysis API FIR] KtSymbolContainingDeclarationProvider: support script declarations
This commit also fixes a missing symbol for KtScriptInitializer
and some symbol pointers
Many tests marked as 'DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE'
due to KtFirFileSymbol#createPointer logic – the pointer can
be created only for PSI

^KT-61451
^KT-61887
^KT-62626 Fixed
^KT-62693
2023-10-20 09:27:21 +00:00
Dmitrii Gridin d689c1a38f [FIR] FirJavaFacade: fix contract violation from annotations
`isJavaDeprecatedAnnotation` can't be used here because it triggers
the resolution of an annotation ClassId

^KT-62705 Fixed
2023-10-20 09:24:43 +00:00
Alexander Udalov 731a1dd98d FIR: remove unused copy of CONFLICTING_JVM_DECLARATIONS
It was added as a placeholder in f3c58a1df7 and was not used anywhere.
The used error is declared in `JvmBackendErrors` and is reported by the
backend.
2023-10-20 08:01:59 +00:00
Ilya Chernikov 268d058bbb Implement missing invoke resolution branch with context receivers
#KT-61937 fixed
Note: the current implementation only resolves for a single receiver
in each group. See KT-62712 and KT-62709 for the followup.
2023-10-19 19:39:31 +00:00
Dmitrii Gridin 500de9f9bb [LL FIR] FirElementBuilder: avoid body resolution for type references inside 'where'
^KT-62691 Fixed
2023-10-19 16:24:32 +00:00
Dmitrii Gridin 35567d453b [LL FIR] add lazy resolution tests on 'where' construction
^KT-62691
2023-10-19 16:24:32 +00:00
Dmitrii Gridin 3817f37011 [FIR] rename ANNOTATIONS_ARGUMENTS_MAPPING phase to ANNOTATION_ARGUMENTS
^KT-62679
2023-10-19 14:34:35 +00:00
Dmitrii Gridin a86bae2c32 [FIR] drop ARGUMENTS_OF_ANNOTATIONS phase
^KT-62679 Fixed
2023-10-19 14:34:35 +00:00
Dmitrii Gridin a60777b9a7 [FIR] move annotation recheck logic to ANNOTATIONS_ARGUMENTS_MAPPING phase
ARGUMENTS_OF_ANNOTATIONS will be dropped, so this check should be moved
This commit also drops class annotations resolution from implicit type
phase and provides the correct scope during argument mapping phase.
This code was effectively unreachable before

^KT-62679
2023-10-19 14:34:35 +00:00
Dmitrii Gridin 01905a5a06 [LL FIR] move common annotation transformation logic into LLFirAnnotationArgumentMappingLazyResolver
^KT-62679
2023-10-19 14:34:35 +00:00
Dmitrii Gridin f5763cf34a [LL FIR] move context calculation to CONTRACTS phase
ARGUMENTS_OF_ANNOTATIONS will be dropped, so CONTRACTS is the next one

^KT-62679
2023-10-19 14:34:35 +00:00
Dmitrii Gridin 32ed81440c [FIR] add missing transformation of annotation type arguments
^KT-62679
2023-10-19 14:34:35 +00:00
Dmitrii Gridin 27c5a0b60d [LL FIR] add lazy resolve test on conflict of compiler required annotation
^KT-62679
2023-10-19 14:34:35 +00:00
Roman Golyshev 3c68b27280 KT-62071 [AA] Do not throw error from getScopeContextForPosition when implicitScope of receiver value is null
`implicitScope` can be `null`
in case when the implicit receiver resides in a user-defined `kotlin.*`
package, but the user have not yet allowed this with compiler argument
directive.

In this case,
we don't want the IDE to crush and show exceptions - the `kotlin`
package would be highlighted by the compiler diagnostics and other
resolve problems, and that would be enough

^KT-62071 Fixed
2023-10-19 12:59:47 +00:00
Nikolay Lunyak 06b3c6ec13 [FIR] Reproduce KT-62541 2023-10-19 09:27:44 +00:00
Ilya Kirillov 67ac985be7 [Analysis API Standalone] fix testdata for standalone mode tests
The commit (7db2fc522e) with changing behavior of builtin symbol provider
is in a conflict with a commit (72de86a8ba) where new tests were added.

The difference should be fixed as a part of KT-62651
2023-10-18 19:50:44 +00:00
Sergej Jaskiewicz 417aa236fb [FIR/IR generator] Factor out printing the preamble in generated files 2023-10-18 18:42:40 +00:00
Alejandro Serrano Mena b9b15cba08 [K2] Warn about deprecation and opt-in markers for overrides of Any
^KT-62620 Fixed

Include opt-in markers in the diagnostics
2023-10-18 12:34:58 +00:00
Dmitriy Novozhilov 43929398da [FIR] Pass implications from subject of safe call in DFA
^KT-59689 Fixed
2023-10-18 12:17:44 +00:00
Alexander Kuznetsov 45792c2e60 [Analysis API] support unsigned arrays creation functions
IDEA-335151, KT-62663


Merge-request: KT-MR-12614
Merged-by: Alexander Kuznetsov <Aleksander.Kuznetsov@jetbrains.com>
2023-10-18 10:53:52 +00:00
Mikhail Glukhikh 4ed7504d87 FIR deserializer: apply attributes on type parameter-based types
#KT-62578 Fixed
2023-10-18 10:30:31 +00:00
Dmitriy Novozhilov fa69d4837b [AA] Add workaround for KT-62578 2023-10-18 07:59:27 +00:00
Dmitriy Novozhilov 605a567e10 [AA] Add workaround for KT-62544 2023-10-18 07:59:27 +00:00
Dmitriy Novozhilov 704e2ef5c5 Suppress K2 specific warnings in the codebase
^KT-62472
2023-10-18 07:59:27 +00:00
Dmitriy Novozhilov 6114e4f068 Fix compilation problems caused by migration to 2.0 2023-10-18 07:59:27 +00:00
Anastasia.Nekrasova 9ad4cf4c55 [K2] Disappeared OPT_IN_USAGE_ERROR for a data class property during the destructuring declaration
^KT-62450
2023-10-17 21:27:13 +00:00
Dmitrii Gridin b03e3f0b0d [LL FIR] pass correct context during class annotation arguments mapping
The root cause of the problem is that we visit class annotations more
accurately than in the regular compiler transformer, so we have
a difference: the compiler assumes that annotation processing
of the class is called already inside this class, so it should enable
CLASS_HEADER_ANNOTATIONS mode to not capture extra context.
But we in LL FIR do this out of the class, so such context switching
is redundant and results in cutting out the outer class context

^KT-62587 Fixed
2023-10-17 20:32:11 +00:00
Dmitrii Gridin bbd09c6272 [LL FIR] add tests for nested class as annotation argument
^KT-62587
2023-10-17 20:32:11 +00:00
Dmitrii Gridin 5298d79dec [LL FIR] drop extra withContainingClass from annotation transformers
This call is redundant for annotation transformers because
they are override withRegularClass and add this call there,
so, as result, we have a class duplication in
containingClassDeclarations

^KT-62587
2023-10-17 20:32:11 +00:00