Commit Graph

44 Commits

Author SHA1 Message Date
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 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 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 37d688ae83 [AA] introduce FirReceiverParameter
^KT-54417
2022-11-17 09:50:09 +00: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
Anna Kozlova f18d1e9067 [Analysis API FIR] support call expression resolve in class literal
KTIJ-23272
2022-11-04 08:10:09 +01: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
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 a0f0fa5a47 [Analysis API FIR] fix candidate collection for delegatedConstructor call
^KTIJ-20446
2022-07-22 00:58:59 +02:00
Mikhail Glukhikh 76d5d3a2ec Extract separate FirModifierRenderer 2022-07-14 09:38:39 +00:00
Ilya Kirillov 6a145b52aa [Analysis API] update testdata after adding context receivers 2022-07-05 10:34:28 +02:00
Mikhail Glukhikh 2b235e1188 FE10 Analysis API: use compact renderer for flexible types even in debug 2022-06-29 16:50:06 +00:00
Mikhail Glukhikh 38f4a35be2 FIR: introduce flexible types pretty rendering for no arguments case
#KT-52020 Fixed
2022-06-29 16:50:05 +00:00
Mikhail Glukhikh 31ec10142b FirRenderer: add renderAllModifiers and renderDetailedTypeReferences
Related to KT-52020
2022-06-29 16:50:04 +00:00
Stanislav Erokhin 66851c7afd [Analysis API] Add KtReceiverParameterSymbol#correspondingSymbol 2022-06-27 19:32:44 +00:00
Stanislav Erokhin 2234813363 [Analysis API] Add KtCallableMemberCall#typeArgumentsMapping 2022-06-23 07:50:21 +00:00
Stanislav Erokhin 8d8fc6e291 [Analysis API] Add type to KtReceiverValue
Maybe in the future we could remove type from the
KtImplicitReceiverValue, because it has ktSymbol, and in theory
that should be enough to create corresponding KtType.
Unfortunately that is not the case for KtClassOrObjectSymbol --
it doesn't have the API for "default" type creation currently.

Regarding code in KtFirCallResolver.kt -- it seems like code there
needs some love in the future. Psi created via custom code there,
because for call x() FIR has receiver x with psi = null
2022-06-23 07:50:21 +00:00
Ilya Kirillov 2c1074ac37 [Analysis API] actualize testdata 2022-06-22 09:31:45 +02:00
Roman Golyshev 581ae5fcb7 [FIR IDE] Add a special type of KtCall for generic type qualifiers
^KTIJ-21672 Fixed
2022-06-14 15:00:13 +00:00
Mikhail Glukhikh 133f874351 Fix origin calculation in CliFe10AnalysisFacade
After this commit, all tests in
Fe10IdeNormalAnalysisSourceModuleFileScopeTestGenerated pass
2022-05-25 12:04:57 +00:00
Denis.Zharkov 21b86123e8 FIR: Adjust analysis test data after changes in how we load Java types
Especially, it's about types based on type parameters
2022-05-19 16:54:05 +00:00
Roman Golyshev 8bcdc70adc FIR IDE: Add IDE tests for sample compiler plugin 2022-02-25 23:08:26 +03:00
Dmitriy Novozhilov 23af5510a6 [FIR] Render full declaration header in diagnostic messages 2022-02-18 17:44:38 +03:00
Mark Punzalan afb34d3193 Analysis API: Implement KtCallResolver.collectAllCandidates for FE 1.0. 2022-02-17 19:51:35 +01:00
Mark Punzalan 3f3873dc50 Analysis API: Return KtCallCandidateInfo instead of KtCallInfo in
KtCallResolver.collectAllCandidates().
2022-02-11 13:22:58 +01:00
Mark Punzalan 58c6c25fe9 Analysis API: Handle other FirElements in
KtCallResolver.resolveCandidates() and copy over remaining tests.
2022-02-11 13:22:58 +01:00
Mark Punzalan 9b9da94a09 Analysis API: Fix issues related to implicit invoke calls:
- Correctly set explicit receiver value.
- Restore original function call from FirImplicitFunctionCall (i.e.,
calls implicitly resolved to `invoke`) to get the correct name for
getting all candidates.
- Collect candidates at all tower levels.

Also make order of candidate calls in tests deterministic.
2022-02-11 13:22:58 +01:00
Mark Punzalan ace826c570 Analysis API: Get argument mapping from candidate and type parameters
from candidate symbol.
2022-02-11 13:22:58 +01:00
Mark Punzalan 0ed802bca4 Analysis API: Add tests for KtCallResolver.resolveCandidates(). 2022-02-11 13:22:57 +01:00
Dmitriy Novozhilov aadfc59d0f [FIR] Complete delegated constructor calls without proper constructed type
This is needed to definitely complete arguments of such calls
2022-02-07 13:36:38 +03:00
Roman Golyshev f0f2f67024 KT-50862 Unwrap use-site substitution overrides
Use-site substitution override happens in situations like this:

```
interface List<A> { fun get(i: Int): A }

fun take(list: List<String>) {
  list.get(10) // this call
}
```

We want to have those overrides unwrapped, because we don't want
to deal with a different KtSymbol for each possible use-site

^KT-50862 Fixed
2022-01-29 07:42:18 +00:00
Roman Golyshev 564e408434 KT-50862 Add name property to KtSignature
See the KDoc of the property for the reasons why
it was created
2022-01-29 07:42:17 +00:00
Roman Golyshev 8befbc6375 KTIJ-20826 Approximate builder inference stub types as type parameters
This is a temporary fix to avoid crashes in FIR IDE

Of all stub types, only `ConeStubTypeForChainInference` is handled now,
so we can catch the other possible errors with stub types (in the
delegates' inference, for example)

The fix introduced in this commit should be reworked when KT-50916 is
fixed

^KTIJ-20826 Fixed
2022-01-25 17:09:03 +03:00
Ilya Kirillov 3b943706d8 Analysis API: fix call resolve inside plusAssign target
^KT-50864 fixed
2022-01-20 23:26:28 +03:00
Roman Golyshev e3219cc5b6 FIR IDE: Avoid resolving elvis operator, because it doesn't make sense
There are intrinsics to which elvis operator's usages are resolved;
however, we do not want to expose those intrinsics through the
high-level resolve
2021-12-21 18:48:00 +03:00
Tianyu Geng 9153db2ecc FE1.0 Analysis API: rewrite KtFe10CallResolver 2021-12-09 11:01:52 +01:00
Tianyu Geng 9b05019137 FIR Analysis API: reimplement KtFirCallResolver with new data model 2021-12-06 12:40:43 +01:00
Roman Golyshev fa8bb47bdf [FIR IDE] Add unwrapping substitution overrides which doesn't affect function's signature
Also, do not use PSI to restore SUBSTITUTION_OVERRIDE function/property
symbols
2021-11-25 21:19:56 +03:00
Ilya Kirillov 6f6a33e852 Analysis API: move testdata to corresponding components folders 2021-11-17 20:55:08 +01:00