Commit Graph

68 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 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
Vladimir Dolzhenko 918a91dbdf Escape special names with backticks in test data
#KT-51248
2022-02-10 21:20:47 +00: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
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
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 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
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
Ilya Kirillov 0a5bbc0096 Analysis API: update rendering testdata after changing renderer 2021-12-02 20:09:18 +01:00
Ilya Kirillov 7919dae558 Analysis API: improve rendering of constant values 2021-12-02 20:09:17 +01:00
Ilya Kirillov 673459580c Analysis API: introduce annotation value for KClass 2021-12-02 20:09:16 +01:00
Ilya Kirillov f722a54c78 Analysis API: separate constant values from annotation values 2021-12-02 20:09:16 +01:00
Ilya Kirillov a70c336c2c Analysis API: fix constructor return type for FE1.0 implementation 2021-11-30 18:02:33 +01:00
Tianyu Geng 6e555e1d28 FE1.0 Analysis API: fix getReturnTypeForKtDeclaration for setter parameter 2021-11-30 18:02:33 +01:00
Tianyu Geng f1d0791f15 Analysis API: add test for KtDeclaration.getReturnKtType
FE1.0 always return kotlin.Unit as return type for constructors while
FIR returns the constructed class type. I am not sure which is more
desirable. Also, I am not sure how to make FE1.0 behave the same way.
2021-11-30 18:02:33 +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 193df3e3c4 Analysis API: fix annotation rendering for types 2021-11-22 22:46:55 +01:00
Tianyu Geng d0d1c8c4b9 Analysis API: add test for getReturnExpressionTargetSymbol
Also fix FIR and FE1.0 implementations.
2021-11-19 23:29:17 +01:00
Jinseong Jeon 205866a516 FIR IDE: add API to get KtType from KtTypeParameter 2021-11-18 17:33:17 +01:00
Ilya Kirillov 6f6a33e852 Analysis API: move testdata to corresponding components folders 2021-11-17 20:55:08 +01:00
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00
Yan Zhulanow 21026cc704 [FIR IDE] Enable constant evaluation tests in AAPI/FE10
Implementation of constant evaluation was changed, so now it doesn't
swallow error values.
2021-11-12 20:09:54 +09:00
Yan Zhulanow 5e9c397023 [FIR IDE] Fix unsigned number evaluation test in AAPI/FE10
Constant evaluator of FE10 checks existence of the unsigned type
in the classpath. Absence of UInt leads to a failure.
2021-11-12 20:09:53 +09:00
Yan Zhulanow 430108b138 [FIR IDE] Remove obsolete test data files 2021-11-12 20:09:52 +09:00
Yan Zhulanow d93d55064c [FIR IDE] Return error types from getExpectedType() as is in AAPI/FE10 2021-11-12 20:09:51 +09:00
Yan Zhulanow d6b9b8bdd4 [FIR IDE] Compare error types consistently in test data
Use the fixed error type description so test data can be shared
across both frontends.
2021-11-12 20:09:51 +09:00
Yan Zhulanow 8d18fa2d00 [FIR IDE] Ensure prefixed test output file differs from the default one 2021-11-12 20:09:50 +09:00
Ilya Kirillov 0c7728f64a Analysis API: fix PsiType creation for type parameter type with flexible upper bound 2021-11-10 18:49:43 +01:00
Jinseong Jeon 08e181a543 FIR IDE: add tests about types of array/list and their element 2021-11-09 09:25:45 +01:00
Jinseong Jeon 6d150fb7a5 FIR IDE: add APIs about FunctionClassKind 2021-11-08 20:12:17 +01:00
Tianyu Geng f217bb94de Use more consistent names for inheritors of BooleanIsMissing 2021-11-04 23:04:35 +01:00
Tianyu Geng 2c2851af6e Analysis API: add test covering get missing when branches
Also fix FIR implementation to generate boolean branches in the same
order as FE1.0.
2021-11-04 23:04:35 +01:00
Tianyu Geng 7de0937031 FIR IDE: get unstable smartcast from FE1.0-based analysis API
Note that the current FE1.0 implementation still has some limitations

1. only references used as receiver are being considered for smartcast.
2. Somehow the smartcast information is not retained if the for generic
typed receivers. See multiSmartcastAsReceiver_stable.descriptors.txt
2021-11-04 16:00:37 +01:00
Tianyu Geng 197079c85c FIR IDE: make smartcast API return unstable smartcasts 2021-11-04 16:00:37 +01:00
Jinseong Jeon c3c79b874d FIR IDE: make constant evaluator robust to arithmetic exception 2021-11-01 22:50:47 +01:00
Jinseong Jeon 4266ffa274 FIR IDE: fix typo in test directory (overridden) 2021-10-27 17:06:32 +02:00
Jinseong Jeon 9524825662 FIR LC: approximate local type only if it's necessary and out of scope 2021-10-25 20:24:48 +03:00