Commit Graph

1934 Commits

Author SHA1 Message Date
Dmitrii Gridin 9bc37d7f3f [SLC] introduce some utils
^KTIJ-23783
^KTIJ-23519
2022-12-06 13:40:47 +00:00
Dmitrii Gridin 856d272ca4 [SLC] implement lazy calculation for modifiers
and fix some annotations

^KTIJ-23783 Fixed
2022-12-06 13:40:47 +00:00
Dmitrii Gridin e2082fb0d7 [SLC] fix visibility for lateinit properties from companion
^KTIJ-23519 Fixed
2022-12-06 13:40:46 +00:00
Dmitrii Gridin 7bfa900ce6 [SLC] fix modality for methods and property accessors
^KTIJ-23783
2022-12-06 13:40:46 +00:00
Dmitrii Gridin 00ab33bbf9 [SLC] extract non-common logic from computeModalityForMethod
^KTIJ-23783
2022-12-06 13:40:45 +00:00
Dmitrii Gridin a8c111b304 [SLC] drop redundant resolve for visibility, fix several cases
^KTIJ-23783
2022-12-06 13:40:45 +00:00
Dmitrii Gridin 9970623e95 [SLC] SymbolLightModifierList: separate static and lazy modifiers
^KTIJ-23783
2022-12-06 13:40:45 +00:00
Dmitrii Gridin fc8ae0f2e5 [SLC] SymbolLightModifierList: move modifier logics to common part
^KTIJ-23783
2022-12-06 13:40:44 +00:00
Dmitrii Gridin cba70d70a7 [SLC] drop hack with setParent for annotations
^KTIJ-23783
2022-12-06 13:40:44 +00:00
Ilya Kirillov 5477e2073f [Analysis API] fix typo in testdata filenames 2022-12-05 17:27:43 +01:00
Ilya Kirillov c899f6dae3 [LL FIR] fix lazy resolution of member property statuses for anonymous objects
Previously, statuses of superclass which are not local was not ignored

Sometimes it worked in the IDE by calling lazyResolveToPhase
which is a violation of the lazy resolution contract

^KT-54890
2022-12-05 17:27:42 +01:00
Ilya Kirillov c66fbf5c0e [LL FIR] fix lazy resolution of member-property statuses for local classes
Previously, statuses of superclass which are not local was not ignored

Sometimes it worked in the IDE by calling lazyResolveToPhase
which is a violation of the lazy resolution contract

^KT-54890
2022-12-05 17:27:42 +01:00
Yan Zhulanow bcf1389ae5 [LL API] Fix enum value lazy analysis (KTIJ-23833)
^KTIJ-23833 Fixed
2022-12-05 11:44:15 +00:00
Vladimir Dolzhenko ebf24c2d24 Add default impl of getCanonicalText
#KTIJ-11270
2022-12-02 18:28:41 +00:00
Ilya Kirillov 7423b35741 [Low Level FIR] explicitly specify all phases in LazyTransformerFactory
so when the new phase is added, lazy transformer for it is not missed
2022-12-02 17:08:34 +00:00
Ilya Kirillov 500f5b48f8 [Low Level FIR] reformat code 2022-12-02 17:08:33 +00:00
Ilya Kirillov fb500fd521 [Low Level FIR] do not try to lazy resolve FirBackingField 2022-12-02 17:08:33 +00:00
Ilya Kirillov 317bb0122f [Low Level FIR] encapsulate the work with lazy transformers to a class 2022-12-02 17:08:32 +00:00
Ilya Kirillov 52a88f7858 [Low Level FIR] do not use the same LLFirModuleLazyDeclarationResolver for the supertype computation
LLFirModuleLazyDeclarationResolver is bound to module, and should be taken from corrsponding FirSession
2022-12-02 17:08:32 +00:00
Ilya Kirillov 522aa1b3bb [Low Level FIR] remove usages of ResolveTreeBuilder as it complicates the code but unused 2022-12-02 17:08:31 +00:00
Ilya Kirillov 264198fb51 [LL FIR] add more tests for ValueWithPostCompute 2022-12-02 09:03:30 +01:00
Ilya Kirillov bd3959894b [LL FIR] fix race in ValueWithPostCompute which happened then the computation finished with a non-recoverable exception 2022-12-02 09:03:30 +01:00
Ilya Kirillov 2218651d6c [LL FIR] fix race in ValueWithPostCompute then the computation finished with a recoverable exception
^KTIJ-23773 fixed
2022-12-02 09:02:37 +01:00
Egor Kulikov fb2485f83c [FIR] Make constructor delegate lazy in RawFirBuilder
Fifth step for ^KT-52615

Merge-request: KT-MR-7860
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2022-12-02 03:12:51 +00:00
Nikita Bobko 5be153cd65 2/2 analysis-api: Initial implementation for contracts
Review: https://jetbrains.team/p/kt/reviews/7652

Put this change into a separate commit because:
1. The change is boring and clutters the diff of the first commit
2. The first commits is already too big
2022-12-01 14:42:49 +01:00
Nikita Bobko b2397f033b 1/2 analysis-api: Initial implementation for contracts
Review: https://jetbrains.team/p/kt/reviews/7652

I need this API for KTIJ-22692
2022-12-01 14:42:49 +01:00
Nikita Bobko 6e637e94ca analysis-api module: drop unused :compiler:frontend dependency
Review: https://jetbrains.team/p/kt/reviews/7652

It's not only unused, this dependency is conceptually wrong because
:compiler:frontend is K1 compiler but :analysis:analysis-api supposed to
be frontend independent
2022-12-01 14:42:49 +01:00
Dmitriy Novozhilov 6864433581 [FIR] Support resolution of meta-annotations before supertypes
Now annotations are resolved with following algorithm:
1. On COMPILER_REQUIRED_ANNOTATIONS we resolve all annotations
     and store results if this is compiler annotation, plugin annotation,
     or annotation with meta-annotation (meta annotations are checked
     recursively with designated resolution if needed)
2. On TYPES stage we resolve all those annotations once again and if
     some annotation changes resolution then we keep type from p.1 and
     report error on this annotation, so user should disambiguate it

Ambiguity may occur because of nested annotations with same name as
  plugin annotations:

```
annotation class SomeAnnotation // (1) plugin annotation

open class Base {
    annotation class SomeAnnotation // (2)
}

class Derived : Base() {
    @SomeAnnotation // <-----------------
    class Inner
}
```
At COMPILER_REQUIRED_ANNOTATIONS annotation call will be resolved to (1)
  because at this stage supertypes are not resolved yet, and we consider
  only importing scopes. At the TYPES stage we will find correct
  annotation from supertype
2022-12-01 07:29:39 +00:00
Dmitriy Novozhilov 246dc985a6 [FIR] Rework predicates system
Now predicates are split into LookupPredicate and DeclarationPredicate
  hierarchies. First one allows to perform global search for declarations
  and second one allows to check if some declaration matches the predicate.
Predicates with meta annotations are excluded from LookupPredicates,
  because it's impossible to create index of annotations with meta-annotations,
  because they can be located inside binary dependencies (so to achieve
  this we need to scan the whole classpath).
Also only one predicate with meta-annotations is left in DeclarationPredicate
  hierarchy (AnnotatedWithMeta)

^KT-53874 Fixed
^KT-53590 Fixed
2022-12-01 07:29:37 +00:00
Marco Pennekamp ea346e3e0e [AA] Rename originalOverriddenSymbol to unwrapFakeOverrides
- `unwrap` signals that fake overrides will be unwrapped until the
  original symbol is recovered.
- Also remove nullability of the returned `KtCallableSymbol`. If the
  given symbol cannot be unwrapped, it is most likely already the
  original symbol.
- Remove the lazy resolve to `STATUS` in `KtFirOverrideInfoProvider`, as
  it's not needed to unwrap fake overrides.
2022-11-30 19:49:14 +00:00
Evgeniy.Zhelenskiy fa4a4e56f3 [Tests] Remove unnecessary usages of OPTIONAL_JVM_INLINE_ANNOTATION
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:42 +00:00
Evgeniy.Zhelenskiy fa4ceb4ef4 [IR] Add diagnostics to forbid annotations for MFVC-typed elements
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:39 +00:00
Evgeniy.Zhelenskiy adee33d3e5 [IR] Forbid MFVC primary constructors default arguments
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:38 +00:00
Evgeniy.Zhelenskiy 9f01ccc304 [IR] Support user-defined equals for MFVC
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:36 +00:00
Evgeniy.Zhelenskiy 0c70b60988 [IR] Add context receiver test on MFVC
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:33 +00:00
Dmitrii Gridin fe1647096f [SLC] cleanup 'equals' code
^KT-54051
2022-11-30 12:59:12 +00:00
Dmitrii Gridin 2329bd1fe7 [SLC] SymbolLightAccessorMethod: simplify equals for psi case
^KT-54051
2022-11-30 12:59:12 +00:00
Yan Zhulanow 10fc86ef92 [FE] Add tests for 'containingClassForStaticMemberAttr' 2022-11-30 04:12:28 +00:00
Yan Zhulanow 0e050ae7f1 [FE] Consider derived class tag on caching substitution scopes 2022-11-30 04:12:27 +00:00
Yan Zhulanow fe69b21aed [FE] Fix 'containingClassForStaticMemberAttr' for fake overrides (KTIJ-22808) 2022-11-30 04:12:26 +00:00
Nikolay Lunyak 2e9f9f987b [FIR] KT-44698: Print file:line:offset on K2 crash
^KT-44698 Fixed
2022-11-29 22:35:51 +00:00
Marco Pennekamp d4e6a4ad54 [FIR] KT-54978 Prohibit explicit type arguments in property accesses
- Add a checker which ensures that property accesses have no explicit
  type arguments. If an error on the property access's callee reference
  already exists, the new error is not reported in favor of the existing
  error, as the property access may have been intended to be a function
  call.
- `complicatedLTGT.fir.kt`: The underlying parser issue is not yet
  solved, which is why `x` is parsed as a property access with explicit
  type arguments.
- `reservedExpressionSyntax` tests: This new check makes a lot of the
  access expressions in these tests illegal, so valid lines have been
  added and invalid lines appropriately marked with
  `EXPLICIT_TYPE_ARGUMENTS_IN_PROPERTY_ACCESS` errors.

^KT-54978 fixed
2022-11-29 14:47:59 +00:00
Dmitrii Gridin 945e0d9b3f [AA] KtPsiBasedSymbolPointer: drop redundant api
^KT-54051
2022-11-29 13:33:53 +00:00
Dmitrii Gridin 3b1ec3752d [SLC] compareSymbolPointers: result of comparison of two 'null' symbols should be 'false'
^KT-54051
2022-11-29 13:33:52 +00:00
Dmitrii Gridin 94df0465d6 [SLC] SymbolLightConstructor: drop redundant LightMemberOrigin parameter
^KT-54051
2022-11-29 13:33:52 +00:00
Dmitrii Gridin 870fdf51d3 [SLC] add more 'inline' modifiers to symbol utils functions
^KT-54051
2022-11-29 13:33:52 +00:00
Dmitrii Gridin 3e73522d3b [SLC] drop redundant labels for KtAnalysisSession
^KT-54051
2022-11-29 13:33:51 +00:00
Dmitrii Gridin c9d1e2b0a2 [SLC] SymbolLightClassForNamedClassLike: cleanup addMethodsFromCompanionIfNeeded function
^KT-54051
2022-11-29 13:33:51 +00:00
Dmitrii Gridin ef9412e0aa [SLC] replace lazy with lazyPub
^KT-54051
2022-11-29 13:33:51 +00:00
Dmitrii Gridin 815d324a4a [SLC] rename SymbolLightAnnotationClass to SymbolLightClassForAnnotationClass
^KT-54051
2022-11-29 13:33:50 +00:00