Commit Graph

466 Commits

Author SHA1 Message Date
aleksandrina-streltsova fb9dead107 [Analysis API] consider applicable extensions that require receiver cast
^KTIJ-23715
2022-12-27 17:22:30 +00:00
Anna Kozlova 15b1e429d7 [compiler] introduce dedicated Fir declaration for dangling modifier lists (KTIJ-23008)
ensure fir annotations are included in FirDanglingModifierList and resolved,
dedicated DanglingTopLevelModifierListStructureElement exists for top
level lists only, class level lists are processed by containing structure
element
2022-12-21 20:58:46 +00:00
Anna Kozlova b81c210535 [AA] resolve array access expression to corresponding set operator
k1 would suggest `get` as well
 but with current fir structure with fake desugaring
 get is moved to the separate fake psi which doesn't exist
 thus the problem is ignored for now
 ^ KTIJ-24025
2022-12-21 10:45:40 +00:00
Jinseong Jeon 4beb55179b AA: expected type for expression passed to vararg 2022-12-21 17:05:00 +09:00
Dmitrii Gridin 8bbe60e96c [AA] add more tests on companion members 2022-12-20 19:52:13 +00:00
Dmitrii Gridin 643b74fa28 [AA FIR] support symbol pointers for static properties
^KT-55487
2022-12-20 19:52:12 +00:00
Dmitrii Gridin e476150025 [AA FIR] support symbol restoring for static members
^KT-55487 Fixed
2022-12-20 19:52:10 +00:00
Anna Kozlova a529f8510d [LL] ensure FirConstExpression's annotations are not lost (KTIJ-23968) 2022-12-15 14:31:48 +00:00
Steven Schäfer 6af616d3c3 FIR: make declarations marked with 'override' implicitly open
#KT-52236 Fixed
2022-12-14 21:46:41 +00:00
Ilya Kirillov 68a17242b3 [FIR] fix NPE on missing java annotations qualifier
^KTIJ-23075 fixed
2022-12-14 09:58:07 +00:00
Dmitriy Novozhilov f3da26946b [FIR] Change priority of K2_VISIBILITY_ERROR CandidateApplicability
In K1 analogue of `K2_VISIBILITY_ERROR` is `K1_RUNTIME_ERROR`, so
  candidates with `K2_VISIBILITY_ERROR` should win over innaplicable
  candidates with `INAPPLICABLE`, `INAPPLICABLE_ARGUMENTS_MAPPING_ERROR`
  or `INAPPLICABLE_WRONG_RECEIVER` applicability

This is needed to allow resolution to invisible symbols (and later
  suppress error with `@Suppress("INVISIBLE_SYMBOL", "INVISIBLE_REFERENCE")`

^KT-55026 Fixed
^KT-55234
2022-12-09 12:02:05 +00:00
pyos 0d46dfc1ba FIR: fix substitution of type arguments in SAM type aliases
^KT-54730 Fixed
2022-12-07 22:09:20 +00:00
Dmitrii Gridin 5c9aa88617 [AA] KtModule#project shouldn't be null
^KT-55336
2022-12-07 14:18:44 +00:00
Marco Pennekamp 2cd16f055a [AA] KT-55098 Render context receivers in declarations & function types
- `context(...)` is a modifier that must precede annotations and other
  modifiers, so for declarations it is rendered in
  `renderAnnotationsAndModifiers`.
- Ignore `@ContextFunctionTypeParams` in the annotation list of FE10
  types, as the annotation is an implementation detail of context
  receivers in K1 and shouldn't be rendered.

^KT-55098 fixed
2022-12-06 17:43:30 +00:00
Marco Pennekamp e2804693bf [AA] KT-55098 Add context receivers to KtFunctionalType
- Context receivers in function types may not be labeled, so the created
  `KtContextReceiver`s have `null` labels. Such labels currently only
  compile due to a bug (see KT-55187).
2022-12-06 17:43:29 +00:00
Marco Pennekamp 2851622a6f [AA] Fix typos in renderers 2022-12-06 17:43:29 +00:00
Ilya Kirillov 5477e2073f [Analysis API] fix typo in testdata filenames 2022-12-05 17:27:43 +01: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
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
Dmitrii Gridin 945e0d9b3f [AA] KtPsiBasedSymbolPointer: drop redundant api
^KT-54051
2022-11-29 13:33:53 +00:00
Dmitrii Gridin 207212e5b8 [SLC] support non-psi classes
^KT-54051
2022-11-29 13:33:47 +00:00
Dmitrii Gridin e27ffada26 [AA] KtSymbol: add context receiver to 'createPointer'
^KT-54051
2022-11-29 13:33:46 +00:00
Dmitrii Gridin 37729c0353 [SLC] migrate SymbolLightParameterForReceiver to KtReceiverParameterSymbol
^KT-54051
2022-11-29 13:33:43 +00:00
Dmitrii Gridin 40bd222b78 [SLC] drop KtAnalysisSession from SymbolLightFieldForProperty
^KT-54051
2022-11-29 13:33:36 +00:00
Dmitrii Gridin db23cbe29e [AA] introduce api to create symbol pointer from psi
^KT-54051
2022-11-29 13:33:32 +00:00
Dmitrii Gridin cb8cc65fb8 [AA Fe10] update testData
org.jetbrains.kotlin.analysis.api.fe10.test.cases.generated.cases.symbols.Fe10IdeNormalAnalysisSourceModuleSymbolByFqNameTestGenerated.testKclass
2022-11-25 15:33:58 +01:00
Anna Kozlova abb45a0728 [AA] don't treat incomplete function as anonymous
^KTIJ-23672
sync anonymous function predicate with RawFirBuilder/DeclarationsConverter
2022-11-25 14:27:03 +00:00
Dmitrii Gridin e684607e9d [AA] FirCallableSignature: add test on type alias
^KT-54826
2022-11-24 18:32:45 +00:00
Dmitrii Gridin dfc59d5d07 [AA FIR] support symbol pointer restore for value parameter from delegated setter
^KT-54051
2022-11-24 18:32:44 +00:00
Dmitrii Gridin 55ca2d608b [AA] AbstractSymbolTest: add check for parameters
^KT-54826
2022-11-24 18:32:44 +00:00
Dmitrii Gridin 1222d18b3d [AA Fe10] fix StackOverflowError from KtFe10PsiClassInitializerSymbol
^KT-54826
2022-11-24 18:32:44 +00:00
Dmitrii Gridin ec613e57ef [FIR] add Enhancement wrapping for type parameters
^KT-55095 Fixed
2022-11-24 18:32:43 +00:00
Dmitrii Gridin 2155a23e4e [AA FIR] implement FirCallableSignature to simplify search by signature
^KT-54826 Fixed
2022-11-24 18:32:43 +00:00
Dmitrii Gridin 48e2e5cc87 [AA] AbstractSymbolTest: add type parameters check
^KT-54826
2022-11-24 18:32:43 +00:00
Dmitrii Gridin 7e433a936d [AA FIR] introduce FirCallableSignature to encapsulate IdSignature
^KT-54826
2022-11-24 18:32:42 +00:00
Dmitrii Gridin b04c9f02b0 [AA] add test on data class members
^KT-54051
2022-11-24 18:32:42 +00:00
Anna Kozlova cdf6ffa167 [AA] do not try to build KtSymbol for FirErrorFunction
^KTIJ-23669
FirErrorFunctions are created for unknown labels
when the code in return statements is not complete yet.
Such labels cannot be resolved, and no symbols should be created for them
2022-11-24 13:09:29 +00:00
Ivan Kochurkin 8883de3f00 [FIR] Don't resolve Enum.declaringClass and Enum.getDeclaringClass
^KT-53946 Fixed
2022-11-23 18:29:29 +00:00
Anna Kozlova 43bd05f470 [LL FIR] make dependency from library on builtins invisible from outside
^KTIJ-23421

hide explicit builtins to reveal target platform dependencies.
Otherwise, `expect` class from builtin of e.g. JDK
would be found instead of actual dependency from Kotlin Runtime
2022-11-23 10:46:49 +00:00
Jinseong Jeon c79d65536b Gracefully handle erroneous super type during local type approximation
^KTIJ-23528 Fixed
2022-11-22 20:16:40 +01:00
Ilya Kirillov f775778efa [Analysis API FIR] fix containing declaration for value parameter
now it should also work for non-source declarations
2022-11-22 18:25:30 +01:00
Dmitriy Novozhilov 01c6c7dc59 [FIR] Properly approximate return type of callable declarations
- approximate intersection types in all non-local declarations
- approximate local types in non-private non-local declarations
2022-11-22 15:46:20 +00:00
Anna Kozlova 1906a41d9a fix testdata after merge 2022-11-22 13:31:41 +01:00
Marco Pennekamp 93f560eb4d [Analysis API] Add call resolution tests for KTIJ-23373
- The Java functions aren't recognized as candidates during the test
  (`FULL_JDK` isn't helping), so I've replicated the tests with local
  extension functions and confirmed that they uncover the same
  exception.
2022-11-22 13:13:35 +01:00
Anna Kozlova 702d0b4d54 [compiler] missed type parameters in local properties (KTIJ-23583)
even though local variables won't contain type parameters,
let's build fir for them
2022-11-22 10:47:45 +00:00
Jaebaek Seo c55efe62a3 [AA] handles FIR isUsedAsExpression for return within function block
For the following example:

```
fun foo(bar: Int) {
  <expr>if (bar == 4) return "Four"
  else return "Int"</expr>
}
```

AA FE1.0 `isUsedAsExpression` returns `false`.
Since the current AA FIR `isUsedAsExpression` returns `true` for the
above example, this commit fixes it.
2022-11-21 18:26:41 +01:00
Nikolay Lunyak fb09f139dd [FIR] Unmute receiver annotations tests
These tests were muted in 89f8821d. Seems they began to work after the
introduction of `FirReceiverParameter` in KT-54417.
2022-11-21 08:51:43 +00:00
Anna Kozlova e5ce32feeb [ANALYSIS API] introduce dedicated KtCall for incomplete code
KTIJ-23505 and duplicates
2022-11-18 20:59:31 +01:00