Commit Graph

181 Commits

Author SHA1 Message Date
Mark Punzalan 3f3873dc50 Analysis API: Return KtCallCandidateInfo instead of KtCallInfo in
KtCallResolver.collectAllCandidates().
2022-02-11 13:22:58 +01:00
Mark Punzalan 7a1ef25333 Analysis API: Rename resolveCandidates to collectCallCandidates.
Didn't bother to rename the directory in the test data.
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
Mark Punzalan 4a09abc418 Analysis API: Add API functions to get all the candidates (with argument
mapping and substitutor) for a function call.
2022-02-11 13:22:57 +01:00
Vladimir Dolzhenko 918a91dbdf Escape special names with backticks in test data
#KT-51248
2022-02-10 21:20:47 +00:00
Jinseong Jeon 26e923e3ae AA: introduce static project structure provider by compiler configuration
Also add standalone mode utils to configure Application/Project environments
2022-02-09 23:11:43 +01:00
Jinseong Jeon d219de0f88 AA: avoid FIR dependency in frontend-independent module 2022-02-09 23:11:43 +01:00
Mads Ager a398f7d6cb Rename kt-reference module to kt-references. 2022-02-07 15:01:24 +01:00
Mads Ager 6f0bb0eda5 Add analysis:kt-reference module and move KtReferences there. 2022-02-07 15:01:23 +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
Ilya Kirillov b8c36b7998 Analysis API FIR: remove compilation errors from new testdata 2022-02-01 16:31:29 +01:00
Ilya Kirillov 441de5cd75 Analysis API FIR: resolve Java synthetic properties KtSyntheticJavaPropertySymbol 2022-02-01 16:31:28 +01:00
Mads Ager d13e117a58 Change FIR analysis API resolution for super type calls.
The IDE expects the super type calls to resolve to the constructor
invoked and not the class. The frontend itself resolves to the
class, so an extra layer is needed to adjust that to the constructor.
2022-02-01 16:31:26 +01:00
Ilya Kirillov 4530041cbb Analysis API: move reference resolve testsdata with errors to dedicated folders 2022-01-31 21:12:30 +01:00
Ilya Kirillov 96e1f1e7d4 Analysis API: fix some compilation errors in reference resolve testdata 2022-01-31 21:11:54 +01:00
Roman Golyshev bc3142f4da Remove accidentally copied testData file 2022-01-29 07:42:18 +00: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 9ff46004e4 FIR IDE: Remove typesCache from KtSymbolByFirBuilder
This cache wasn't working too well, because ConeTypes have
equals/hashCode implementations which do not account for types'
attributes (like annotations, for example).

Because of that, `String` and `@Annotated String` were considered the
same type, and the cache was remembering whichever came first.
2022-01-27 16:23:44 +03: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 e1fece6402 Analysis API: fix testdata of reference resolve tests which started to pass 2022-01-21 16:46:28 +01:00
Ilya Kirillov 16fbc09997 Analysis API: use FirSymbol in KtFirSymbol's instead of FirDeclaration
^KT-50271 fixed
2022-01-21 16:46:27 +01:00
Ilya Kirillov 3b943706d8 Analysis API: fix call resolve inside plusAssign target
^KT-50864 fixed
2022-01-20 23:26:28 +03:00
Ilya Kirillov db1dedc9fe LL API: add source element kind rendering to the GetOrBuildFirTest 2022-01-20 23:26:28 +03:00
Ilya Kirillov 5e42be9849 Analysis API: fix redundant caret symbol in testdata 2022-01-02 21:56:54 +03:00
Ilya Kirillov 11c50a48ba Analysis API: add isSubclassOf tests 2022-01-02 21:56:53 +03:00
Ilya Kirillov af789346f5 Analysis API: fix getKtExpressionType for array assignment target 2022-01-02 21:56:49 +03:00
Roman Golyshev 3f8fff55cf FIR IDE: Fix ImportOptimizer for types used as generics' parameters 2021-12-24 16:31:34 +00: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
Mads Ager 61265a6501 Return error candidates from KtFirArrayAccessReference.resolveToSymbols 2021-12-21 13:22:15 +03:00
Vyacheslav Gerasimov f7a9065b75 Build: Use intellij maven repo instead of downloaded IDEA
#KTI-82
2021-12-16 21:48:23 +03:00
Simon Ogorodnik d084cfb65b FIR HL API: Unwrap substitution overrides if it contains stub types 2021-12-15 22:23:15 +03:00
Tianyu Geng 4d2074fb66 Analysis API: allow creating type from type alias
There does not seem to be any reason to limit the type creator to only
create types of concrete class or object but not type alias.
2021-12-15 16:09:33 +03:00
Tianyu Geng 5fbe5981f7 Analysis API: add KtType.isDenotable() 2021-12-15 16:09:31 +03:00
Tianyu Geng 2f393cdd02 FE1.0 Analysis API: get smartcast if available with getKtExpressionType
The current implementation still does not work with multicast. In
addition, it appears FE1.0 does not attempt smart cast if it's not used.
2021-12-15 16:09:29 +03:00
Tianyu Geng f197fc93db Analysis API: add test for KtDiagnosticsProvider 2021-12-09 15:56:52 +03:00
Tianyu Geng b52dc15aa7 Analysis API: remove dispatch receiver type from XXXSubstitutionOverridesUnwrappingTest 2021-12-09 11:01:52 +01:00
Tianyu Geng 9153db2ecc FE1.0 Analysis API: rewrite KtFe10CallResolver 2021-12-09 11:01:52 +01:00
Tianyu Geng f1bd3597f8 FE1.0 Analysis API: make KtSymbol only reference declaration-site subst-overrides
This is the FE1.0 counterpart of fa8bb47bdf
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
Tianyu Geng c9f9ce99c1 Analysis API: adapt to KtCall data model change
Also add API to check if a `KtFunctionSymbol` is the invoke function on
a Kotlin builtin functional type.
2021-12-06 12:40:42 +01:00
Tianyu Geng 53b3893738 Analysis API: rework data model of resolve call API 2021-12-06 12:40:42 +01:00
Tianyu Geng bc95733818 FIR LL API: resolve PSI elements to more specific FIR element
Compound access and implicit delegated constructor are mapped to FIR
elements that are way too broad.
2021-12-06 12:40:41 +01:00
Tianyu Geng e8f1af6140 Analysis API: introduce KtSignature 2021-12-06 12:40:41 +01:00
Ilya Kirillov 7440c726d0 Analysis API: fix invalid psi elements for constants and annotation values 2021-12-02 20:09:19 +01:00
Ilya Kirillov dc9c2aa39d Analysis API: add KDoc, small cosmetic improvements 2021-12-02 20:09:19 +01:00
Ilya Kirillov 6e4c87f138 Analysis API: pretty print declarations additionaly to debug rendering in some tests 2021-12-02 20:09:19 +01:00