Previously, the FirFieldImpl generated from class delegation has a real
source. This causes troubles in the IDE. This change adds a new fake
source kind for class delegation fields.
Currently FIR IDE throws exceptions when enumerating members in this
scope if the class has delegate super types.
java.lang.IllegalStateException: Expected FirResolvedTypeRef with ConeKotlinType but was FirUserTypeRefImpl Tjava.lang.IllegalStateException: java.lang.IllegalStateException: Expected FirResolvedTypeRef with ConeKotlinType but was FirUserTypeRefImpl T
at org.jetbrains.kotlin.test.KotlinTestUtils.lambda$runTestWithThrowable$3(KotlinTestUtils.java:498)
at org.jetbrains.kotlin.test.MuteWithDatabaseKt.runTest(muteWithDatabase.kt:96)
at org.jetbrains.kotlin.test.KotlinTestUtils.runTestWithThrowable(KotlinTestUtils.java:493)
at org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCaseBase.runTest(KotlinLightCodeInsightFixtureTestCaseBase.java:93)
at com.intellij.testFramework.UsefulTestCase.defaultRunBare(UsefulTestCase.java:394)
at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:18)
at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:13)
at com.intellij.testFramework.EdtTestUtilKt$runInEdtAndWait$1.run(EdtTestUtil.kt:50)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:201)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:802)
at com.intellij.openapi.application.impl.ApplicationImpl.lambda$invokeAndWait$8(ApplicationImpl.java:475)
at com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvocator.java:126)
at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:84)
at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:132)
at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:47)
at com.intellij.openapi.application.impl.FlushQueue$FlushNow.run(FlushQueue.java:188)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:971)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:841)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:452)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:744)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:451)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:802)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:499)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.IllegalStateException: Expected FirResolvedTypeRef with ConeKotlinType but was FirUserTypeRefImpl T
at org.jetbrains.kotlin.fir.types.FirTypeUtilsKt.getConeType(FirTypeUtils.kt:33)
at org.jetbrains.kotlin.fir.scopes.KotlinScopeProviderKt.scopeForSupertype(KotlinScopeProvider.kt:111)
at org.jetbrains.kotlin.fir.scopes.KotlinScopeProvider.getUseSiteMemberScope(KotlinScopeProvider.kt:42)
at org.jetbrains.kotlin.fir.scopes.KotlinScopeProviderKt.unsubstitutedScope(KotlinScopeProvider.kt:83)
at org.jetbrains.kotlin.idea.frontend.api.fir.components.KtFirScopeProvider$getMemberScope$lambda-3$lambda-2$$inlined$withFirForScope$1.invoke(FirRefWithValidityCheck.kt:83)
at org.jetbrains.kotlin.idea.frontend.api.fir.components.KtFirScopeProvider$getMemberScope$lambda-3$lambda-2$$inlined$withFirForScope$1.invoke(FirRefWithValidityCheck.kt:41)
at org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacadeKt.withFirDeclaration(LowLevelFirApiFacade.kt:209)
at org.jetbrains.kotlin.idea.frontend.api.fir.components.KtFirScopeProvider.getMemberScope(KtFirScopeProvider.kt:323)
at org.jetbrains.kotlin.idea.frontend.api.components.KtScopeProviderMixIn$DefaultImpls.getMemberScope(KtScopeProvider.kt:34)
at org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession.getMemberScope(KtAnalysisSession.kt:26)
at org.jetbrains.kotlin.idea.core.overrideImplement.KtOverrideMembersHandler.getOverridableMembers(KtOverrideMembersHandler.kt:54)
at org.jetbrains.kotlin.idea.core.overrideImplement.KtOverrideMembersHandler.collectMembers(KtOverrideMembersHandler.kt:35)
at org.jetbrains.kotlin.idea.core.overrideImplement.KtOverrideMembersHandler.collectMembersToGenerate(KtOverrideMembersHandler.kt:28)
at org.jetbrains.kotlin.idea.codeInsight.AbstractOverrideImplementTest.doMultiOverrideImplement(AbstractOverrideImplementTest.kt:141)
at org.jetbrains.kotlin.idea.codeInsight.AbstractOverrideImplementTest.doMultiFileTest(AbstractOverrideImplementTest.kt:98)
at org.jetbrains.kotlin.idea.codeInsight.AbstractOverrideImplementTest.doMultiOverrideFileTest(AbstractOverrideImplementTest.kt:54)
at org.jetbrains.kotlin.idea.codeInsight.OverrideImplementTest.testDelegatedMembers(OverrideImplementTest.kt:121)
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 junit.framework.TestCase.runTest(TestCase.java:176)
at com.intellij.testFramework.UsefulTestCase.lambda$runTest$9(UsefulTestCase.java:331)
at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:462)
at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:480)
at com.intellij.testFramework.UsefulTestCase.invokeTestRunnable(UsefulTestCase.java:378)
at com.intellij.testFramework.UsefulTestCase.runTest(UsefulTestCase.java:350)
at org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCaseBase.lambda$runTest$0(KotlinLightCodeInsightFixtureTestCaseBase.java:93)
at org.jetbrains.kotlin.test.KotlinTestUtils.lambda$runTestWithThrowable$3(KotlinTestUtils.java:495)
... 36 more
.. 112 more
This commit adds the following actions:
- quickfix to implement missing members
- quickfix to implement missing members as constructor parameters
- action to implement members (Code - Generate - Implement)
- action to override members (Code - Generate - Override)
The current implementation is still missing some pieces, which will be
addressed in future changes.
- fully qualified names are not shorten
- some Kotlin types are not rendered correctly
It never worked: descriptor.declaresDefaultValue used by property.isOptional
works only for current module
(since it looks up psi), so we never access default value initializers
outside current module
FunctionNVarargBridgeLowering checked the name of the method instead
of whether the method overrides an invoke method. That doesn't work
when the name of the function gets mangled because of inline class
arguments.
Fixed KT-45084.
This allows taking function references to inline array constructors.
Also, redundant classes are no longer generated when function references
are passed as arguments to the array constructors.
#KT-46426 Fixed
Added checker for FirEqualityOperatorCall. It's surfaced as one of the
following diagnostics depending on the PSI structure and types under
comparison:
* INCOMPATIBLE_TYPES(_WARNING)
* EQUALITY_NOT_APPLICABLE(_WARNING)
* INCOMPATIBLE_ENUM_COMPARISON_ERROR
Comparing with FE1.0, the current implementation is more conservative
and only highlights error if the types are known to follow certain
contracts with `equals` method. Otherwise, the checker reports warnings
instead.
However, the current checker is more strict in the following situations:
1. it now rejects incompatible enum types like `Enum<E1>` and
`Enum<E2>`, which was previously accepted
2. it now rejects incompatible class types like `Class<String>` and
`Class<Int>`, which was previously accepted
3. the check now takes smart cast into consideration, so
`if (x is String) x == 3` is now rejected
For some reason using C++'s thread_local modifier
causes crashes during TLS access on runtime initialization
Kotlin dlls on Windows. This patch replaces the thread_local
modifier with __thread which doesn't have this problem
Including
* Support thread state switching in codegen
* Introduce and use GCUnsafeCall annotation
* Switch thread state in C++ runtime code
Also
* Register current thread in Mark&Sweep tests
* Store MemoryState in Worker instance
* Set worker tid in WorkerInit
With this change 'KaptWithoutKotlincTask' will also support overriding
default Gradle JDK to run kapt. In such case only 'in-process' kapt
worker isolation mode is supported.
If user does not provide custom JDK, kapt worker isolation mode will
be 'no-isolation' as before.
^KT-45611 In Progress
This is so that existing build scripts using
withType() do not break. Also, fix the failing
test.
It was necessary to keep outputFile for the js compile task
as it was accessed from the build scripts. Instead, a new
property is introduced which uses Gradle lazy properties.
Use lazy properties to configure KAPT tasks and in the model builder.
Also, avoid eager dependency resolution of the kaptExternalClasspath
file collection.
Avoid storing references to KotlinCompile task and use lazy properties
to configure task. Values are kept in-sync with the
Kotlin compile task (for the stub generation) using this mechanism.
This change migrates to using properties of KGP tasks and Gradle
built-in tasks. Also, in TaskProvider class, Configurator instances are
created to configure KGP tasks.
Update AbstractKotlinCompile, KotlinCompile, and Kotlin2JsCompile to
use Gradle properties, and introduce Configurator classes that are
using configuration-time data to configure task. Also, introduce
TaskConfigurator interface that should be implemented by classes that
are used to configure tasks.
When getting the incremental compilation information use the
task graph which processes all tasks present in it. Tasks have
all information that is needed to get IncrementalModuleInfo for all
compilations.