Commit Graph

73 Commits

Author SHA1 Message Date
Ilya Kirillov 6f6a33e852 Analysis API: move testdata to corresponding components folders 2021-11-17 20:55:08 +01:00
Jiaxiang Chen f8262a2549 implement KtSymbolWithTypeParameters interface for KtPropertySymbol 2021-11-17 18:22:34 +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
Roman Golyshev 13e27a3e06 [FIR IDE] Get rid of KtPossiblyMemberSymbol::dispatchType 2021-11-15 14:36:35 +03:00
Tianyu Geng 1c8d1fcdba FIR Tree: make FirDefaultPropertyAccessor propagate dispatchReceiverType
Custom property accessor has this property set and hence it make sense
for the default accessor to have it too. Also, FE1.0's counterpart
has this bit set and it's returned through the analysis API.
2021-11-15 11:10:46 +03:00
Ilya Kirillov 540bbc6bef Analysis API: temporary update descriptors testdata 2021-11-12 23:19:41 +01:00
Tianyu Geng a8ae704c0c FIR IDE: fix property accessor resolution
For property access with implicit receiver, the resolved fir is a
FirPropertyAccessExpression and hence we need to handle it in
KtFirCallResolver.
2021-11-12 21:56:46 +01: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 9106a4bbc5 [FIR IDE] Enable call resolution tests in AAPI/FE10
Fix numerous cases in Fe10KtCallResolver so the tests pass correctly.
2021-11-12 20:09:53 +09:00
Yan Zhulanow 2cdaa48e75 [FIR IDE] Support type annotation rendering in AAPI/FE10
This fixes the following tests:
- KtFe10ResolveCallTestGenerated#testVariableAsFunctionWithParameterName()
- KtFe10ResolveCallTestGenerated#testVariableAsFunctionWithParameterNameInNonFunctionType()
- KtFe10ResolveCallTestGenerated#testVariableAsFunctionWithParameterNameGeneric()
- KtFe10ResolveCallTestGenerated#testVariableAsFunctionWithParameterNameMixed()
- KtFe10ResolveCallTestGenerated#testVariableAsFunctionWithParameterNameAnnotation()
2021-11-12 20:09:53 +09:00
Yan Zhulanow 07fb02c1f9 [FIR IDE] Enable symbol-by-psi tests for AAPI/FE10 2021-11-12 20:09:52 +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 bba53aa967 [FIR IDE] Prettify DebugSymbolRenderer, unify its behavior 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
Yan Zhulanow 1e4e45cc5f [FIR IDE] Render error class types identically in DebugSymbolRenderer
This commit fixes KtFe10SymbolByPsiTestGenerated.testVarargFunctions().
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
Roman Golyshev 29bb8cea8f [FIR] Add missing ensureResolved to FirClassSubstitutionScope
`createNewTypeParametersAndSubstitutor` call might need resolved types
to be able to work correctly with the generics' type bounds
2021-10-29 15:59:35 +03:00
Jinseong Jeon 3f2c86afb8 FIR IDE/LC: introduce/use delegated member scope 2021-10-27 17:06:32 +02:00
Jinseong Jeon 700f8ac287 FIR IDE: relocate scope-related test data 2021-10-27 17:06:32 +02:00
Jinseong Jeon 4266ffa274 FIR IDE: fix typo in test directory (overridden) 2021-10-27 17:06:32 +02:00
Jinseong Jeon b52912162f FIR IDE: API to indicate delegated property 2021-10-27 17:06:30 +02:00
Tianyu Geng e195f0426e FIR IDE: add KtExtensionReceiverSymbol
This symbol represents the extension receiver of a callable and
currently is used as the resolution target of `this` in a callable with
extension.
2021-10-26 08:50:38 +00:00
Tianyu Geng d3c91ee9be FIR IDE: align resolution behavior of super with FE1.0
That is, for a labeled `super`, the keyword should resolve to the super
type and the label should be resolved to the current type.
2021-10-26 08:50:37 +00:00
Tianyu Geng 0d966ec65a FIR IDE: resolve implicit invoke to callable property 2021-10-26 08:50:37 +00: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
Jinseong Jeon 9ed2c9d371 FIR LC: add tests about type approximation in PsiType provider 2021-10-25 20:24:48 +03:00
Mikhail Glukhikh 7b9ac4c5f7 FIR: create constructors copies with correct containers in JvmMappedScope
#KT-49133 Fixed
2021-10-23 01:17:10 +03:00
Yan Zhulanow e06a75c197 [FIR IDE] Add separate test data for descriptor-based Analysis API implementation 2021-10-20 19:41:26 +03:00
Yan Zhulanow 1272c6aa33 [FIR IDE] Update Analysis API test data, untie it from the FIR implementation 2021-10-20 19:41:25 +03:00
Tianyu Geng 825be3588a FIR IDE: tolerate KtFirBackingFieldSymbol when getting overridden symbols 2021-10-18 08:29:22 +02:00
Tianyu Geng ba359fb296 FIR IDE: render captured type 2021-10-16 14:16:26 +02:00
Tianyu Geng 8b44a4685f FIR IDE: add API to get super types of a KtType 2021-10-16 14:16:25 +02:00
Tianyu Geng 68e70769c8 FIR IDE: return error type for expressions if needed
It seems unnatural to filter out error types, given that KtType does
have a way to represent unresolved types.
2021-10-16 14:16:24 +02:00
Tianyu Geng 80b3e2eb69 FIR IDE: move helpers for HasCommonSubtypeTestGenerated 2021-10-16 14:16:23 +02:00
Jinseong Jeon 8023e7fb02 FIR IDE: add a test for resolution of @Retention value 2021-10-15 19:45:04 +00:00
Mark Punzalan 167dc81d3b FIR/Analysis API: Get parameter name from function type notation or
`@ParameterName` annotation, which is also now added during type
resolution.
2021-10-15 16:19:00 +03:00
Tianyu Geng c10879be43 FIR IDE: get type of unresovled super
FIR does not provide any type for unresolved super so we manually
synthesize such types for completion to work.
2021-10-15 14:12:43 +02:00
Tianyu Geng e6d9098bec FIR IDE: Disable some tests in depended mode due to failures
The following error code path only runs in depended mode.

Test succeeded in normal analysis mode but failed in depended analysis mode.
java.lang.Exception: Test succeeded in normal analysis mode but failed in depended analysis mode.
	at org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.AbstractLowLevelApiTest.runTest(AbstractLowLevelApiTest.kt:126)
	at org.jetbrains.kotlin.analysis.api.fir.components.OverriddenDeclarationProviderTestGenerated.testOnEnumEntry(OverriddenDeclarationProviderTestGenerated.java:72)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:688)
	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
	at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:210)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:206)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:131)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:65)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
	at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:185)
	at java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:189)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175)
Caused by: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: No designation of local declaration public final static enum entry MyEntry: R|MyEnum|
	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:192)
	at org.jetbrains.kotlin.analysis.api.fir.components.AbstractOverriddenDeclarationProviderTest.doTestByFileStructure(AbstractOverriddenDeclarationProviderTest.kt:79)
	at org.jetbrains.kotlin.analysis.api.fir.test.framework.AbstractHLApiSingleModuleTest.doTestByFileStructure(AbstractHLApiSingleModuleTest.kt:16)
	at org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.AbstractLowLevelApiTest.runTest(AbstractLowLevelApiTest.kt:117)
	... 38 more
Caused by: java.lang.IllegalStateException: No designation of local declaration public final static enum entry MyEntry: R|MyEnum|
	at org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDeclarationDesignationKt.collectDesignation(FirDeclarationDesignation.kt:90)
	at org.jetbrains.kotlin.analysis.low.level.api.fir.api.LowLevelFirApiFacadeForResolveOnAir.runBodyResolveOnAir(LowLevelFirApiFacadeForResolveOnAir.kt:239)
	at org.jetbrains.kotlin.analysis.low.level.api.fir.api.LowLevelFirApiFacadeForResolveOnAir.getResolveStateForDependentCopy(LowLevelFirApiFacadeForResolveOnAir.kt:175)
	at org.jetbrains.kotlin.analysis.api.fir.KtFirAnalysisSession.createContextDependentCopy(KtFirAnalysisSession.kt:102)
	at org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.AbstractLowLevelApiTest.analyse(AbstractLowLevelApiTest.kt:203)
	at org.jetbrains.kotlin.analysis.api.fir.components.AbstractOverriddenDeclarationProviderTest.access$analyse(AbstractOverriddenDeclarationProviderTest.kt:22)
	at org.jetbrains.kotlin.analysis.api.fir.components.AbstractOverriddenDeclarationProviderTest$doTestByFileStructure$$inlined$executeOnPooledThreadInReadAction$1$1.compute(AbstractLowLevelApiTest.kt:183)
	at com.intellij.mock.MockApplication.runReadAction(MockApplication.java:183)
	at org.jetbrains.kotlin.analysis.api.fir.components.AbstractOverriddenDeclarationProviderTest$doTestByFileStructure$$inlined$executeOnPooledThreadInReadAction$1.call(AbstractLowLevelApiTest.kt:183)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:652)
	at java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:649)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:649)
	at java.lang.Thread.run(Thread.java:748)
2021-10-14 06:05:32 +03:00
Mikhail Glukhikh 7243d30869 Split property use-site targets during FIR building 2021-10-12 16:22:58 +03:00
Roman Golyshev 9113ccb8fc [FIR IDE] Properly support loop variables in KtFirSymbolProvider 2021-10-07 18:30:21 +03:00