Commit Graph

25 Commits

Author SHA1 Message Date
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
Jinseong Jeon 9ed2c9d371 FIR LC: add tests about type approximation in PsiType provider 2021-10-25 20:24:48 +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 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
Nikolay Lunyak e5d5e5be44 [FIR] Reorder scopes for KT-34822 2021-10-05 19:37:53 +03:00
Tianyu Geng 18a23f26f5 FIR IDE: allow getting overridden symbols on any callable symbols
This way caller don't need to first check if the symbol is allowed to
override. The current API throws for cases like Java field, or enum
entry, which is not very user-friendly.
2021-09-29 22:24:26 +02:00
Tianyu Geng 54b32f6911 FIR IDE: allow get overriding symbols of members in anonymous object 2021-09-29 22:24:26 +02:00
Jinseong Jeon 414881403b FIR IDE: handle annotation array values properly 2021-09-23 00:11:26 +02:00
Jinseong Jeon 0f16a2cb92 FIR IDE: rename some of constant values for consistency 2021-09-23 00:11:25 +02:00
Jinseong Jeon 6ef2dad895 FIR IDE: more comprehensive abstractions of annotation values 2021-09-23 00:11:25 +02:00
Tianyu Geng d77db2cda6 FIR checker: expose API to check if two types are compatible
This is useful for quickfixes offering casts. We don't want to offer
user to cast incompatible types.

Also, explicitly allow compare to `Nothing` and handle `Nothing` from intersection
2021-09-17 01:59:05 +03:00
Jinseong Jeon 068e81570d FIR IDE: type-aware constant conversion 2021-09-15 22:32:12 +02:00
Ilya Kirillov 42f0536904 FIR IDE: move analysis api fir testdata to the analysis directory 2021-09-15 11:32:43 +02:00