Commit Graph

154 Commits

Author SHA1 Message Date
Jinseong Jeon 4beb55179b AA: expected type for expression passed to vararg 2022-12-21 17:05:00 +09: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
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 2851622a6f [AA] Fix typos in renderers 2022-12-06 17:43:29 +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
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
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
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
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
Anna Kozlova e5ce32feeb [ANALYSIS API] introduce dedicated KtCall for incomplete code
KTIJ-23505 and duplicates
2022-11-18 20:59:31 +01:00
Marco Pennekamp c5e5140c08 [Analysis API] Fix exceptions around type parameters being treated as callables
- `toResolvedCallableSymbol`: cast defensively because
  the resolved symbol might not be a callable symbol.
- `toKtCallInfo`: Check that the resolved symbol is actually callable.

^KTIJ-23003 fixed
2022-11-17 18:58:38 +00:00
Dmitrii Gridin 1ebfbc0ee9 [AA] KtCallableSymbol: rename receiver to receiverParameter
^KT-54417
2022-11-17 09:50:12 +00:00
Dmitrii Gridin 2741052db3 [AA] integrate KtReceiverParameterSymbol to KtCallableSymbol
^KT-54417
2022-11-17 09:50:10 +00:00
Dmitrii Gridin 37d688ae83 [AA] introduce FirReceiverParameter
^KT-54417
2022-11-17 09:50:09 +00:00
Jinseong Jeon fcba1f215a AA: handle erroneous type in nested type argument 2022-11-16 14:13:43 +01:00
Anna Kozlova 9f470e2a4d [LL API] return FirErrorProperty for top level destructuring declaration
KTIJ-23552
2022-11-11 17:39:54 +01:00
Anna Kozlova 3590c4ea35 [Analysis API FIR] support generated temp properties
KTIJ-23492 (array index expression), KTIJ-23138 (inc/dec desugaring)
2022-11-11 17:39:53 +01:00
Ilya Kirillov 2378437b30 [Analysis API FIR] do not create resolved KtTypes for unresolved ones 2022-11-11 12:00:00 +01:00
Ilya Kirillov 10b593ba8c [Analysis API] mute tests for expect/actual rendering as expect/actuals are not suported in symbols yet
^KT-54036
^KTIJ-23268
2022-11-11 11:59:59 +01:00
Ilya Kirillov 26ec7ec296 [Analysis API] update testdata after renderer rework
The new testdata seems to be more correct or just different

^KTIJ-23268
2022-11-11 11:59:59 +01:00
Jinseong Jeon 2131cb4fe0 AA FIR: functional type for anonymous function
^KTIJ-17657 In progress
2022-11-11 10:15:44 +01:00
Jinseong Jeon b2e239a542 AA: tests about equals on sealed/data class
^KT-54844 In Progress
2022-11-09 07:12:36 +01:00
Anna Kozlova 79bed083e6 [FIR] allow primary constructors in interfaces to support invalid code
KTIJ-23504
2022-11-08 14:51:33 +01:00
Jinseong Jeon 4497be0b68 AA: do not parse signature with NO_NAME_PROVIDED
^KTIJ-23503 Fixed
2022-11-04 10:42:19 +01:00
Anna Kozlova f18d1e9067 [Analysis API FIR] support call expression resolve in class literal
KTIJ-23272
2022-11-04 08:10:09 +01:00
Jinseong Jeon 7f6cad6fb3 FIR: ensure STATUS resolve phase before reading valueClassRepresentation 2022-11-02 18:04:38 +01:00
Jinseong Jeon 542ca68aba AA: add test about PsiType for @JvmInline value class 2022-11-02 18:04:38 +01:00
Jinseong Jeon c9a2e10dd7 AA: merge single/multi modules tests for PsiTypeProvider
...because single-module test is also multi-module test
2022-11-02 17:38:16 +01:00
Jinseong Jeon d98081dce2 AA: introduce MPP tests for PsiTypeProvider 2022-11-02 17:38:16 +01:00
Ilya Kirillov e2416f48fe [Analysis API] add tests for containing declaration for delegated member scope 2022-10-26 19:19:04 +00:00
Ilya Kirillov 97df0a0902 [Analysis API] rework containing declaration provider
now it should work for non-source declarations
2022-10-26 19:19:00 +00:00
Jinseong Jeon 14213ddad2 AA: fix expected type for lambda with explicit label 2022-10-24 22:07:05 +02:00
Dmitrii Gridin 4ee5bf178c [AA] DebugSymbolRenderer: render symbols recursively
^KT-54311
2022-10-17 14:59:47 +00:00
Roman Golyshev 3485d65213 [K2] Ignore failing tests for isUsedAsExpression
Those tests do not pass at the moment because of KTIJ-23143
2022-10-05 15:06:52 +00:00
Kristoffer Andersen f765457e51 [K2] isUsedAsExpression analysis 2022-10-05 15:06:52 +00:00
Ilya Kirillov 49f2f85927 [Low Level FIR] fix exception when creating symbol by invalid code 2022-10-04 12:56:07 +00:00
Ilya Kirillov 81c52e6886 [Analysis API FIR] fix call resolution on error elements 2022-10-03 16:02:23 +02:00
Ilya Kirillov ab3f916f3f [Analysis API FIR] fix call resolution of non-resolvable elements 2022-10-03 16:02:23 +02:00
Ilya Kirillov 4ae1cb74dd [Analysis API FIR] fix constant evaluation for incomplete call when compiler produces IntegerLiteralType
^KTIJ-21531 fixed
2022-09-30 12:19:51 +02:00
Jinseong Jeon dd7fc7f4ae AA FIR: avoid unsafe argument retrieval during const evaluation 2022-09-18 17:22:02 +02:00
Jinseong Jeon 836b6dae9f AA FIR: constant evaluation for String 2022-09-14 12:52:08 +02:00
Jinseong Jeon 68519af97a AA: add tests about platform types
...as declaration return type or expression type
2022-09-09 15:02:23 +02:00
Roman Golyshev bb2bee74cf [HL API] Fix FE10 implementation of KtExpressionTypeProvider 2022-09-01 13:57:03 +00:00
Jinseong Jeon 25f7554a31 AA FIR: constant evaluation for Java field 2022-08-20 00:50:09 +02:00
Simon Ogorodnik 513af2dfbc FIR. Refactor smart-cast representation in FIR tree
Make smart-casts non-transparent expression without delegation
to underlying FirQualifiedAccessExpression, as children delegation in
fir tree has unclear semantics
Remove two different kinds of tree nodes for smart-casts
2022-08-15 21:46:11 +00:00
Ilya Kirillov f39f1da70d [Analysis API FE10] fix suspend function type mapping 2022-08-10 22:49:12 +02:00
Ilya Kirillov 4d5f1dc1bb [FIR] do not fail when Continuation classes not found in classpath 2022-08-10 22:49:12 +02:00