Compare commits

...

2061 Commits

Author SHA1 Message Date
Mikhail Zarechenskiy
cba13c3c35 Take into account captured types with variables during fixation
#KT-41202 Fixed
2020-08-27 11:06:14 +03:00
Dmitry Gridin
5dbb6fdf50 [inspections] NamingConversion: add missing space in description
^KT-41395 Fixed
2020-08-27 14:58:33 +07:00
Yunir Salimzyanov
e12c35de5f Traverse all pages of muted tests on Teamcity (KTI-326)
incomplete list of remotely muted tests was causing re-muting of tests
that were not fetched
2020-08-26 19:37:11 +03:00
Mikhail Zarechenskiy
06a592c018 Fix SOE when recursive type argument is used with star projection
#KT-41043 Fixed
2020-08-26 19:23:21 +03:00
Mikhail Zarechenskiy
674e9e455f Fold lower constraints like (T!!..T) and (T..T?) into the latter one
#KT-41149 Fixed
2020-08-26 19:23:20 +03:00
Mikhail Zarechenskiy
e91b378b7d Don't perform unnecessary SAM conversions
#KT-41149 In Progress
2020-08-26 19:23:19 +03:00
Mikhail Zarechenskiy
6a7ed96be5 Consider T <: Nothing! as trivial during constraint incorporation
#KT-41149 In Progress
2020-08-26 19:23:18 +03:00
Mikhail Zarechenskiy
567e6ca9ca Fix OOM when there are several lambdas with extension function types
#KT-41335 Fixed
2020-08-26 19:23:18 +03:00
Jinseong Jeon
085e0dc1de FIR2IR: allow array expression as named argument for vararg 2020-08-26 18:01:21 +03:00
Vladimir Dolzhenko
54d3c5fb0a Pick up script language level from used stdlib in a gradle's classpath
^KT-41283 Fixed
2020-08-26 14:09:58 +00:00
Ilya Kirillov
949c67078d NJ2K: fix testdata of MultiFileTestGenerated.testNullabilityByDFa 2020-08-26 16:17:24 +03:00
Ilya Kirillov
c8ab827fa0 Wizard: fix invalid path in generated buildscript on windows 2020-08-26 16:17:24 +03:00
Nicolay Mitropolsky
c93ae64546 Uast: KotlinClassViaConstructorUSimpleReferenceExpression resolve to PsiClass (KT-41290) 2020-08-26 16:13:13 +03:00
Vladimir Dolzhenko
99924ea5e4 Fix Typo: equals() & hashCode(), toString() are written with the first uppercase letter
^KT-41390 Fixed
2020-08-26 14:59:31 +02:00
Jinseong Jeon
553ae68c96 FIR2IR: convert adapted callable reference with vararg 2020-08-26 14:26:19 +03:00
Igor Yakovlev
48034092e9 Fix SOE on library source based lightclass lookup
Fixed KT-41325
2020-08-26 12:10:09 +03:00
Jinseong Jeon
99286a6ce3 FIR2IR: introduce & use ClassId-based lookup for local class as IrParent 2020-08-26 10:08:16 +03:00
Aurimas Liutikas
777b16e0a3 Fix @Language injection when using named parameters
Start using names of arguments if they are available when fetching
the @Language injection information.

Fixes KT-35859
2020-08-25 23:02:53 +03:00
Alexander Udalov
a9ddf02556 Replace deprecated usages of max/min with maxOrNull/minOrNull 2020-08-25 20:33:59 +02:00
Nikolay Krasko
81dda96ece Mute flaky KotlinFindUsagesWithLibraryTestGenerated.KotlinLibrary 2020-08-25 21:31:11 +03:00
Nikolay Krasko
3a1158b4ef Minor: move mute KotlinFindUsagesWithLibraryTestGenerated to common 2020-08-25 21:31:11 +03:00
Nikolay Krasko
125819f9bf Mute flaky testUsingReadOnlyInterfaces test 2020-08-25 21:31:10 +03:00
Nikolay Krasko
1928390121 Prevent flaky behaviour from MakeOverriddenMemberOpenFix in tests
Several quick fix tests are flaky thanks to MakeOverrideMemberOpenFix
class. Flakiness is probably caused by `myQuickFixInfo: QuickFixInfo`
field. When there's no memory pressure, there's no resolve in dispatch
thread, but value may be invalidated because of soft reference usage
and re-evaluating might cause the test failure.

Caused by: org.jetbrains.kotlin.idea.caches.resolve.KotlinIdeaResolutionException: Kotlin resolution encountered a problem while analyzing KtNamedFunction
  at org.jetbrains.kotlin.idea.caches.resolve.ResolutionFacadeWithDebugInfo.analyze(ResolutionFacadeWithDebugInfo.kt:44)
  at org.jetbrains.kotlin.idea.caches.resolve.ExtendedResolutionApiKt.analyze(extendedResolutionApi.kt:97)
  at org.jetbrains.kotlin.idea.caches.resolve.ExtendedResolutionApiKt.resolveToDescriptorIfAny(extendedResolutionApi.kt:39)
  at org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils.resolveToDescriptorIfAny(resolutionApi.kt:60)
  at org.jetbrains.kotlin.idea.quickfix.MakeOverriddenMemberOpenFix.computeInfo(MakeOverriddenMemberOpenFix.kt:54)
  at org.jetbrains.kotlin.idea.quickfix.MakeOverriddenMemberOpenFix.access$computeInfo(MakeOverriddenMemberOpenFix.kt:38)
  at org.jetbrains.kotlin.idea.quickfix.MakeOverriddenMemberOpenFix$myQuickFixInfo$2.invoke(MakeOverriddenMemberOpenFix.kt:41)
  at org.jetbrains.kotlin.idea.quickfix.MakeOverriddenMemberOpenFix$myQuickFixInfo$2.invoke(MakeOverriddenMemberOpenFix.kt:38)
  at org.jetbrains.kotlin.idea.core.util.CachedValueHelpersKt$sam$com_intellij_psi_util_CachedValueProvider$0.compute(CachedValueHelpers.kt)
  at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:54)
  at com.intellij.util.CachedValueBase.lambda$getValueWithLock$0(CachedValueBase.java:228)
  at com.intellij.util.IdempotenceChecker.applyForRandomCheck(IdempotenceChecker.java:336)
  at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:228)
  at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:43)
  at org.jetbrains.kotlin.idea.core.util.CachedValueHelpersKt.getValue(CachedValueHelpers.kt:25)
  at org.jetbrains.kotlin.idea.quickfix.MakeOverriddenMemberOpenFix.getMyQuickFixInfo(MakeOverriddenMemberOpenFix.kt)
  at org.jetbrains.kotlin.idea.quickfix.MakeOverriddenMemberOpenFix.getContainingDeclarationsNames(MakeOverriddenMemberOpenFix.kt:45)
  at org.jetbrains.kotlin.idea.quickfix.MakeOverriddenMemberOpenFix.getText(MakeOverriddenMemberOpenFix.kt:89)
  at com.intellij.codeInsight.intention.impl.IntentionActionWithTextCaching$MyIntentionAction.getText(IntentionActionWithTextCaching.java:165)
  at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.lambda$invokeIntention$52(CodeInsightTestFixtureImpl.java:1933)
  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$invokeLater$4(ApplicationImpl.java:322)
  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:965)
  at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:838)
  at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:449)
  at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:733)
  at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:448)
  at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:802)
  at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:496)
  at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at com.intellij.util.ui.UIUtil.dispatchAllInvocationEvents(UIUtil.java:1738)
  at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.lambda$invokeIntention$53(CodeInsightTestFixtureImpl.java:1939)
  at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.withReadOnlyFile(CodeInsightTestFixtureImpl.java:1960)
  at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.invokeIntention(CodeInsightTestFixtureImpl.java:1929)
  at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.lambda$launchAction$14(CodeInsightTestFixtureImpl.java:680)
  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(EdtTestUtil.kt:44)
  at com.intellij.testFramework.EdtTestUtil$Companion.runInEdtAndWait(EdtTestUtil.kt:18)
  at com.intellij.testFramework.EdtTestUtil.runInEdtAndWait(EdtTestUtil.kt)
  at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.launchAction(CodeInsightTestFixtureImpl.java:680)
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest$applyAction$stubComparisonFailure$1.invoke(AbstractQuickFixTest.kt:176)
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest$applyAction$stubComparisonFailure$1.invoke(AbstractQuickFixTest.kt:34)
  at org.jetbrains.kotlin.idea.caches.resolve.ResolveInDispatchThreadManager.runWithForceCheckForResolveInDispatchThreadInTests$idea_core(ResolveInDispatchThreadManager.kt:115)
  at org.jetbrains.kotlin.idea.caches.resolve.ResolveInDispatchThreadManagerKt.forceCheckForResolveInDispatchThreadInTests(ResolveInDispatchThreadManager.kt:40)
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest.applyAction(AbstractQuickFixTest.kt:175)
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest.access$applyAction(AbstractQuickFixTest.kt:34)
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest$doKotlinQuickFixTest$1.run(AbstractQuickFixTest.kt:125)
  at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:220)
  at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:177)
  at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:167)
  at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:153)
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest.doKotlinQuickFixTest(AbstractQuickFixTest.kt:96)
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest.access$doKotlinQuickFixTest(AbstractQuickFixTest.kt:34)
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest$doTest$1.invoke(AbstractQuickFixTest.kt:60)
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest$doTest$1.invoke(AbstractQuickFixTest.kt:34)
  at org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCaseKt.withCustomCompilerOptions(KotlinLightCodeInsightFixtureTestCase.kt:253)
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest.doTest(AbstractQuickFixTest.kt:55)
  at org.jetbrains.kotlin.test.KotlinTestUtils.lambda$testWithCustomIgnoreDirective$6(KotlinTestUtils.java:803)
  at org.jetbrains.kotlin.test.MuteWithFileKt$testWithMuteInFile$1.invoke(muteWithFile.kt:41)
  at org.jetbrains.kotlin.test.KotlinTestUtils.runTestImpl(KotlinTestUtils.java:773)
  at org.jetbrains.kotlin.test.KotlinTestUtils.runTest(KotlinTestUtils.java:716)
  at org.jetbrains.kotlin.idea.quickfix.QuickFixTestGenerated$Override.runTest(QuickFixTestGenerated.java:10025)
  at org.jetbrains.kotlin.idea.quickfix.QuickFixTestGenerated$Override.testOverridingDelegatedMethod(QuickFixTestGenerated.java:10074)
  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:327)
  at com.intellij.testFramework.UsefulTestCase.lambda$invokeTestRunnable$10(UsefulTestCase.java:364)
  at com.intellij.testFramework.EdtTestUtilKt.runInEdtAndWait(EdtTestUtil.kt:44)
  at com.intellij.testFramework.UsefulTestCase.invokeTestRunnable(UsefulTestCase.java:363)
  at com.intellij.testFramework.UsefulTestCase.runTest(UsefulTestCase.java:346)
  at org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCaseBase.lambda$runTest$0(KotlinLightCodeInsightFixtureTestCaseBase.java:92)
  at org.jetbrains.kotlin.test.KotlinTestUtils.lambda$runTestWithThrowable$4(KotlinTestUtils.java:726)
  ... 36 more
Caused by: org.jetbrains.kotlin.idea.caches.resolve.ResolveInDispatchThreadException: Resolve is not allowed under the write action for `org.jetbrains.kotlin.idea.quickfix.MakeOverriddenMemberOpenFix`!
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest$applyAction$writeActionResolveHandler$1.invoke(AbstractQuickFixTest.kt:170)
  at org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest$applyAction$writeActionResolveHandler$1.invoke(AbstractQuickFixTest.kt:34)
  at org.jetbrains.kotlin.idea.caches.resolve.ResolveInDispatchThreadManager.assertNoResolveInDispatchThread$idea_core(ResolveInDispatchThreadManager.kt:73)
  at org.jetbrains.kotlin.idea.caches.resolve.ModuleResolutionFacadeImpl.analyze(ModuleResolutionFacadeImpl.kt:60)
  at org.jetbrains.kotlin.idea.caches.resolve.ModuleResolutionFacadeImpl.analyze(ModuleResolutionFacadeImpl.kt:56)
  at org.jetbrains.kotlin.idea.caches.resolve.ResolutionFacadeWithDebugInfo.analyze(ResolutionFacadeWithDebugInfo.kt:45)
  ... 126 more
2020-08-25 21:31:10 +03:00
Mikhail Glukhikh
5702fb3b22 FIR: fix CCE in AttributeArrayOwner 2020-08-25 19:29:59 +03:00
Mikhail Glukhikh
962059a878 Introduce FirProperty.hasBackingField & use it in FIR2IR 2020-08-25 19:29:58 +03:00
Mikhail Glukhikh
c6417696cf FirProperty: return back 'isReferredViaField' attribute 2020-08-25 19:29:58 +03:00
Jinseong Jeon
3e9ac75cfc FIR: record use of backing field symbol to indeed add a backing field 2020-08-25 19:29:58 +03:00
Vyacheslav Gerasimov
0cc3762f9a Build: Fix kotlinx-metadata-klib publication 2020-08-25 17:18:00 +03:00
vldf
36f2f1fcf7 [FIR] Add lightTree support to extended checkers + minor refactorings 2020-08-25 17:08:57 +03:00
vldf
da702992d9 [FIR] Fix null source on destructuring declaration 2020-08-25 16:33:49 +03:00
Ilya Matveev
30d24ed943 Tests, Gradle: Fix broken test for KT-40834 2020-08-25 13:06:40 +00:00
Ilya Matveev
920f1184bd Revert "Revert "CocoaPods: Skip synthetic task on non-mac hosts""
This reverts commit 6040491373.
2020-08-25 13:06:39 +00:00
Nick
fd9bfe44f1 [FIR] Visit class annotations without the class's scope 2020-08-25 15:59:33 +03:00
vldf
3cad88a58c [FIR] Fir Helpers hotfix 2020-08-25 14:49:56 +03:00
vldF
cb627952b2 [FIR] Checkers performance improvement
[FIR] Checkers performance improvement
2020-08-25 14:20:30 +03:00
Ilya Goncharov
d86c81cb38 [JS, Gradle] Fix test on overflow, now throw exception on overflow 2020-08-25 13:44:20 +03:00
Arsen Nagdalian
8b4e8a2c0c Diagnostics: add diagnostic for reporting contract description blocks in old frontend 2020-08-25 12:58:39 +03:00
Arsen Nagdalian
80d7f6b688 Ignore the "contract" keyword in code completion 2020-08-25 12:58:39 +03:00
Arsen Nagdalian
ede1c08a9b [FIR] Add resolution of contracts that are written using the new syntax 2020-08-25 12:58:39 +03:00
Arsen Nagdalian
b8b60864fd [FIR] Add contracts tests and place them in a separate directory 2020-08-25 12:58:39 +03:00
Arsen Nagdalian
86e07cd626 Parser tests: move the contract description blocks tests to a separate folder and add a test for property accessors' contracts 2020-08-25 12:58:38 +03:00
Arsen Nagdalian
66f7250380 [FIR] Add contract description blocks support to "lightTree2FIR" conversion 2020-08-25 12:58:38 +03:00
Arsen Nagdalian
9fd104eec8 [FIR] Add contract description blocks support to RawFirBuilder 2020-08-25 12:58:38 +03:00
Arsen Nagdalian
d53f3b9ba8 [PSI] Add some useful getters to psi nodes 2020-08-25 12:58:37 +03:00
Arsen Nagdalian
a936c6331a [Parser] Add getters' and setters' contracts parsing 2020-08-25 12:58:37 +03:00
Arsen Nagdalian
6c06008b4d [FIR] Add a class representing the old syntax contract description in order to use the previous class for the new syntax 2020-08-25 12:58:37 +03:00
Arsen Nagdalian
b83aa88eff [FIR] Add function for getting ConeEffectDeclaration from FirEffectDeclaration and use it where needed 2020-08-25 12:58:35 +03:00
Arsen Nagdalian
991b18fec4 [FIR] Add a Fir node that wraps a ConeEffectDeclaration 2020-08-25 12:58:35 +03:00
Arsen Nagdalian
32a64b888e [Parser] Add parsing of function's contract either before or after type constraints 2020-08-25 12:58:34 +03:00
Arsen Nagdalian
1b57889773 Clean the code 2020-08-25 12:58:34 +03:00
Arsen Nagdalian
f781a9993b Parser tests: add tests for contract description blocks 2020-08-25 12:58:34 +03:00
Arsen Nagdalian
2e9a898f45 [Parser] Move function's contracts parsing in before type constraints parsing 2020-08-25 12:58:34 +03:00
Arsen Nagdalian
0990434840 [Parser] Modify parser so that it could parse contract description blocks of functions 2020-08-25 12:58:34 +03:00
Arsen Nagdalian
e3fe9c3314 [PSI] Add new Psi nodes representing contract effects list and each individual contract effect in the list 2020-08-25 12:58:34 +03:00
Arsen Nagdalian
4b7d34b537 Add "contract" keyword 2020-08-25 12:58:34 +03:00
Dmitriy Novozhilov
316e0e6609 [FIR] Update testdata 2020-08-25 12:07:59 +03:00
Dmitriy Novozhilov
3ccb72bb1a Shadow :core:compiler.common inside kotlinx.metadata 2020-08-25 10:41:34 +03:00
Dmitriy Novozhilov
811a2206a5 Fix usages of KotlinBuiltIns after rebase 2020-08-25 10:41:34 +03:00
Dmitriy Novozhilov
bc1b6d3588 Rename :core:descriptors.common to :core:compiler.common 2020-08-25 10:41:34 +03:00
Dmitriy Novozhilov
864cf21f03 Merge :core:type-system into :core:descriptors.common 2020-08-25 10:41:34 +03:00
Dmitriy Novozhilov
5fa80a2f8c Merge :core:deserialization:deserialization.common into :core:descriptors.common 2020-08-25 10:41:34 +03:00
Dmitriy Novozhilov
bbac270b33 Move OperatorNameConventions to :core.descriptors.common 2020-08-25 10:41:34 +03:00
Dmitriy Novozhilov
2760a187a9 Move FunctionClassKind utils to :core.descriptors.common 2020-08-25 10:41:33 +03:00
Dmitriy Novozhilov
2285d3e3cf Move Variance and AnnotationUseSiteTarget to :core.descriptors.common 2020-08-25 10:41:33 +03:00
Dmitriy Novozhilov
167f18b738 Move SourceElement and SourceFile to :deserialization.common
Remove dependency on `:core:descriptors` from `:core:deserialization:deserialization.common`
2020-08-25 10:41:33 +03:00
Dmitriy Novozhilov
a764732020 Rename KotlinBuiltInsNames to StandardNames 2020-08-25 10:41:33 +03:00
Dmitriy Novozhilov
d032fdfc44 [FIR] Cleanup dependencies in :compiler:fir:raw-fir modules 2020-08-25 10:41:33 +03:00
Dmitriy Novozhilov
b6fd6c3a84 [FIR] Remove dependency on descriptors from :compiler:fir:raw-fir.raw-fir.common module 2020-08-25 10:41:32 +03:00
Dmitriy Novozhilov
71a517c686 [FIR] Rename :compiler:fir:raw-fir:fir-common to :compiler:fir:raw-fir:raw-fir.common 2020-08-25 10:41:32 +03:00
Dmitriy Novozhilov
7d4349edc2 [FIR] Remove dependency on descriptors from :compiler:fir:tree module 2020-08-25 10:41:32 +03:00
Dmitriy Novozhilov
95346f834b [FIR] Fix forgotten dependency to contracts of FE 1.0 2020-08-25 10:41:32 +03:00
Dmitriy Novozhilov
73ace6d161 Remove dependency to descriptors from :compiler:config module 2020-08-25 10:41:32 +03:00
Dmitriy Novozhilov
82a9b1492b Move RenderingUtils to :core:descriptors.common module 2020-08-25 10:41:32 +03:00
Dmitriy Novozhilov
ba6b1c37d0 Move TargetPlatform to :core:descriptors.common module 2020-08-25 10:41:32 +03:00
Dmitriy Novozhilov
d6d2be8e58 Move incremental components to :core:descriptors.common module 2020-08-25 10:41:31 +03:00
Dmitriy Novozhilov
3a48265077 Move ModuleDescriptor.Capability to :core:descriptors.common module 2020-08-25 10:31:37 +03:00
Dmitriy Novozhilov
6f0cd14afa Move common classes to new :core:deserialization:deserialization.common module 2020-08-25 10:31:37 +03:00
Dmitriy Novozhilov
079a2dfe1e Move EventOccurrencesRange class to :core:descriptors.common module 2020-08-25 10:31:37 +03:00
Dmitriy Novozhilov
f7f489537b [FIR] Remove dependency on :core:descriptors from :compiler:fir:tree 2020-08-25 10:31:37 +03:00
Dmitriy Novozhilov
e92caae609 [FIR] Remove dependency on :core:descriptors from :compiler:fir:cones 2020-08-25 10:31:36 +03:00
Dmitriy Novozhilov
45cf221b97 Move util functions from KotlinBuiltIns to :core:descriptors.common module 2020-08-25 10:31:36 +03:00
Dmitriy Novozhilov
20a2ad8223 Move FunctionClassDescriptor.Kind to :core:descriptors.common module 2020-08-25 10:31:36 +03:00
Dmitriy Novozhilov
7a7fe77b8e Move static constants with builtin names to :core:descriptors.common module 2020-08-25 10:31:36 +03:00
Dmitriy Novozhilov
2e92fe9be9 [FIR2IR] Add fir2ir component for converting fir visibility to FE 1.0 2020-08-25 10:31:36 +03:00
Dmitriy Novozhilov
a02109d857 [FIR] Add FirVisibilityChecker session component
This is needed because we have different visibility rules for different
  platform visibilities (e.g. protected and package private on JVM), so
  we need ability to configure visibility checks for different platforms
2020-08-25 10:31:35 +03:00
Dmitriy Novozhilov
18ae593700 [FIR] Rename new visibilities to CamelCase
It's more convenient since they are objects now instead of
  const fields in FE 1.0
2020-08-25 10:31:35 +03:00
Dmitriy Novozhilov
43821b681c [FIR] Introduce new Visibility class which not depends on descriptors 2020-08-25 10:31:35 +03:00
Dmitriy Novozhilov
9d9f9c52c0 Extract some classes from descriptors module to :core:common
This is needed to remove dependencies from fir modules to
  `:core:descriptors` module

What was extracted:
- Modality
- ClassKind
- org.jetbrains.kotlin.name package
2020-08-25 10:31:35 +03:00
Dmitriy Novozhilov
41ba9b0a2d [FIR] Add flag to disable transformers required only for plugins 2020-08-25 10:31:34 +03:00
Mikhail Glukhikh
53ad502d2a [FIR2IR] Generate fake overrides earlier and bind them later
Before this commit, we generated fake overrides at last FIR2IR stage,
after having all functions and classes built. This could lead to a
situation when fake override was called before it was generated.
This commit fixes this situation.
2020-08-25 10:00:26 +03:00
Ilya Chernikov
ee9c597767 Build: Remove exclusion of kotlinx-coroutines-core in scripting-compiler
The previous fix was insufficient to fix gradle substitution in MPP
projects (https://github.com/gradle/gradle/issues/14017)
2020-08-24 19:13:16 +02:00
Nikolay Krasko
741f5de0f9 Clean PSI elements in KotlinExpressionMover
Fix report about leaked projects on build server:

via 'com.intellij.psi.impl.PsiManagerImpl.myProject'; Value: 'Project (name=light_temp, containerState=DISPOSE_COMPLETED, componentStore=/mnt/agent/temp/buildTmp/ideaProject_test_1285163057398451250/testRootGW1/unitTest_addPrimaryConstructorParameter/light_temp....' of class com.intellij.openapi.project.impl.ProjectImpl
      via 'com.intellij.psi.impl.source.PsiFileImpl.myManager'; Value: 'com.intellij.psi.impl.PsiManagerImpl@4ecdfe8' of class com.intellij.psi.impl.PsiManagerImpl
      via 'com.intellij.psi.impl.source.tree.CompositeElement.myWrapper'; Value: 'DummyHolder' of class com.intellij.psi.impl.source.JavaDummyHolder
      via 'com.intellij.psi.impl.source.tree.TreeElement.myParent'; Value: 'Element(DUMMY_HOLDER)' of class com.intellij.psi.impl.source.tree.FileElement
      via 'com.intellij.psi.impl.source.SubstrateRef$2.val$node'; Value: 'Element(VALUE_PARAMETER)' of class com.intellij.psi.impl.source.tree.CompositeElement
      via 'com.intellij.extapi.psi.StubBasedPsiElementBase.mySubstrateRef'; Value: 'com.intellij.psi.impl.source.SubstrateRef$2@5d02fa19' of class com.intellij.psi.impl.source.SubstrateRef$2
      via 'kotlin.Pair.first'; Value: 'VALUE_PARAMETER' of class org.jetbrains.kotlin.psi.KtParameter
      via 'org.jetbrains.kotlin.idea.codeInsight.upDownMover.KotlinExpressionMover.parametersOrArgsToMove'; Value: '(VALUE_PARAMETER, VALUE_PARAMETER)' of class kotlin.Pair
      via '?'; Value: 'org.jetbrains.kotlin.idea.codeInsight.upDownMover.KotlinExpressionMover@7a6f128e' of class org.jetbrains.kotlin.idea.codeInsight.upDownMover.KotlinExpressionMover
      via 'com.intellij.openapi.extensions.impl.ExtensionPointImpl.myExtensionsCacheAsArray'; Value: '[Lcom.intellij.codeInsight.editorActions.moveUpDown.StatementUpDownMover;@276493b6' of class [Lcom.intellij.codeInsight.editorActions.moveUpDown.StatementUpDownMover;
      via 'java.util.concurrent.ConcurrentHashMap$Node.val'; Value: 'com.intellij.statementUpDownMover' of class com.intellij.openapi.extensions.impl.InterfaceExtensionPoint
      via '?'; Value: 'com.intellij.statementUpDownMover=com.intellij.statementUpDownMover' of class java.util.concurrent.ConcurrentHashMap$Node
      via 'java.util.concurrent.ConcurrentHashMap.table'; Value: '[Ljava.util.concurrent.ConcurrentHashMap$Node;@724e0cae' of class [Ljava.util.concurrent.ConcurrentHashMap$Node;
      via 'com.intellij.openapi.extensions.impl.ExtensionsAreaImpl.extensionPoints'; Value: '{com.intellij.embeddedTokenHighlighter=com.intellij.embeddedTokenHighlighter, org.intellij.groovy.expectedTypesContributor=org.intellij.groovy.expectedTypesContributor, org.jetbrains.kotlin.resolveSco...' of class java.util.concurrent.ConcurrentHashMap
      via 'com.intellij.serviceContainer.ComponentManagerImpl.extensionArea'; Value: 'Application (containerState=ACTIVE)  (Unit test) (Internal) (Headless) (Command line)' of class com.intellij.openapi.extensions.impl.ExtensionsAreaImpl
      via '?'; Value: 'Application (containerState=ACTIVE)  (Unit test) (Internal) (Headless) (Command line)' of class com.intellij.openapi.application.impl.ApplicationImpl
       (from ApplicationManager.getApplication())
2020-08-24 19:03:03 +03:00
Nikolay Krasko
18195b3296 Rewrite SmartCompletionMultifileHandlerTest to KotlinFixtureCompletionBaseTestCase
Use light projects as an attempt to fight leaking project errors
2020-08-24 19:03:03 +03:00
Nikolay Krasko
e95c3e2905 Rewrite CompletionMultiFileHandlerTest to KotlinFixtureCompletionBaseTestCase
Use light projects as an attempt to fight leaking project errors
2020-08-24 19:03:03 +03:00
Ilya Goncharov
f92083989a [JS, Wizard] Fix build integrity 2020-08-24 19:01:38 +03:00
Nikolay Krasko
6040491373 Revert "CocoaPods: Skip synthetic task on non-mac hosts"
This reverts commit ce029822
2020-08-24 18:31:32 +03:00
Ilya Goncharov
621c87ee84 Overflowed teamcity messages should failed build
^KT-41133 fixed
2020-08-24 18:22:22 +03:00
Nick
e7b12b9bb1 [FIR] Fix false positive SUPER_NOT_AVAILABLE 2020-08-24 17:23:32 +03:00
Dmitry Petrov
a2dabe11c5 JVM KT-41150: Fix backward compatibility for inline vals in inline class
In 1.3.x, for inline class member inline vals 'getFoo-impl' method was
generated in corresponding inline class.
Since 1.4.0, getters for properties returning inline class values are
mangled (so corresponding getters are named 'getFoo-<mangling_hash>'.
However, to maintain backward compatibility with libraries compiled with
1.3.x, inliner should be able to find 'getFoo-impl' method in the
bytecode.
2020-08-24 16:17:12 +03:00
Vladimir Ilmov
27a22fc1e9 Cleanup Coroutine panel in case connection gets disposed soon after
creation.
2020-08-24 15:09:14 +02:00
Vladimir Ilmov
cb2ab4676b (CoroutineDebugger) Top node added to prevent dumpCoroutine() call
Panel gather information from the agent on each breakpoint hit.
2020-08-24 15:09:13 +02:00
Alexander Udalov
fa45650fd0 JVM IR: specialize ExpressionCodegen.visitFunctionAccess for constructors
This makes the code a bit clearer, and gets rid of some extra type
mapper invocations when generating constructor calls.
2020-08-24 14:51:52 +02:00
Ilya Kirillov
f9bd935ac6 Wizard: fix missing module templates 2020-08-24 15:48:02 +03:00
Kirill Shmakov
5a91dd0439 Update main wizard tests 2020-08-24 15:43:08 +03:00
Kirill Shmakov
147a8c357d Wizard: switch androidx.core -> android.material 2020-08-24 15:43:08 +03:00
Kirill Shmakov
57e9e9a2a1 Wizard: add android.useAndroidX property 2020-08-24 15:43:07 +03:00
Kirill Shmakov
9e88d61be4 Wizard: switch android:allowBackup
Otherwise template could leak sensitive data.
2020-08-24 15:43:06 +03:00
Kirill Shmakov
94ae839d2c Wizard: update Android Appcompat version 2020-08-24 15:43:03 +03:00
Kirill Shmakov
06f9a4e228 Wizard: update Android Gradle plugin version 2020-08-24 15:43:02 +03:00
Roman Artemev
a095909d5c [Plugin API] Provide special context in EP for link-time resolve
- requires to customize declarations from synthetic declarations
2020-08-24 15:37:39 +03:00
Steven Schäfer
ea98062241 JVM IR: Fix compilation of inline functions in anonymous objects...
...in class members. The corresponding classes end up nested in the
class initializer of the surrounding class and we need to take this into
account when creating instances of ClassCodegen.

This fixes KT-40332 on the JVM IR backend.
2020-08-24 14:10:36 +02:00
Ilya Matveev
ce02982226 CocoaPods: Skip synthetic task on non-mac hosts
This patch performs the following changes:

1. Create synthetic tasks even if synthetic projects are
not supported on the current host. This change simplifies
configuring dependencies between these tasks and custom user
tasks at the user side.

2. Disable synthetic tasks if synthetic projects are not supported
on the current host

Issue #KT-40834 Fixed
2020-08-24 12:04:50 +00:00
Alexander Udalov
b10cc6657e Fix loading of builtins resources in kotlin-reflect in Java modular mode
The main change here is that when kotlin-reflect is being run under Java
9+, we use another implementation of BuiltInsResourceLoader (see
libraries/reflect/api/src/java9) which loads .kotlin_builtins files from
the java.lang.Module instance of kotlin-stdlib, instead of the class
loader of kotlin-reflect, which may not have access to those resources.

If the application is being run in the old (classpath) mode, that Module
represents the unnamed module, which contains everything on the
classpath, and everything works as before. But if it's being run in the
modular mode, that Module instance is an encapsulated module for
kotlin-stdlib classes and resources, exactly where .kotlin_builtins
files are located.

This fixes a regression in 1.4.0. Prior to 1.4, kotlin-reflect and
kotlin-stdlib were not named modules (see KT-21266) and were loaded as
_automatic_ modules even if the application was run in the modular mode.
Apparently, they shared the same class loader in that case and looking
up .kotlin_builtins resources worked.

This change was supposed to go alongside
828cc6dbf3, but was overlooked because
adding module-info to standard libraries was postponed at that point.

Also slightly refactor Java9ModulesIntegrationTest to simplify running
compiled code, and add a smoke test on using kotlin-reflect in modular
mode.

 #KT-40842 Fixed
2020-08-24 13:30:00 +02:00
Alexander Udalov
201fa849b8 Workaround problem with log4j warnings in CLI tests
#KTI-166
2020-08-24 13:30:00 +02:00
Nick
05cfb654ba [FIR] Fix removeAtInt test 2020-08-24 13:38:43 +03:00
Nikolay Krasko
2b983b1c20 Mute flaky JavaAgainstKotlinBinariesCheckerTestGenerated.testEnumStaticImportInJava 2020-08-24 13:20:31 +03:00
Ilya Goncharov
2d8643b6ef [Gradle, JS] Add nowarn flag for kotlin2js
^KT-41340 fixed
2020-08-24 13:05:22 +03:00
Nick
aeae898b94 [FIR] Fix issues with properties' fake sources 2020-08-24 11:06:45 +03:00
Nick
61e21dadec [FIR] Add 3 type mismatch diagnostics 2020-08-24 11:06:12 +03:00
Nick
c8f8908a01 [FIR] Add NO_THIS & INSTANCE_ACCESS_BEFORE_SUPER_CALL 2020-08-24 11:06:10 +03:00
Nick
7e1c2cfd36 [FIR] Add diagnostic INAPPLICABLE_LATEINIT_MODIFIER + some builtin types 2020-08-24 11:06:06 +03:00
Nick
091e12c093 [FIR] Add diagnostic CONFLICTING_PROJECTION 2020-08-24 11:06:04 +03:00
Dmitriy Dolovov
d40bca4143 [Commonizer] Short-circuiting of type aliases
^KT-41220
2020-08-24 12:21:12 +07:00
Vyacheslav Gerasimov
8a84af8a6f Build: Fix idea-gradle test task dependency on dist 2020-08-22 14:11:34 +03:00
Mark Punzalan
a9359eb530 RangeContainsLowering: Handle unsigned ranges. 2020-08-21 21:15:27 +02:00
Mark Punzalan
ceba9f231d RangeContainsLowering: Fix bug in additional condition order for
`until` ranges.
2020-08-21 21:15:27 +02:00
Mark Punzalan
60a2f7d03f RangeContainsLowering: Handle Comparable ranges. 2020-08-21 21:15:27 +02:00
Mark Punzalan
1c1b1b4b0f Initial version of RangeContainsLowering, which optimizes calls to
contains() on ClosedRanges.
2020-08-21 21:15:27 +02:00
Jinseong Jeon
ca541337d1 FIR: skip return insertion for lambda w/ Unit return type 2020-08-21 19:16:43 +03:00
Alexander Udalov
f1ce668ede IR: minor, don't store unnecessary fields 2020-08-21 17:52:10 +02:00
Alexander Udalov
26eb51a9f9 Minor, fix generateBuiltins test 2020-08-21 17:51:23 +02:00
Nikolay Krasko
d170f46bfc Mute flaky fun usages tests 2020-08-21 18:28:21 +03:00
Nikolay Krasko
6293842d81 Mute XCoroutinesStackTraceTestGenerated flaky test 2020-08-21 18:28:21 +03:00
Nikolay Krasko
9d300f56cc Mark SubpluginsIT.testKotlinVersionDowngradeInSupbrojectKt39809 as flaky 2020-08-21 18:28:21 +03:00
Nikolay Krasko
8f785f6bb2 Mute flaky tests in ContinuationStackTraceTestGenerated 2020-08-21 18:28:21 +03:00
Nikolay Krasko
fd036c2658 Mute flaky tests in JavaAgainstKotlinBinariesCheckerTestGenerated 2020-08-21 18:28:21 +03:00
Roman Artemev
fcca2c6fa3 [JS IR] fix failing test 2020-08-21 17:44:07 +03:00
pyos
5722f889d8 FIR2IR: scan the entire interface tree for delegatable members 2020-08-21 16:50:23 +03:00
Mikhail Glukhikh
99d2fd7c4d [FIR] Handle open in interface correctly during status resolve 2020-08-21 16:50:23 +03:00
Mikhail Glukhikh
8e2c5bf4fe [FIR] Fix exposed visibility checking for enum entries 2020-08-21 16:50:22 +03:00
Mikhail Glukhikh
e15e87fded [FIR] Expand aliased type before checking for exposure 2020-08-21 16:50:22 +03:00
Denis Zharkov
cb6fbc329a FIR: Simplify FirQualifiedAccess hiearchy
Mostly, it's getting rid of FirQualifiedAccessWithoutCallee and FirModifiableQualifiedAccess
The latter was only used during FIR building to set explicit receiver
that might be done by replace call on explicit receiver

The problem with replaceExplicitReceiver is that for FirComponentCall
explicitReceiver should be not null, so it's needed to perform those tricks
at the generatot
2020-08-21 16:34:46 +03:00
Dmitriy Novozhilov
e6837a5b8c [FIR] Unify implementations of toSymbol and getSymbolByLookupTag 2020-08-21 15:28:34 +03:00
Dmitriy Novozhilov
d1f6e45b08 [FIR] Cleanup signature of getNestedClassifierScope 2020-08-21 15:27:55 +03:00
Dmitriy Novozhilov
ffdc68b68d [FIR] Get rid of AbstractFirSymbolProviderWithCache 2020-08-21 15:27:55 +03:00
Dmitriy Novozhilov
111b8c0169 [FIR] Cleanup caching symbol in ConeClassLikeLookupTagImpl
Type of `boundSymbol` replaced to OneElementWeakMap
`FirSymbolProvider.getSymbolByLookupTag` moved to extensions
2020-08-21 15:27:55 +03:00
Dmitriy Novozhilov
9032234e1d [FIR] Get rid of FirSymbolProvider.getNestedClassifierScope 2020-08-21 15:27:55 +03:00
Dmitriy Novozhilov
77f52a9ddb [FIR] Add special inline class for caches which are used in symbol providers 2020-08-21 15:27:55 +03:00
Dmitriy Novozhilov
4b6193159c [FIR] Get rid of JavaSymbolProvider.getJavaTopLevelClasses 2020-08-21 15:27:54 +03:00
Dmitriy Novozhilov
d7cfb2fb13 [FIR] Get rid of FirSymbolProvider.getClassNamesInPackage
There was one non-removable usage of those function in FirJavaElementFinder
  and three non-trivial implementation
- `FirProvider.SymbolProvider`
- `KotlinDeserializedJvmSymbolsProvider`
- `FirBuiltinSymbolProvider`

First implementation was moved to `FirProvider` and other two was
  deleted, because in FirJavaElementFinder we need lookup only in
  classes from source code, so such methods in library providers are
  useless

#KT-41048
2020-08-21 15:27:54 +03:00
Dmitriy Novozhilov
b31f80aee3 [FIR] Get rid of FirSymbolProvider.getAllCallableNamesInPackage
#KT-41048
2020-08-21 15:27:54 +03:00
Dmitriy Novozhilov
f32a0fe7ad [FIR-TEST] Unify AbstractFirLoadCompiledKotlin and BuiltInsDeserializationForFirTestCase 2020-08-21 15:27:54 +03:00
Dmitriy Novozhilov
913ea9b56d [FIR-TEST] Get rid of deprecated methods usage in AbstractFirLoadCompiledKotlin
Now complied declaration names are collected via ModuleDescriptor,
  so tests pass more correctly. Before this change tests didn't render
  compiled typealiases and properties.
Also some testdata was changed because of new order of declaration
2020-08-21 15:27:54 +03:00
Dmitriy Novozhilov
41aa90ad71 [FIR-TEST] Add flag to take memory dumps in modularized test 2020-08-21 15:27:54 +03:00
Dmitriy Novozhilov
cb0b25ea39 [FIR] Replace Deprecated with PrivateForInline in ScopeSession 2020-08-21 15:27:54 +03:00
Dmitriy Novozhilov
b4dc7955b4 [FIR] Avoid collections copying in FirSymbolProvider 2020-08-21 15:27:53 +03:00
Dmitriy Novozhilov
ce36ae64a1 [FIR] Deprecate questionable methods of FirSymbolProvider 2020-08-21 15:27:53 +03:00
Dmitriy Novozhilov
d5bb87cd1f [FIR] Replace inheritance with delegation for FirProvider and FirSymbolProvider 2020-08-21 15:27:53 +03:00
Dmitriy Novozhilov
ad9e41b828 [FIR] Mark JavaSymbolProvider.getJavaTopLevelClasses as @TestOnly 2020-08-21 15:27:53 +03:00
Dmitriy Novozhilov
1d26ce4a4e [FIR] Get rid of useless methods in FirSymbolProvider 2020-08-21 15:27:53 +03:00
Dmitriy Novozhilov
f0d05a321d [FIR-IDE] Use symbolProvider instead of firProvider in KtFirPackageScope 2020-08-21 15:27:53 +03:00
vldf
0d6b363179 [FIR] Refactoring for extended checkers 2020-08-21 15:09:05 +03:00
vldf
e2016499f3 [FIR] Fixed CFA bug 2020-08-21 15:08:37 +03:00
vldf
ac07438489 [FIR] Speed up CFA-checkers 2020-08-21 15:08:37 +03:00
vldf
638a0d3b82 [FIR] Checkers performance improvement and some refactoring 2020-08-21 15:08:36 +03:00
Kirill Shmakov
5a45cc7290 Update wizard tests 2020-08-21 13:06:56 +03:00
Denis Zharkov
cee72023fa Remove TypeSystemContext::mayBeTypeVariable optimization
It doesn't work now since anyway it's required to obtain type
constructor
At the same time, now it's not very expensive to obtain the constructor
since it's just a lookup tag
2020-08-21 12:50:33 +03:00
Denis Zharkov
9ac5dd2bce FIR: Use lookup tags for as type constructors instead of symbols
It may help to avoid redundant symbols lookups
2020-08-21 12:50:33 +03:00
Vladimir Ilmov
34b55dbeb3 (CoroutineDebugger) Disable agent for MPP projects
#KT-39412 fixed
2020-08-21 10:35:39 +02:00
Vladimir Dolzhenko
1e96088cc6 Check unique symbols in Goto*Tests 2020-08-21 10:04:36 +02:00
Dmitry Gridin
5f584691a6 [inspections] disable "Redundant inner modifier" inspection
^KT-41264 Fixed
2020-08-21 09:28:37 +07:00
Vladimir Dolzhenko
ec253862c6 Check unique symbols in Goto*Tests 2020-08-20 23:50:26 +02:00
Kirill Shmakov
62be688eb7 Wizard: add missing test dependency 2020-08-20 22:33:14 +03:00
Roman Artemev
e7f22bcfbc [JS IR] Add test for cross module export 2020-08-20 22:16:20 +03:00
Anton Bannykh
136d86e552 [JS IR] Fix cross-module import/export in case per-module splitting 2020-08-20 22:13:39 +03:00
Roman Artemev
8d61e9ba21 [KLIB] Load @JsExport annotated declarations explicitly 2020-08-20 22:13:39 +03:00
Roman Artemev
1a0e3a1d83 [KLIB] Refactor file serializer a bit
- Support explicitly exported on files and properties
2020-08-20 22:13:38 +03:00
Alexander Udalov
12e900ef3c Minor, do not capitalize words in generated Gradle options docs
To make this output correspond to the actual table at
https://github.com/JetBrains/kotlin-web-site/blob/master/pages/docs/reference/using-gradle.md
2020-08-20 20:30:55 +02:00
Alexander Udalov
0ef4b22cf3 Remove deprecated usages of ContainerUtil 2020-08-20 20:30:34 +02:00
Alexander Udalov
2428c180c2 Suppress warning on usage of old MPP in kotlin-stdlib 2020-08-20 20:30:34 +02:00
Alexander Udalov
da6d904c6e Suppress code warnings in kotlin-stdlib 2020-08-20 20:30:34 +02:00
Nikolay Krasko
5ef4f7df5a Mute more tests 2020-08-20 16:06:11 +03:00
Nikolay Krasko
44a95a4105 Stop running failed AndroidRunner tests 2020-08-20 16:06:11 +03:00
Nikolay Krasko
7f91ed6997 Support mute tests in kotlin-gradle-plugin-integration-tests (KTI-234)
#KTI-234 Fixed
2020-08-20 16:06:11 +03:00
Mikhail Glukhikh
07bddbe4d0 [FIR CLI] Don't run generation if some errors are found 2020-08-20 16:04:07 +03:00
Mikhail Glukhikh
85c1505689 [FIR2IR] Copy type parameters for trivial fake overrides 2020-08-20 16:04:02 +03:00
Alexander Udalov
bf0bb9e946 JVM IR: remove obsolete code for duplicate signature diagnostics 2020-08-20 14:58:36 +02:00
Alexander Udalov
425b192a5f Fix warnings in build-common/daemon code 2020-08-20 14:58:11 +02:00
Alexander Udalov
1d15a5547d Suppress deprecation warnings related to scripting 2020-08-20 14:58:11 +02:00
Alexander Udalov
549ee84687 Fix some compiler warnings in FIR modules 2020-08-20 14:57:54 +02:00
Mikhail Zarechenskiy
ced151f3af Add test for KT-41254
It was fixed along with #KT-41005
2020-08-20 15:45:32 +03:00
Mads Ager
a6f301e84a [JVM_IR] Rebase constructor stepping tests that are working as intended.
JVM_IR has consistent stepping behavior for secondary constructors
and init blocks. This change fixes the expectations for tests that
expect the less consistent JVM backend behavior.
2020-08-20 13:12:22 +02:00
Mads Ager
2c6b5c8847 [JVM_IR] Give temporary variable loads meaningful offsets.
Temporary variable loads in when expressions had the offsets
of the variable declaration. That leads to hacks during codegen
for line number generation.

Instead of those hacks, give the variable loads the offsets of
the context in which they occur. That avoids the codegen hacks
and fixes stepping behavior for more when expressions.
2020-08-20 13:12:22 +02:00
Sergey Igushkin
413d02621b Add a link to docs in MPP stability warning; add a flag that hides it 2020-08-20 10:44:59 +00:00
Mikhail Glukhikh
02e5f140f4 Fir2IrLazyProperty: generate overridden symbols via FirTypeScope 2020-08-20 11:47:35 +03:00
Mikhail Glukhikh
25efad2fd7 [FIR2IR] Extract generateOverriddenAccessorSymbols 2020-08-20 11:47:35 +03:00
Roman Golyshev
539d2bc01f FIR Completion: Fix completion with error type as receiver
- When type is error, the completion should not show anything; instead,
it was showing as if the explicit receiver was not there
2020-08-20 11:33:23 +03:00
Roman Golyshev
bca9754a7b FIR Completion: Move completion from available scopes to separate class 2020-08-20 11:33:23 +03:00
Denis Zharkov
7f3f0faa1a FIR: Rework overridden members processing in FirTypeScope
Now, FirTypeScope returns only direct overridden and a base scope
where a client might look for deeper overridden

It's necessary to make the API fast and simple
when only direct overridden are needed

At the same time, while this API looks a bit complicated for most of the clients
there are simple extension helpers that obtain just the direct or all overridden
2020-08-20 11:18:59 +03:00
Toshiaki Kameyama
8ce9b2d061 KT-34572 Convert to block body action improperly works with suppress annotations (#2969)
* Convert to block body: place @Suppress annotation before return expression

#KT-34572 Fixed

* Convert to block body: place annotations before return expression
2020-08-20 11:15:00 +03:00
Ilya Kirillov
9e0bb4ce8e FIR: save resolvePhase of declaration when creating it fake override copy 2020-08-20 11:07:09 +03:00
Ilya Kirillov
b1d3ab04c2 FIR [IDE]: provide correct node phase when necessary 2020-08-20 09:48:33 +03:00
Mads Ager
119302b016 [JVM_IR] Run KotlinSteppingTests with the JVM_IR backend.
Implement support for supressing failures by backend.
2020-08-20 05:48:54 +02:00
Nikolay Krasko
01f7da66c6 Mute ProjectTemplateNewWizardProjectImportTestGenerated.**.testMultiplatformApplication 2020-08-19 23:35:23 +03:00
Nikolay Krasko
9d18279ec9 Mute ReferenceResolveTestGenerated.DelegatedPropertyAccessors.InStandardLibrary.testNotNull 2020-08-19 23:01:09 +03:00
Nikolay Krasko
d87d42348b Mute flaky GotoWithMultipleLibrariesTest
Tests are flaky after e2a12602a3
2020-08-19 23:01:09 +03:00
Nikolay Krasko
179bd1cc3d Mute KotlinUastTypesTest.testEa101715 2020-08-19 23:01:09 +03:00
Nikolay Krasko
950b139804 Mute CreateFunction.Invoke.testLambdaArgument 2020-08-19 23:01:09 +03:00
Nikolay Krasko
496ede7587 Mute KotlinUastTypesTest.testEa101715 2020-08-19 23:01:08 +03:00
Nikolay Krasko
4135240cc0 Mute testFunctionBreakpointInStdlib in AS41 2020-08-19 23:01:08 +03:00
Nikolay Krasko
7982283007 Copy mutes for AS41 from 201 2020-08-19 23:01:08 +03:00
Nikolay Krasko
a3c8427cb2 Mute GradleScriptListenerTest tests 2020-08-19 23:01:08 +03:00
Nikolay Krasko
7de5368b4d Fix AbstractGradleBuildRootsLocatorTest tests 2020-08-19 23:01:08 +03:00
Nikolay Krasko
0b2fcd2c4d Remove mutes for navigation tests 2020-08-19 23:01:08 +03:00
Yunir Salimzyanov
ebe0489a74 Fix joined lines in .bunch 2020-08-19 19:51:51 +03:00
Yunir Salimzyanov
70cda1b113 Refactor and fix files previously affected by 192 patchset (KTI-315) 2020-08-19 19:40:02 +03:00
Yunir Salimzyanov
42da9e62db Cleanup 192 patchset files (KTI-315) 2020-08-19 19:40:02 +03:00
Yunir Salimzyanov
73aa21aab6 Refactor and fix files previously affected by as36 patchset (KTI-315) 2020-08-19 19:40:00 +03:00
Yunir Salimzyanov
27b2e16141 Cleanup as36 patchset files (KTI-315) 2020-08-19 19:40:00 +03:00
Ilya Chernikov
0a9089bc72 Set correct base classloader for REPL evaluation
the contributed partial fix of KT-35925 set it to the system classloader
which brought in many cases the compiler CP into the evaluation and lead
to the problems like KT-40898. This fix set it to the extension/platform
classloader, which preserves (partial) fix of the KT-35925 and do not
bring the compiler jar into the REPL evaluation classpath.

#KT-40898 fixed
2020-08-19 15:17:07 +02:00
Ilya Chernikov
f713e8ad36 Set context classloader before REPL evaluation
#KT-35925 fixed
2020-08-19 15:17:06 +02:00
Vladimir Dolzhenko
d0366d3bcb Failed test clean up
Relates to ^KT-40960
2020-08-19 15:06:53 +02:00
alexjuca
4794297640 used string template instead of concatenation 2020-08-19 13:58:58 +02:00
Kirill Shmakov
f88e492d11 Support hmpp in template
Explained in KMM-332
2020-08-19 14:46:49 +03:00
Toshiaki Kameyama
11044a3ab5 Surround with null check: fix incorrect check for 'in' expression
#KT-31749 Fixed
2020-08-19 14:37:24 +03:00
Toshiaki Kameyama
1188f4617a Change file's package to match directory: add space after package keyword if needed
#KT-39604 Fixed
2020-08-19 14:04:18 +03:00
Kirill Shmakov
1ce39222e3 Build KMM plugin for AS 4.2 2020-08-19 13:02:39 +03:00
Mikhail Zarechenskiy
6ed13ef1b6 Fix unresolved reference to catch parameter from lambda expression
#KT-41140 Fixed
2020-08-19 12:52:16 +03:00
Mikhail Zarechenskiy
f2fba8a469 Fix delegated property resolve when provideDelegate has this as argument
#KT-41135 Fixed
2020-08-19 12:52:16 +03:00
Toshiaki Kameyama
f3be3f449a Scope function conversion: do not suggest when invoked without receiver
#KT-35525 Fixed
2020-08-19 12:27:41 +03:00
Toshiaki Kameyama
8ba5548a0f "Eliminate argument of 'when'": do not suggest if 'when' is used as expression and it has no 'else' branch (#2898)
#KT-35526 Fixed
2020-08-19 12:24:58 +03:00
Toshiaki Kameyama
d965ad0a98 IfThenToSafeAccessInspection: do not report if condition is SENSELESS_COMPARISON/USELESS_IS_CHECK (#3007)
#KT-36051 Fixed
2020-08-19 12:22:10 +03:00
Toshiaki Kameyama
122bba9102 UnnecessaryVariableInspection: don't report for overriding property
#KT-39263 Fixed
2020-08-19 12:16:37 +03:00
Igor Yakovlev
c29dbee65e Cover move method refactoring with registry key (disabled by default) 2020-08-19 12:11:53 +03:00
aleksandrina-streltsova
ed67517fb9 Move: make minor refactorings and add GUI form for MoveKotlinMethodDialog 2020-08-19 12:11:53 +03:00
aleksandrina-streltsova
5515465760 Move: Support method moving 2020-08-19 12:11:53 +03:00
Alex Chmyr
a5368e443c KT-20421 fixing code generation for the case when "object" extends "class". It should look like: "object: class()". 2020-08-19 11:46:29 +03:00
Anton Yalyshev
26ca205f7e Fix a broken hyperlink to Whatsnew at the plugin change-notes 2020-08-19 11:41:13 +03:00
Ilya Kirillov
ccf285a284 FIR IDE: do not recreate analysis session for tests now 2020-08-19 11:35:42 +03:00
Ilya Kirillov
c191373a6b FIR IDE: always pass ValidityToken to KtAnalysisSessionComponent 2020-08-19 11:35:41 +03:00
Ilya Kirillov
2290d2fcc0 FIR IDE: make FirScopeRegistry belong to a KtFirScopeProvider 2020-08-19 11:35:40 +03:00
Roman Golyshev
7d58588f06 FIR IDE: Fix KtFirPropertySymbol::receiverType 2020-08-19 11:23:56 +03:00
Dmitry Petrov
8f0aecce58 JVM_IR: KT-40330 Unify field names for captured 'this' with JVM
NB some cases such as captured extension receiver for an extension
lambda are not supported yet; to be discussed, to what extent should we
actually follow JVM code shape here.
2020-08-19 11:07:41 +03:00
Dmitriy Dolovov
24bfc155af IDE perf tests for K/N: Use Gradle 6.6 2020-08-19 12:45:16 +07:00
Dmitriy Dolovov
6a95317f73 IDE perf tests for K/N: Switch to 1.4.0 2020-08-19 12:45:09 +07:00
Mikhail Glukhikh
f7cb165fb9 Introduce Fir2IrBuiltIns & move extension function type inside 2020-08-18 21:54:05 +03:00
Simon Ogorodnik
97b10b5ab3 [FIR2IR] Hack-in setting of extension function type annotation 2020-08-18 21:53:55 +03:00
Mikhail Glukhikh
b1c36feef4 Minor: regenerate FIR diagnostic tests 2020-08-18 21:53:35 +03:00
Jinseong Jeon
7e22de1e24 FIR2IR: insert coerce-to-unit expressions in statement containers 2020-08-18 21:53:08 +03:00
pyos
1b3ab53e16 FIR2IR: set superQualifierSymbol for setters too 2020-08-18 21:53:08 +03:00
Jinseong Jeon
e9659d9c8a FIR2IR: make the scope of body of do-while loop transparent 2020-08-18 21:53:07 +03:00
Jinseong Jeon
1b6c4329d2 FIR2IR: handle unbound reference with adapted arguments 2020-08-18 21:53:07 +03:00
vldf
a26eeb6ee8 [FIR] Add CLI flag for running extended checkers 2020-08-18 21:53:07 +03:00
vldf
2bf1d3fee8 [FIR] Add messages for extended checkers' warnings 2020-08-18 21:53:06 +03:00
Ilya Kirillov
08e2dd3dea NJ2K: fix implicit type cast in binary expressions
#KT-37298 fixed
2020-08-18 17:38:07 +03:00
Ilya Kirillov
d5d57f84e0 NJ2K: preserve annotations while converting class to object
#KT-38879 fixed
2020-08-18 17:38:07 +03:00
Ilya Kirillov
3d517c3656 NJ2K: fix retrieving resolutionFacade on empty context elements list 2020-08-18 17:38:07 +03:00
Ilya Kirillov
de0c216cfa NJ2K: fix NPE in JavaObjectEqualsToEqOperatorProcessing 2020-08-18 17:38:06 +03:00
Simon Ogorodnik
38477be484 [FIR] Make test fail if profiling requested, but misconfigured 2020-08-18 16:21:48 +03:00
Simon Ogorodnik
15d4333e81 [FIR] Add per-pass profiling support to modularized test 2020-08-18 16:21:48 +03:00
Simon Ogorodnik
83ded9badf [FIR] Add pass argument to beforePass of modularized test 2020-08-18 16:21:48 +03:00
Roman Artemev
716c3668d6 [IR] Properly resolve type parameters in case of property accessor
- fix KT-41006
2020-08-18 11:48:06 +03:00
Alexander Udalov
a810dbb41b IR: fix compiler warnings 2020-08-18 10:33:25 +02:00
Vladimir Dolzhenko
be53467bee Flaky and muted navigation tests clean up
Relates to #KT-40960
2020-08-18 08:23:02 +00:00
Vladimir Dolzhenko
e2a12602a3 Fixed getPsiMethodWrappers for KtLightMethodForDecompiledDeclaration
#KT-40960 Fixed
2020-08-18 08:23:01 +00:00
Vladimir Dolzhenko
ee0250bd35 Reformat file
Relates to #KT-40960
2020-08-18 08:23:00 +00:00
Vladimir Dolzhenko
5c7054a5ab Fixed src path for mock library
Relates to #KT-40960
2020-08-18 08:23:00 +00:00
Natalia Selezneva
7b80be5c9d Temporary workaround for gradle issue: wrong navigation for included plugin source code
https://github.com/gradle/gradle/issues/13783
^KT-39522
2020-08-17 23:12:51 +03:00
Alexander Udalov
7dd687cf00 IR: minor, use lazy instead of lazyVar for readonly value 2020-08-17 21:19:53 +02:00
Alexander Udalov
a21f273570 Fix compiler warnings in compiler code 2020-08-17 21:18:20 +02:00
Alexander Udalov
9b94e073af Fix warnings related to OptIn/UseExperimental 2020-08-17 21:18:19 +02:00
Alexander Udalov
256f4449ce IR: annotate obsolete API in IrPluginContext with ObsoleteDescriptorBasedAPI 2020-08-17 21:18:19 +02:00
Alexander Udalov
9961bd1fe1 IR: remove unneeded casts after making IrCall's symbol a simple function 2020-08-17 21:18:17 +02:00
Alexander Udalov
3bdbfc1e73 Output total codegen statistics after IR translation/generation 2020-08-17 19:29:58 +02:00
Alexander Udalov
c3cbcf6d7f Slightly improve performance measurements rendering
Report the input module name and size once before any measurements
instead of duplicating it in all of them. Also, render measurements in a
table to improve readability.

Before:

info: PERF: INIT: Compiler initialized in 467 ms
info: PERF: ANALYZE: 1 files (2 lines) target main-java-production in 277 ms - 7.220 loc/s
info: PERF: IR: Translation 1 files (2 lines) target main-java-production in 291 ms - 6.873 loc/s
info: PERF: GENERATE: 1 files (2 lines) target main-java-production in 513 ms - 3.899 loc/s
info: PERF: IR: Generation 1 files (2 lines) target main-java-production in 142 ms - 14.085 loc/s

After:

info: PERF: main-java-production, 1 files (2 lines)
info: PERF: INIT: Compiler initialized in 421 ms
info: PERF:         ANALYZE     342 ms       5.848 loc/s
info: PERF:  IR TRANSLATION     296 ms       6.757 loc/s
info: PERF:        GENERATE     453 ms       4.415 loc/s
info: PERF:   IR GENERATION     137 ms      14.599 loc/s
2020-08-17 19:29:57 +02:00
Simon Ogorodnik
0045b501d5 FIR IDE: Fix memory leak in thread locals 2020-08-17 20:05:52 +03:00
Ilya Kirillov
76b078b561 FIR IDE: resolve KtFirLocalVariableSymbol only to IMPLICIT_TYPES_BODY_RESOLVE 2020-08-17 20:05:52 +03:00
Ilya Kirillov
b8920114f8 FIR: set resolvePhase to BODY_RESOLVE in deserialized Kotlin declarations 2020-08-17 20:05:52 +03:00
Simon Ogorodnik
c7d6a79c25 FIR IDE: Fix completion in case of function with parameters 2020-08-17 20:05:52 +03:00
Nikolay Krasko
863de52f7a Minor: better name for file walking with excludes 2020-08-17 20:02:47 +03:00
Nikolay Krasko
c30910130e Remove minor optimization in CodeConformanceTest 2020-08-17 20:02:46 +03:00
Nikolay Krasko
01f3bdfc69 Exclude kotlin-ultimate/ide/common-cidr-native from author check 2020-08-17 20:02:46 +03:00
Nikolay Krasko
31ed803ada More excludes 2020-08-17 19:40:49 +03:00
Nikolay Krasko
713dbc225e Other repositories monitoring 2020-08-17 19:40:48 +03:00
Nikolay Krasko
fad15b6627 Rewrite testThirdPartyCopyrights test 2020-08-17 19:40:48 +03:00
Nikolay Krasko
bb0ea56d63 Extract traversing through directories to the common code 2020-08-17 19:40:48 +03:00
Nikolay Krasko
8db588c7f0 Optimize testNoBadSubstringsInProjectCode test
Don't visit ignored directories
2020-08-17 19:40:48 +03:00
Nikolay Krasko
2655d9dab3 Optimize testForgottenBunchDirectivesAndFiles test
Don't step through the ignored directories.
2020-08-17 19:40:48 +03:00
Nikolay Krasko
3eb89d6dfd Use own allow list for each repository 2020-08-17 19:40:48 +03:00
Nikolay Krasko
8445c8f4a5 Update copyright conformance excludes 2020-08-17 19:40:47 +03:00
Nikolay Krasko
04a1e572a8 Monitor new usages of kotlin-eap repository 2020-08-17 19:40:47 +03:00
Nikolay Krasko
d2bf5587d6 Monitor new usages of kotlin-dev repository 2020-08-17 19:40:47 +03:00
Nikolay Krasko
50d85b92da Remove more kotlin-dev usages 2020-08-17 19:40:47 +03:00
Nikolay Krasko
be2badc6ed Remove kotlin-dev from gradle migrate test 2020-08-17 19:40:47 +03:00
Nikolay Krasko
0c27e87eb9 Remove kotlin-dev from gradle configurator tests 2020-08-17 19:40:46 +03:00
Dmitriy Dolovov
3dc3c19c02 [Commonizer] Fix ImportAndCheckNavigation IT 2020-08-17 21:52:40 +07:00
Georgy Bronnikov
df8b819a55 JVM_IR: restore dumping for IrLowering phase 2020-08-17 15:57:12 +03:00
Ilya Goncharov
c70759673c [Gradle, JS] Update npm versions
^KT-41125 fixed
2020-08-17 15:22:30 +03:00
Steven Schäfer
6100166185 JVM IR: Fix special bridge generation with external Kotlin dependencies 2020-08-17 13:42:32 +02:00
Ilya Kirillov
730e07c52a Wizard: fix ExpectedFileTest.kt 2020-08-17 12:22:38 +03:00
Toshiaki Kameyama
35459d2ca7 "Add not-null asserted (!!) call": add '!!' to receiver of function reference
#KT-37841 Fixed
2020-08-17 12:05:45 +03:00
Ilya Kirillov
5e5e19f482 FIR IDE: temporary disable AddFunctionReturnTypeIntention 2020-08-17 11:38:05 +03:00
Ilya Kirillov
b79deafbc7 FIR IDE: fix testdata 2020-08-17 11:38:04 +03:00
Ilya Kirillov
27c045d035 FIR IDE: move all all symbol markers to markers package 2020-08-17 11:38:02 +03:00
Ilya Kirillov
052e8e5069 FIR IDE: make a symbol hierarchy a sealed one 2020-08-17 11:38:01 +03:00
Ilya Kirillov
018dd673b3 FIR IDE: simplify containing declaration provider 2020-08-17 11:38:00 +03:00
Ilya Kirillov
37ac654444 FIR IDE: rework high level API
Make analysis session to always be a receiver parameter
2020-08-17 11:37:58 +03:00
Ilya Kirillov
cadf99ca1e FIR IDE: introduce containingDeclarationProvider for symbols 2020-08-17 11:37:57 +03:00
Ilya Kirillov
b5a4e4c409 FIR IDE: introduce applicable computation & -based inspection 2020-08-17 11:37:56 +03:00
Ilya Kirillov
c8ab0766c9 FIR IDE: Implement symbol restoring for member symbols 2020-08-17 11:37:55 +03:00
Ilya Kirillov
e4995175a4 FIR IDE: fix idea-frontend-fir testdata 2020-08-17 11:37:53 +03:00
Ilya Kirillov
5f20910c79 FIR IDE: always try to find symbol origin in overridden symbols 2020-08-17 11:37:52 +03:00
Ilya Kirillov
a700d1fccb FIR IDE: resolve kt symbols only to the phase they actually need 2020-08-17 11:37:51 +03:00
Dmitriy Dolovov
75be9cf31f [Commonizer] Tests on rewriting callables names to succeed commonization
^KT-34602
2020-08-17 09:31:28 +07:00
Dmitriy Dolovov
de0b6e06cf [Commonizer] Keep parameters names hash in approximation keys for ObjC callables
^KT-34602
2020-08-17 09:31:21 +07:00
Dmitriy Dolovov
3b901a28d5 [Commonizer] More compact approximation keys
^KT-34602
2020-08-17 09:31:12 +07:00
Dmitriy Dolovov
4418dc85ca [Commonizer] Allow rewriting callables names to succeed commonization
^KT-34602
2020-08-17 09:31:03 +07:00
Dmitriy Dolovov
8904f5652b [Commonizer] Allow extended lookup for classifiers in test mode
Only for commonizer tests!

Allow to look up classifiers from the standard Kotlin packages (kotlin, kotlinx)
both in the default built-ins module and in test data sources. This is necessary
to write tests that refer to C-interop classifiers that are not available without
Kotlin/Native distribution.

^KT-34602
2020-08-17 09:30:57 +07:00
Dmitriy Dolovov
3b398ed57f [Commonizer] Small clean-up in IllegalCommonizerStateException 2020-08-17 09:30:47 +07:00
Dmitriy Dolovov
494fb39399 [Commonizer] CLI: Report duration even if it's 0ms long 2020-08-17 09:30:42 +07:00
Dmitriy Dolovov
9ef727747b [Commonizer] Use Array instead of List in AbstractListCommonizer 2020-08-17 09:30:36 +07:00
Igor Chevdar
e468a347b5 [box-tests] Tests on field init optimization
Added tests on all primitive types and a test when the field's type is an inline class
2020-08-15 12:16:33 +05:00
Steven Schäfer
0328fcaf5d JVM IR: Avoid IMPLICIT_NOTNULL checks on special bridge methods
...with dynamic type checks, except for the `@PlatformDependent`
methods, for which the JVM backend adds null checks.
2020-08-14 21:59:33 +02:00
Steven Schäfer
9026f89ba5 JVM IR: Avoid CHECKCASTs on type operators (KT-39520)
The type information coming from Java or Kotlin generics may be wrong
due to type erasure and a CHECKCAST instruction could throw an
exception.
2020-08-14 21:58:47 +02:00
Alexander Udalov
469b164555 IR: minor optimizations to IR validation 2020-08-14 21:55:37 +02:00
Alexander Udalov
7468518f35 JVM IR: minor, optimize forceSingleValueParameterBoxing
In JVM IR, both `valueParameters` and `isFromJavaOrBuiltins` take
noticeable time (1% of all compilation) because the logic for these in
IrBasedDescriptors is not trivial.
2020-08-14 21:55:37 +02:00
Alexander Udalov
35cace2540 JVM IR: collect potentialBridgeTargets in a list, then create bridges for all of them
This takes BridgeLowering time percentage from 1.3% to 1.0% of all
compiler time on a sample project, perhaps due to better data locality.
In addition, it simplifies stack traces by effectively merging all
bridge generation call sites into one, helping in future performance
investigations.
2020-08-14 21:55:37 +02:00
Alexander Udalov
9607414cf1 IR: make allOverridden return Set instead of Sequence, move to IrUtils
This doesn't hurt performance, but improves stack traces, in particular
in JVM's BridgeLowering.
2020-08-14 21:55:37 +02:00
Alexander Udalov
adcfbdec24 JVM IR: optimize special method / signature computation in BridgeLowering
First of all, put method signature caches of BridgeLowering into
JvmBackendContext. Since method hierarchies can span several files, and
a new instance of BridgeLowering is created to lower each file, keeping
them cached for the whole module makes BridgeLowering faster.

Also, do not attempt to compute special bridges if the method is
irrelevant, which can be deduced by its name. With this optimization,
the special method cache is no longer needed.

This brings BridgeLowering time from 3.8% down to 1.5% of all compiler
time on a sample project.
2020-08-14 21:55:37 +02:00
Alexander Udalov
0727e9055b JVM IR: use a simpler way to check if class is local 2020-08-14 21:55:37 +02:00
Alexander Udalov
6db5ad7310 IR: remove cast to IrStatement in IrDeclarationBase.transform
Default implementation of `IrStatement.transform` contained a cast to
`IrStatement`. Since almost all IR elements inherit from IrStatement,
this implementation was used in many subclasses. However, checkcast to
interface is slow and this place was indeed noticeable in the profiler
snapshot. Since not that many places really expected to get IrStatement
out of IrStatement.transform, introduce a new method
`transformStatement` that does this cast, and use it in all those
places. Meanwhile, most implementations will use the IrElement's
implementation of `transform` which merely invokes `accept` without
casts.
2020-08-14 21:55:37 +02:00
Alexander Udalov
fb8e39a621 IR: optimize transformation of declarations/statements lists in-place
Also, inherit IrDeclarationBase from IrElementBase to be able to use a
cast to IrElementBase, which is faster than a cast to IrElement or
IrDeclaration.
2020-08-14 21:55:36 +02:00
Alexander Udalov
4f0585950e IR: inline some transformChildren calls in IrElementTransformer{,Void}
IrElementTransformer.visitDeclaration/visitExpression are very prominent
hotspots, and it seems that HotSpot doesn't optimize the inlined Kotlin
bytecode there well enough. Reduce the bytecode in these and similar
methods by inlining calls to also/apply/transformChildrenVoid.
2020-08-14 21:55:36 +02:00
Nikolay Krasko
3a883e1236 Replace bintray bootstrap with space bootstrap repo 2020-08-14 17:31:13 +03:00
Nikolay Krasko
f484ceec80 Use GPG agent for signing in PublishedKotlinModule (KTI-314) 2020-08-14 17:31:13 +03:00
Nikolay Krasko
bbf8b12c65 Sign with GnuPG agent (KTI-314) 2020-08-14 17:31:13 +03:00
Nikolay Krasko
635ffcd53b Update maven signing for working with gpg 2 (KTI-314)
Update to maven-gpg-plugin 1.6 and add workaround for https://issues.apache.org/jira/browse/MGPG-59
2020-08-14 17:31:13 +03:00
Ilya Matveev
a121ec1e39 Update Kotlin/Native: 1.4.20-dev-16314 2020-08-14 09:41:47 +00:00
Roman Artemev
fa2c49a311 [Plugin API] Add extension point to contribute synthetic properties
- needs to fix KT_41006
2020-08-14 11:59:37 +03:00
Denis Zharkov
5ede37d6ab Report warnings on safe call + nullable extension operator
^KT-41034 In Progress
2020-08-14 11:12:34 +03:00
Roman Golyshev
852d22470e Revert "FIR Completion: Add idea-fir dependency to run completion tests"
This reverts commit 7d883f18
2020-08-13 23:12:34 +03:00
Toshiaki Kameyama
89cc5777ce Put parameters on line: don't suggest if parameters has end-of-line comments
#KT-35214 Fixed
2020-08-13 19:53:46 +03:00
Toshiaki Kameyama
efa981db36 "Create class from usage": add visibility to primary constructor if needed
#KT-29844 Fixed
2020-08-13 19:51:01 +03:00
Toshiaki Kameyama
b1e8238ea2 "Convert reference to lambda" intention: handle extension function reference with extension function call
#KT-35558 Fixed
2020-08-13 19:48:07 +03:00
Toshiaki Kameyama
9ff7539ff0 "Merge 'if's" intention: do not remove nested comments
#KT-33258 Fixed
#KT-39552 Fixed
2020-08-13 19:43:39 +03:00
Toshiaki Kameyama
f6e70cfed8 Wrap with let: fix it works correctly for invoking function type
#KT-39182 Fixed
2020-08-13 19:30:34 +03:00
Ilya Goncharov
babdeacdaf [Gradle, JS] Add resolution configuration method
^KT-41054 fixed
2020-08-13 18:04:44 +03:00
Ilya Goncharov
85f23d8c6e [Gradle, JS] Fix test with new API
^KT-41054 fixed
2020-08-13 18:04:44 +03:00
Ilya Goncharov
5eda8e95bf [Gradle, JS] Revert kotlinTargets
^KT-41054 fixed
2020-08-13 18:04:44 +03:00
Ilya Goncharov
855554ac38 [Gradle, JS] Move yarn resolutions from dependency constraints
^KT-41054 fixed
2020-08-13 18:04:43 +03:00
Ilya Goncharov
fecda8548b [Gradle, JS] Override maven and ivy publishing aware context
^KT-41054 fixed
2020-08-13 18:04:43 +03:00
Ilya Goncharov
58284c8b08 [Gradle, JS] Add yarn resolution gradle integration test
^KT-41054 fixed
2020-08-13 18:04:43 +03:00
Ilya Goncharov
9df604cb3d [Gradle, JS] Migrate on set for npm ranges
^KT-41054 fixed
2020-08-13 18:04:43 +03:00
Ilya Goncharov
1dd92f011c [Gradle, JS] Compare range lists as sets
^KT-41054 fixed
2020-08-13 18:04:43 +03:00
Ilya Goncharov
50ccb522b9 [Gradle, JS] Add intersect tests
^KT-41054 fixed
2020-08-13 18:04:43 +03:00
Ilya Goncharov
bd01ac52af [Gradle, JS] Add union test with fixed issue in union method
^KT-41054 fixed
2020-08-13 18:04:43 +03:00
Ilya Goncharov
7aaa1cf556 [Gradle, JS] Add invert test
^KT-41054 fixed
2020-08-13 18:04:42 +03:00
Ilya Goncharov
9b8a64ef7b [Gradle, JS] Add hasIntersection test
^KT-41054 fixed
2020-08-13 18:04:42 +03:00
Ilya Goncharov
814c0b73e3 [Gradle, JS] Add doc into NpmRange
^KT-41054 fixed
2020-08-13 18:04:42 +03:00
Ilya Goncharov
dc7d7135f8 [Gradle, JS] Add min start, max end, min end tests
^KT-41054 fixed
2020-08-13 18:04:42 +03:00
Ilya Goncharov
c25bcb4028 [Gradle, JS] Add max start test
^KT-41054 fixed
2020-08-13 18:04:42 +03:00
Ilya Goncharov
42090e4839 [Gradle, JS] Add failing test
^KT-41054 fixed
2020-08-13 18:04:42 +03:00
Ilya Goncharov
d4524e4050 [Gradle, JS] Small refactoring
^KT-41054 fixed
2020-08-13 18:04:42 +03:00
Ilya Goncharov
b95eb66032 [Gradle, JS] RejectAll => reject wildcard
^KT-41054 fixed
2020-08-13 18:04:41 +03:00
Ilya Goncharov
d4c0d62eeb [Gradle, JS] Require version use caret
^KT-41054 fixed
2020-08-13 18:04:41 +03:00
Ilya Goncharov
3ed42d394b [Gradle, JS] Support hyphenated range
^KT-41054 fixed
2020-08-13 18:04:41 +03:00
Ilya Goncharov
a4de85da13 [Gradle, JS] Right wildcard range
^KT-41054 fixed
2020-08-13 18:04:41 +03:00
Ilya Goncharov
f848b7cbeb [Gradle, JS] Right equals and hashCode for npm range
^KT-41054 fixed
2020-08-13 18:04:41 +03:00
Ilya Goncharov
68880e6f47 [Gradle, JS] NpmRangeVisitor without nulls
^KT-41054 fixed
2020-08-13 18:04:41 +03:00
Ilya Goncharov
7f3a2ac953 [Gradle, JS] Renames
^KT-41054 fixed
2020-08-13 18:04:41 +03:00
Ilya Goncharov
fec8c6c0ae [Gradle, JS] Min and max are not nullable
^KT-41054 fixed
2020-08-13 18:04:41 +03:00
Ilya Goncharov
966c9dae68 [Gradle, JS] Use not inverted visitor but straightforward visitor
^KT-41054 fixed
2020-08-13 18:04:40 +03:00
Ilya Goncharov
9bb49ac370 [Gradle, JS] Union of Npm Ranges
^KT-41054 fixed
2020-08-13 18:04:40 +03:00
Ilya Goncharov
14fac83e2b [Gradle, JS] Intersect of NpmRange
^KT-41054 fixed
2020-08-13 18:04:40 +03:00
Ilya Goncharov
90bee78dda [Gradle, JS] None range instead of none version
^KT-41054 fixed
2020-08-13 18:04:40 +03:00
Ilya Goncharov
f1b8c62231 [Gradle, JS] Use rejected versions
^KT-41054 fixed
2020-08-13 18:04:40 +03:00
Ilya Goncharov
d232e2ceb3 [Gradle, JS] Add ANTLR visitor for inverting of npm versions
^KT-41054 fixed
2020-08-13 18:04:40 +03:00
Ilya Goncharov
768b9a0340 [Gradle, JS] Use NpmVersionConstraint
^KT-41054 fixed
2020-08-13 18:04:40 +03:00
Ilya Goncharov
bb569f36b1 [Gradle, JS] Implement reason and other methods beside version
^KT-41054 fixed
2020-08-13 18:04:39 +03:00
Ilya Goncharov
30f78847b1 [Gradle, JS] Not publish npm dependency constraints in metadata
^KT-41054 fixed
2020-08-13 18:04:39 +03:00
Ilya Goncharov
0473648b0e [Gradle, JS] Use gradle dependency constraints for yarn resolutions
^KT-41054 fixed
2020-08-13 18:04:39 +03:00
Roman Golyshev
7d883f1806 FIR Completion: Add idea-fir dependency to run completion tests
- Without this dependency, FIR plugin completion tests fail because the
fir completion contributor is not available
2020-08-13 17:29:45 +03:00
Ilmir Usmanov
31e4ddafd1 Minor. Add test with boolean parameter 2020-08-13 15:52:53 +02:00
Ilmir Usmanov
bcbb050326 Use fields for spilled variables for lambda parameters as well
In other words, do not generate p$ fields if we can use L$ fields,
which are being cleaned up.
 #KT-16222 Fixed
2020-08-13 15:52:51 +02:00
Ilya Goncharov
f5ab3a445f [Gradle, JS] Fix abstract task on default
^KT-40865 fixed
2020-08-13 15:39:02 +03:00
Yunir Salimzyanov
9ecf416a8a Parse multiple buildTypeIds for one bunch and synchronize muted tests
Cause: split Ide plugin tests in 4 parts
2020-08-13 12:57:09 +03:00
Mikhail Zarechenskiy
aafe41cf7a Do not force coercion to Unit for nullable lambda return type
#KT-41005 Fixed
2020-08-13 10:40:51 +03:00
Vyacheslav Gerasimov
d9bac4d5e4 Build: Warn about empty directories in sources 2020-08-12 21:40:04 +03:00
Vyacheslav Gerasimov
27578e6056 Build: Upgrade gradle to 6.6 2020-08-12 20:24:12 +03:00
Roman Golyshev
166b6db764 Make keyword lookup objects correctly comparable
- This is done to fix the problem with duplicated keyword items in
CodeWithMe plugin (see https://youtrack.jetbrains.com/issue/CWM-438)
2020-08-12 14:41:59 +00:00
Georgy Bronnikov
18ae665d41 IR: make IrCall take IrSimpleFunctionSymbol 2020-08-12 16:31:31 +03:00
Toshiaki Kameyama
4901cdb11f ConvertCallChainIntoSequence: support functions added in Kotlin 1.4
#KT-40448 Fixed
2020-08-12 16:28:29 +03:00
Toshiaki Kameyama
5e91ffb156 Move to class body: don't suggest on data class
#KT-40558 Fixed
2020-08-12 16:10:33 +03:00
Nick
28700ed64c [FIR] Supertype and inheritance checkers group 2020-08-12 15:38:29 +03:00
Oleg Ivanov
252eb1ad23 [FIR] Fix typo in FirDataFlowAnalyzer 2020-08-12 15:00:54 +03:00
Anton Yalyshev
e3bbc54e85 Add change-notes for 1.4 2020-08-12 14:36:47 +03:00
Oleg Ivanov
21b8679799 [FIR] Add ReturnsImplies effect analyzer 2020-08-12 11:06:07 +03:00
Oleg Ivanov
3454ae7ca4 [FIR] Add VariableStorage and flow on nodes into CFG reference 2020-08-12 11:06:07 +03:00
Oleg Ivanov
15598b62c9 [FIR] Add replaceControlFlowGraphReference function for FirFunction 2020-08-12 11:06:07 +03:00
Oleg Ivanov
7da94cc299 [FIR] Fix wrong ConstantReference for returnsNotNull in EffectExtractor 2020-08-12 11:06:07 +03:00
Anton Yalyshev
f6f3787b51 Disable FUS for Code Completion in 1.4.20 2020-08-12 10:22:29 +03:00
Andrey Uskov
20371b874a Configuration caching - register listener only once per project
To many listeners cause performance issues in Gradle.
2020-08-12 00:40:18 +03:00
Georgy Bronnikov
d2fda2a07c Fir2Ir: bug fix 2020-08-12 00:31:33 +03:00
Ilmir Usmanov
8a098545e6 Minor. Add test 2020-08-11 22:10:51 +02:00
Ilmir Usmanov
00bf07fc41 Force boxing kotlin.Result return type of suspend functions
#KT-40843 Fixed
2020-08-11 22:10:47 +02:00
Ilmir Usmanov
b06218c456 Minor. Update test data 2020-08-11 20:27:00 +02:00
Georgy Bronnikov
f21d8a4c5b JVM_IR, minor: use vals instead of objects 2020-08-11 18:44:47 +03:00
Vladimir Dolzhenko
6e016ce041 ktFile has to return script declaration from stub as well 2020-08-11 14:31:18 +00:00
Oleg Ivanov
4367d6631f [FIR] Add CallsInPlace contract analyzer 2020-08-11 16:17:01 +03:00
Oleg Ivanov
cc9c5b9e3c [FIR] Add CFG nodes, add multiple subGraphs for CFGOwner 2020-08-11 16:17:01 +03:00
Oleg Ivanov
128075e780 [FIR] Add fir source saving in resolved contract description 2020-08-11 16:17:01 +03:00
Oleg Ivanov
f467dccc68 [FIR] Rename confusing variable in CFGTraverser 2020-08-11 16:17:00 +03:00
Alexander Udalov
bcf1ee3907 Minor, fix test data for kotlinx.serialization bytecode text test 2020-08-11 15:14:06 +02:00
Steven Schäfer
53fe30eb45 JVM IR: Don't produce CHECKCASTs on null constants (KT-36650) 2020-08-11 15:13:40 +02:00
Alexander Udalov
7503f134c2 IR: use IdSignature to compare classes in FqNameEqualityChecker
This is both simpler and a lot more performant.
2020-08-11 14:41:57 +02:00
Alexander Udalov
36a1a65d98 IR: make IrBranch/IrCatch/IrSpreadElement/IrModuleFragment/IrPackageFragment classes 2020-08-11 14:41:57 +02:00
Alexander Udalov
08a35f0674 IR: make IrBody and subtypes classes 2020-08-11 14:41:57 +02:00
Alexander Udalov
4351f5235b IR: make IrExpression and subtypes classes 2020-08-11 14:41:56 +02:00
Alexander Udalov
ba7ff36274 IR: make IrDeclarationReference and subtypes classes 2020-08-11 14:41:56 +02:00
Alexander Udalov
ee904a975a IR: make IrMemberAccessExpression and subtypes classes
Merge IrMemberAccessExpressionBase into IrMemberAccessExpression, and
IrCallWithIndexedArgumentsBase into IrFunctionAccessExpression (extract
the latter into a separate file).
2020-08-11 14:41:56 +02:00
Alexander Udalov
fde7314aaf IR: do not inherit IrExpressionWithCopy from IrExpression 2020-08-11 14:41:55 +02:00
Alexander Udalov
9aa7da44e2 IR: remove IrTerminalExpressionBase, Ir{Terminal,}DeclarationReferenceBase
Implement no-op acceptChildren/transformChildren in the base class
IrExpressionBase instead. This doesn't change behavior because all other
implementations of acceptChildren/transformChildren are not affected.
2020-08-11 14:41:55 +02:00
Alexander Udalov
868018f51f IR: do not inherit IrFunctionReferenceImpl from IrCallWithIndexedArgumentsBase 2020-08-11 14:41:55 +02:00
Alexander Udalov
e3dfd5fb49 IR: push down implementations of startOffset/endOffset/type/...
Do not store these as properties in IrElementBase, IrExpressionBase and
similar classes. This helps to reduce boilerplate in implementations
(just "override val" in the constructor, instead of taking a parameter
and passing it to the superclass), and also slightly optimizes memory in
cases where the value is trivial (UNDEFINED_OFFSET, 0, etc) and thus
does not need to be stored.
2020-08-11 14:41:54 +02:00
Roman Golyshev
03f804b1c5 FIR Completion: Move completion files to idea-fir module 2020-08-11 15:38:07 +03:00
Ilmir Usmanov
d861373c6d Hack attributes for continuation of suspend function in SAM-adapter 2020-08-11 11:58:20 +02:00
Mikhail Zarechenskiy
2e131b870a Add tests for obsolete issues
#KT-38804 Obsolete
 #KT-38801 Obsolete
 #KT-38835 Obsolete
 #KT-38737 Obsolete
 #KT-38664 Obsolete
 #KT-38549 Obsolete
 #KT-38766 Obsolete
 #KT-38714 Obsolete
2020-08-11 12:34:02 +03:00
Georgy Bronnikov
7f4df19dd1 JVM_IR: reorganize throw... functions in Symbols 2020-08-11 10:54:29 +03:00
Denis Zharkov
6a16d6a246 FIR: Simplify delegating constructors call resolution 2020-08-11 10:14:02 +03:00
Denis Zharkov
8b71f5e558 FIR: Do not leave cyclic upper bounds of type parameters 2020-08-11 10:14:02 +03:00
Denis Zharkov
a5a93d00a7 FIR: Rework delegation constructor calls resolution
Make it work independently of being called for inner class (as in FE 1.0)
2020-08-11 10:14:02 +03:00
Denis Zharkov
db93b9052b FIR: Fix incorrect optimization for integer literals 2020-08-11 10:14:02 +03:00
Vyacheslav Gerasimov
ad8709b2dc Build: Remove exclusion of kotlinx-coroutines-core in scripting-common
It breaks available-at feature used in MPP
2020-08-11 00:39:04 +03:00
Vladimir Dolzhenko
8540f47c15 Fixed FindUsages case on look up implementation getter/setters via property names
#KT-40788 Fixed
#KT-24616 Fixed

back-port from kotlin-ide commit aa5580bb5a7e96b209cdaa1c82f4e485ee001ae8
2020-08-10 22:04:06 +02:00
Mikhail Zarechenskiy
e49cdf0ca2 Prohibit using suspend functions as SAM in fun interfaces
#KT-40978 Fixed
2020-08-10 22:04:16 +03:00
Mikhael Bogdanov
607f99ed3c Don't generate implicit overrides delegating to Java defaults
#KT-40920 Fixed
2020-08-10 20:03:23 +02:00
Sergey Igushkin
07aee8831e Fix stdlib-by-default with non-compiled source sets (KT-40559)
When a `variantFilter { ... }` is used in Android projects, AGP does not
creates some variants but still creates the source sets which would be
related to those variants.

For source sets that are not included into any compilation, the stdlib
module added by default was kotlin-stdlib-common, and it was added to
the `api` scope.

But AGP checks the `androidTest*Api` configurations and
if it detects any dependencies in them, it reports deprecation warnings.

However, we have plans to prohibit unused source sets at all as they
have no reasonable use cases. So the fix is not to add the stdlib by
default to source sets that participate in no compilations.

Issue #KT-40559 Fixed
2020-08-10 20:08:22 +04:00
Roman Golyshev
6e2887e083 FIR Completion: Add insertion handling for functions with lambdas
- The support is not complete
2020-08-10 18:25:34 +03:00
Roman Golyshev
b3a674abee FIR IDE: Add parameter's and type's properties required for completion 2020-08-10 18:25:34 +03:00
Roman Golyshev
67ed33367f FIR Completion: Add function insert handler
- It is a specialized copy from `KotlinFunctionInsertHandler.Normal`
2020-08-10 18:25:34 +03:00
Roman Golyshev
b547feb00d FIR Completion: Render vararg modifier in lookups 2020-08-10 18:25:33 +03:00
Roman Golyshev
582b00f5b2 FIR Completion: Add UniqueLookupElement to the lookup elements
- It is done to differentiate overloads of the same function
2020-08-10 18:25:33 +03:00
Roman Golyshev
b6ee478190 FIR Completion: Add psi element to the lookups
- May be a performance problem later
2020-08-10 18:25:33 +03:00
Roman Golyshev
53180e707e FIR Completion: Fix invalid isAbstract condition 2020-08-10 18:25:33 +03:00
Roman Golyshev
ef461260b0 FIR Completion: Add simple insertion handler to lookup elements
- The `QuotedNamesAwareInsertionHandler` is just a copy of
`BaseDeclarationInsertHandler`
2020-08-10 18:25:33 +03:00
Roman Golyshev
10598ee98e FIR Completion: Add simple lookup decorating with icon and parameters 2020-08-10 18:25:32 +03:00
Roman Golyshev
64187b40c9 FIR Completion: Prevent immediate completion in number literals
- This is copied from the original KotlinCompletionContributor
2020-08-10 18:25:32 +03:00
Alexey Trilis
d86c14243e Add @SinceKotlin to kotlinx.browser and kotlinx.dom packages
Add @DeprecatedSinceKotlin to kotlin.browser and kotlin.dom packages
2020-08-10 18:08:19 +03:00
Dmitriy Novozhilov
0e53d11dd4 Disable AllowResultInReturnType feature
#KT-40843
2020-08-10 17:57:53 +03:00
Valeriy.Vyrva
30ff886754 Improve docs for createTempDir/createTempFile
#KT-35218
2020-08-10 17:29:25 +03:00
Vladimir Ilmov
4fe6880489 Cyrillic 'c' fix in inspectionLikeProcessings.kt 2020-08-10 14:42:46 +02:00
Nick
0a2f113a24 [FIR] Fix slow string conversions in FirEffectiveVisibilityResolver 2020-08-10 13:46:15 +03:00
Alexander Dudinsky
e67518c349 Update gradle plugin version in GradleFacetImportTest
Also drop legacy tests for 1_1_2
2020-08-10 13:14:01 +03:00
Pavel Kirpichenkov
f431da2a66 Reapply "Introduce @FrontendInternals annotation""
This reverts commit 9ca4717d11.
^KT-39643 Fixed
2020-08-10 12:22:55 +03:00
Yan Zhulanow
5e8e60a399 Move back the 'KotlinStructureViewElement.isPublic' property used externally
Reasoning: Method com.gmail.blueboxware.extsee.kotlin.ExtSeeKotlinStructureViewModel.Companion.PublicElementsFilter.isVisible(com.intellij.ide.util.treeView.smartTree.TreeElement treeNode) : boolean contains an *invokevirtual* instruction referencing an unresolved method org.jetbrains.kotlin.idea.structureView.KotlinStructureViewElement.isPublic()
2020-08-10 18:18:37 +09:00
Alexander Dudinsky
aec87744f2 Run ImportAndCheckNavigation tests only vs the master version of plugin
Also error "Could not find org.jetbrains.kotlin:kotlin-klib-commonizer-embeddable"
was fixed by adding ":native:kotlin-klib-commonizer-embeddable:install"
in dependencies for the kotlin-plugin install
2020-08-10 12:13:21 +03:00
Alexander Dudinsky
2042db598a Mute GradleNativeLibrariesInIDENamingTest.testLibrariesNaming in 192, 193
After updating version of gradle-plugin this tests started to fail on
the old version of IDE. After discussion we decided just mute it in
the old bunches
2020-08-10 12:04:51 +03:00
Sergey Igushkin
988480d649 Fix source JARs missing in Kotlin/Native targets with HMPP (KT-39051)
With HMPP, a separate implementation of `kotlinComponents` is used which
accidentally ignored the parent's logic for source artifacts.

As a simple fix, copy the parent's logic for source artifacts.

Issue #KT-39051 Fixed
2020-08-10 13:02:17 +04:00
Nataliya Valtman
a766369e72 KT-33908 Make Kotlin Gradle plugin compatible with configuration cache
#KT-33908 Fixed
2020-08-10 11:17:30 +03:00
Georgy Bronnikov
ea57b4cccb IR: add and unmute tests 2020-08-10 10:16:24 +03:00
Georgy Bronnikov
85ba170217 JVM_IR: use IrBasedDescriptors across codegen 2020-08-10 10:16:23 +03:00
Georgy Bronnikov
0b4c43083d IR: add IrBasedDescriptors 2020-08-10 10:16:23 +03:00
Georgy Bronnikov
dafcdc527d IR: propagate original declaration info via attributeOwnerId
For IrProperty, IrSimpleFunction we need to pass information about
original declaration to JVM_IR codegen. Instead of descriptors, use
the attributeOwnerId field.
2020-08-10 10:16:23 +03:00
Georgy Bronnikov
04d93dfbce IR: move containerSource from descriptor to IrFunction, IrProperty 2020-08-10 10:16:23 +03:00
Nick
4669e019d1 [FIR] Add diagnostic CONFLICTING_OVERLOADS & REDECLARATION 2020-08-10 10:09:37 +03:00
kvirolainen
36984009e9 Add samples for flatten, unzip functions 2020-08-10 03:40:13 +03:00
Elijah Verdoorn
41d5615608 Add samples for mapNotNull, find, getOrNull functions 2020-08-10 03:39:49 +03:00
Ilya Kirillov
62df2b3195 FIR IDE: run SUPER_TYPES & BODY_RESOLVE phases under global lock 2020-08-09 12:05:20 +03:00
Ilya Kirillov
7fb408ecd7 FIR IDE: enable new project wizard to FIR IDE 2020-08-09 12:05:13 +03:00
Ilya Kirillov
db7119f04d FIR IDE: fix ability to create new Kotlin files 2020-08-09 12:05:11 +03:00
Ilya Kirillov
054d196ec5 FIR IDE: temporary ignore failing tests 2020-08-09 12:05:02 +03:00
Ilya Kirillov
683ec2beff FIR IDE: make KtScopeProvider thread local 2020-08-09 12:04:53 +03:00
Ilya Kirillov
f62204fff1 FIR: move getCallableNames/getClassifierNames from scope to FirContainingNamesAwareScope 2020-08-09 12:04:52 +03:00
Ilya Kirillov
36a161080f FIR IDE: introduce KtType rendering 2020-08-09 12:04:44 +03:00
Ilya Kirillov
9f33d0147c FIR IDE: add info about nullability to KtType 2020-08-09 12:04:43 +03:00
Ilya Kirillov
16d22ae7e3 FIR IDE: correctly build FIR for qualified expressions 2020-08-09 12:04:43 +03:00
Ilya Kirillov
66f6fe18d6 FIR IDE: replace javax threadsafe annotations with custom ones
javax.annotation.concurrent may not be present for some JDKs
2020-08-09 12:04:35 +03:00
Ilya Kirillov
4595ee2cc0 FIR IDE: create read only copy of symbol builder only for completion 2020-08-09 12:04:34 +03:00
Ilya Kirillov
ccf232eaab FIR IDE: forbid analysis session to be stored in a variable 2020-08-09 12:04:34 +03:00
Ilya Kirillov
b41a5f9f34 FIR: make TypeRegistry thread safe 2020-08-09 12:04:26 +03:00
Ilya Kirillov
5f424ed1ec FIR IDE: rewrite low level API
- Cache ModuleResolveState for module till the world changes
- Resolve every file under a lock
- All creation of raw fir files and resolve of them happens in FirFileBuilder
- Lazy resolve of fir elements happens in FirElementBuilder

Caching works like the following:
- FirModuleResolveState holds PsiToFirCache & DiagnosticsCollector & FileCacheForModuleProvider
- FileCacheForModuleProvider holds a mapping from ModuleInfo to ModuleFileCache
- ModuleFileCache caches
    - KtFile -> FirFile mapping
    - ClassId -> FirClassLikeDeclaration, CallableId -> FirCallableSymbol
        which used in corresponding FirProvider
    - mapping from declaration to it's file
        which used in corresponding FirProvider
    - locks for fir file resolving
- PsiToFirCache provides mapping from KtElement to  FirElement
- DiagnosticsCollector collects diagnostics for file and caches them
2020-08-09 12:04:11 +03:00
Ilya Kirillov
1957be8757 FIR IDE: fix testdata of tests which now pass 2020-08-09 12:04:03 +03:00
Ilya Kirillov
34aa848b15 FIR: do not allow getting PSI text in RawFirBuilder in stub mode 2020-08-09 12:04:03 +03:00
Ilya Kirillov
cfc46b0cc8 FIR IDE: introduce FirIdeAllSourceDependenciesSymbolProvider
Co-authored-by: Simon Ogorodnik <simon.ogorodnik@jetbrains.com>
2020-08-09 12:03:56 +03:00
Ilya Kirillov
7d8ef5c7a2 FIR IDE: introduce KtFirConstructorDelegationReference 2020-08-09 12:03:54 +03:00
Ilya Kirillov
0870ded054 FIR IDE: introduce KtFirArrayAccessReference 2020-08-09 12:03:47 +03:00
Ilya Kirillov
22054c8507 FIR IDE: use non-fake override fir elements when finding psi for fir 2020-08-09 12:03:40 +03:00
Ilya Kirillov
d10e3f91fa FIR IDE: store FirScope strong references only in KtFirAnalysisSession 2020-08-09 12:03:33 +03:00
Ilya Kirillov
7033be588c FIR IDE: regenerate member scope test 2020-08-09 12:03:27 +03:00
Ilya Kirillov
ea3b2d8310 KT IDE: fix fully-qualified type resolving 2020-08-09 12:03:26 +03:00
Ilya Kirillov
50951fdfc3 KT IDE: use proper package symbol PSI to fix invalidated access exception 2020-08-09 12:03:14 +03:00
Ilya Kirillov
9f9ce6ba61 Fix compilation of KtFirDelegatingScope 2020-08-09 12:03:07 +03:00
Ilya Kirillov
1c195ea2bb FIR IDE: add kdoc for KtAnalysisSession 2020-08-09 12:03:07 +03:00
Ilya Kirillov
b8caefa0c4 FIR IDE: always recreate analysis session in tests to avoid breaking its contract 2020-08-09 12:03:06 +03:00
Ilya Kirillov
19efd19c6c FIR IDE: fix AbstractSymbolByFqNameTest after rebase 2020-08-09 12:03:01 +03:00
Ilya Kirillov
94b62e2ac6 FIR IDE: make context-dependent analysis session to use original cache on read-only mode 2020-08-09 12:03:00 +03:00
Ilya Kirillov
c0f5c90231 FIR IDE: separate ValidityOwner to ValidityTokenOwner & ValidityToken 2020-08-09 12:02:49 +03:00
Ilya Kirillov
6a6580dd97 FIR IDE: introduce KtConstructorSymbol.ownerClassId
Will be needed for completion
2020-08-09 12:02:48 +03:00
Ilya Kirillov
4653cdf794 FIR IDE: make KtFirDelegatingScope caching a thread safe 2020-08-09 12:02:42 +03:00
Roman Golyshev
ebf20c9706 Add multi-file tests for primitive completion
- This is required to test/debug correct completion from imports
2020-08-09 12:02:40 +03:00
Roman Golyshev
1b3a1a662f Add simple completion of class-like symbols 2020-08-09 12:02:34 +03:00
Roman Golyshev
20c627ea47 Implement collecting class-like names in KtFirStarImportingScope 2020-08-09 12:02:28 +03:00
Roman Golyshev
29ee233bb9 Remove repeating scopes collected by buildCompletionContextForFunction
- This is certainly a bug, we would have to fix it later
2020-08-09 12:02:27 +03:00
Roman Golyshev
e3778d62e3 Simplify canBeCalledWith function 2020-08-09 12:02:21 +03:00
Roman Golyshev
b90503decb Move PackageIndexHelper to KtFirStarImportingScope.kt 2020-08-09 12:02:16 +03:00
Roman Golyshev
d2fbd8e338 Remove KotlinFirCompletionProvider
- We should strive to use only high-level API for completion from now on
2020-08-09 12:02:16 +03:00
Ilya Kirillov
dee58e1d86 FIR IDE: handle importing scopes in completion in HL API
Co-authored-by: Roman Golyshev <roman.golyshev@jetbrains.com>
2020-08-09 12:02:11 +03:00
Ilya Kirillov
7aa26944d7 FIR IDE: rename utils.kt to psiUtils.kt
Co-authored-by: Roman Golyshev <roman.golyshev@jetbrains.com>
2020-08-09 12:02:00 +03:00
Ilya Kirillov
902b42ae1d FIR IDE: fix typo in completion testdata
Co-authored-by: Roman Golyshev <roman.golyshev@jetbrains.com>
2020-08-09 12:01:59 +03:00
Roman Golyshev
c3a3ab9e89 Implement the completion using high-level API only
- The indecies are not yet used

Co-authored-by: Ilya Kirillov <ilya.kirillov@jetbrains.com>
2020-08-09 12:01:59 +03:00
Roman Golyshev
a6dd84a7e4 FIR IDE: Modify KtFirAnalysisSession for completion
- This is WIP solution for having a specialized `KtFirAnalysisSession`
for the completion

Co-authored-by: Ilya Kirillov <ilya.kirillov@jetbrains.com>
2020-08-09 12:01:54 +03:00
Roman Golyshev
54946a793a Fix FirCompletionContext for safe access elements
- `towerDataContextForStatement` may contain safe access (?.) fir
elements as keys; however, `state.getCachedMapping(current)` would
never return those since they are considered as sugar fir elements

Co-authored-by: Ilya Kirillov <ilya.kirillov@jetbrains.com>
2020-08-09 12:01:49 +03:00
Roman Golyshev
a2cf01162e Fix bug with member extensions with explicit receiver
Co-authored-by: Ilya Kirillov <ilya.kirillov@jetbrains.com>
2020-08-09 12:01:48 +03:00
Roman Golyshev
df03e31b86 FIR IDE: Add KtCallableSymbol abstraction
- It should incapsulate callable symbols like functions, properties
and constructors

Co-authored-by: Ilya Kirillov <ilya.kirillov@jetbrains.com>
2020-08-09 12:01:44 +03:00
Roman Golyshev
a4a2d92c08 FIR IDE: Make KtFirReference implement KtSymbolBasedReference
Co-authored-by: Ilya Kirillov <ilya.kirillov@jetbrains.com>
2020-08-09 12:01:35 +03:00
Roman Golyshev
2eb439899e Use index to get symbols from importing scopes 2020-08-09 12:01:25 +03:00
Dmitriy Novozhilov
cefecdef25 fixup! Iterate on symbols, not on scopes 2020-08-09 12:01:23 +03:00
Roman Golyshev
e7f5594ffe Use more correct check for the constructor symbol
- add test for extension function receiver
2020-08-09 12:01:23 +03:00
Roman Golyshev
a3da1ea1a0 Iterate on symbols, not on scopes
- This way it is easier to get the correct results
2020-08-09 12:01:15 +03:00
Roman Golyshev
708c54f4d2 Refactor the collecting of callable symbols from scopes 2020-08-09 12:01:07 +03:00
Roman Golyshev
81f60bf252 Add test for smartcast 2020-08-09 12:01:07 +03:00
Roman Golyshev
ffb907150a Use information about receivers in completion
- Found few problems during resolving a single functon; disabled
assertions and marked them with TODO
- Add simple completion tests to simplify development
2020-08-09 12:01:00 +03:00
Roman Golyshev
0f5fc1fa99 Add FirSymbolProvider::getAllCallableNamesInPackage function
- Also, fix implementation of `getCallableNames` in few cases
2020-08-09 12:00:59 +03:00
Denis Zharkov
97d4918ed3 Expose local scopes to use in completion 2020-08-09 12:00:52 +03:00
Roman Golyshev
6129f4bcef Partial raw FIR building 2020-08-09 12:00:45 +03:00
Roman Golyshev
a1b621d987 Completion with FIR (prototype, work-in-progress) 2020-08-09 12:00:44 +03:00
Ilya Kirillov
2a495c1135 FIR IDE: introduce composite scopes 2020-08-09 12:00:38 +03:00
Ilya Kirillov
9092b33755 FIR IDE: Introduce module resolve state for completion 2020-08-09 12:00:31 +03:00
Ilya Kirillov
1d92fbaa7f FIR IDE: correctly set symbol origin for fake overridden ones 2020-08-09 12:00:24 +03:00
Ilya Kirillov
88548d988a FIR IDE: implement getCallableNames/getClassifierNames in more scopes 2020-08-09 12:00:18 +03:00
Ilya Kirillov
138f11ee27 FIR IDE: introduce member scope tests 2020-08-09 12:00:11 +03:00
Ilya Kirillov
f709e6acf3 FIR IDE: introduce scopes for HL API 2020-08-09 12:00:05 +03:00
Dmitriy Novozhilov
6596dc359b fixup! Completion with FIR (prototype, work-in-progress) 2020-08-09 12:00:04 +03:00
Ilya Kirillov
d62500531b FIR: add getClassifierNames for FirScope 2020-08-09 11:59:57 +03:00
Roman Golyshev
656086f90a Add FirScope::getCallableNames function 2020-08-09 11:59:50 +03:00
Ilya Kirillov
1f3add49f4 FIR IDE: move trailing comma related registry keys to ide-frontend-independent.xml 2020-08-09 11:59:49 +03:00
Ilya Kirillov
055b975699 FIR IDE: add tests which failing with exceptions inside FIR 2020-08-09 11:59:49 +03:00
Ilya Kirillov
9cf4fdfb71 FIR IDE: add reference info on reference resolve 2020-08-09 11:59:44 +03:00
Ilya Kirillov
5c6d636d02 Minor: reformat fir ide part of GenerateTests.kt 2020-08-09 11:59:38 +03:00
Ilya Kirillov
45e01a8b3d FIR IDE: precalculate DuplicatedFirSourceElementsException error message
It may be called from non-read action
2020-08-09 11:59:33 +03:00
Ilya Kirillov
964becf138 FIR IDE: allow the same entity to be accessed from different threads 2020-08-09 11:59:23 +03:00
Ilya Kirillov
4c08dfb238 Add invoke reference resolve test without errors in test data 2020-08-09 11:59:17 +03:00
Ilya Kirillov
15ecfd84b4 FIR IDE: cache KtAnalysisSession for modules 2020-08-09 11:59:15 +03:00
Ilya Kirillov
8c0197e081 FIR IDE: introduce KtAnalysisSessionProvider & helping functions for working with analysis session 2020-08-09 11:59:10 +03:00
Ilya Kirillov
acb8546583 FIR IDE: fix ReadOnlyWeakRef error message 2020-08-09 11:59:05 +03:00
Ilya Kirillov
b09358fe17 FIR IDE: rename KtFieldSymbol -> KtFirJavaFieldSymbol 2020-08-09 11:59:04 +03:00
Ilya Kirillov
f98ff2c25e FIR IDE: always pass resolve state as parameter when getting fir by psi 2020-08-09 11:59:04 +03:00
Mikhail Zarechenskiy
0c13a7f89a Fix accessibility check for experimental declarations from default scope
#KT-40919 Fixed
2020-08-07 17:49:15 +03:00
Ilmir Usmanov
b403b63f48 Ease field initialization check
Since there is already VAL_REASSIGNMENT diagnostics, we can safely only
for direct assignments.
 #KT-40893 Fixed
2020-08-07 14:22:18 +02:00
Nick
6c0abe7e48 [FIR] Fix CliTestGenerated$Jvm.testFirError 2020-08-07 13:27:29 +03:00
Pavel Kirpichenkov
9ca4717d11 Revert "Introduce @FrontendInternals annotation"
Revert due to Mobile IDE Trunk IJ TC configuration
This reverts commits:
ffc3d8bdfc
c0e713980b

^KT-39643 In Progress
2020-08-07 12:10:03 +03:00
Mads Ager
7f2efabe6a [JVM_IR]: Improve stepping for when.
Additionally, use the line number of the class for default interface
dispatch methods.
2020-08-07 09:16:01 +02:00
Dat Trieu
1009a240f2 KT-20357: Add samples for filter functions 2020-08-06 23:41:12 +03:00
Steven Schäfer
ca6e430e89 JVM IR: Handle nested classes in DelegatedPropertyOptimizer 2020-08-06 21:01:59 +02:00
Steven Schäfer
da9bff40f0 JVM IR: Don't remove stores to visible locals in DelegatedPropertyOptimizer 2020-08-06 21:01:59 +02:00
Ilya Kirillov
983c84d6a6 Wizard: fix default template compilation when using JS IR
#KT-39904 fixed
2020-08-06 21:46:50 +03:00
Alexander Udalov
e4cd7cdbcf IR: remove unused code, cleanup 2020-08-06 17:08:04 +02:00
Alexander Udalov
b30b2e0179 IR: minor, render duplicate IR node in checker 2020-08-06 17:08:04 +02:00
Alexander Udalov
8db1c3611b IR: introduce abstract class IrDeclarationBase
The main purpose of this class is to improve performance of IR visitors
and transformers. `IrElementVisitor.visitDeclaration` now takes
IrDeclarationBase as a parameter, and therefore the call to `accept`
there is now a virtual class call, instead of an interface call.
2020-08-06 17:08:04 +02:00
Alexander Udalov
771e7574f4 IR: make subtypes of IrDeclaration classes 2020-08-06 17:08:03 +02:00
Alexander Udalov
3cecf81176 IR: transform base classes of lazy IR to interfaces 2020-08-06 17:08:02 +02:00
Alexander Udalov
b02653a524 IR: remove base classes IrDeclarationBase and IrFunctionBase
They introduce a diamond class hierarchy which prevents IR element
hierarchy from being transformed to classes.
2020-08-06 16:46:26 +02:00
Alexander Udalov
9152df4702 PIR: transform base implementation classes to interfaces
Unfortunately this requires a lot of boilerplate, but is a requirement
for transforming the main IR element hierarchy interfaces
(IrDeclaration, IrClass, ...) to classes.
2020-08-06 16:46:26 +02:00
Ilya Goncharov
13766d5075 [Gradle, JS] Update test data
^KT-40884 fixed
2020-08-06 15:33:21 +03:00
Ilya Goncharov
52110a08d9 [Gradle, JS] Update versions
^KT-40884 fixed
2020-08-06 15:33:06 +03:00
Sergey Igushkin
f6356199d3 Fix typealias usage nullability and annotations lost in deserialization
Issue #KT-40824 Fixed
2020-08-06 15:46:54 +04:00
Alexander Dudinsky
4063aba677 Remade launch of NativeRunConfigurationTest against master version of gradle plugin 2020-08-06 14:06:05 +03:00
Konstantin Tskhovrebov
69ce6bd952 Add tests for setup native run gutters. 2020-08-06 14:06:04 +03:00
Sergey Igushkin
b5d4e4c44c Enable compatibility metadata variant by default in HMPP
This by default ensures that libraries published with HMPP are
compatible with non-HMPP consumers (which is the default in 1.4.0).
2020-08-06 14:08:51 +04:00
Mikhail Zarechenskiy
2eb17df962 Do not compute SamType too eagerly as it can force member resolution
Internally, during creation of `SamType` the compiler checks if a
 parameter is really can be used as a SAM, so this check involves
 lookup for abstract members, which can force additional computation of
 member scopes. This is totally fine for BE but it can be dangerous
 for light classes computation when not all scopes are processed.

 Note that this issue appeared quite recently after 16f175612e

 #KT-40869 Fixed
2020-08-06 09:20:56 +03:00
Vladimir Dolzhenko
6ec0e9546b Fix 192 compilation for UI for standalone gradle scripts
Relates to #KT-39790
2020-08-05 23:39:34 +02:00
Konstantin Tskhovrebov
66c1bd8c89 Revert "Update KMM plugin user texts."
This reverts commit 5edbc75d
2020-08-05 21:54:01 +03:00
Pavel Kirpichenkov
c0e713980b Add helpers for getting commonly used services without an opt-in
These services are LanguageVersionSettings, DataFlowValueFactory
#KT-39643 Fixed
2020-08-05 21:44:47 +03:00
Pavel Kirpichenkov
ffc3d8bdfc Introduce @FrontendInternals annotation
#KT-39643
2020-08-05 21:44:47 +03:00
Sergey Igushkin
eff5839369 "Kotlin Multiplatform Projects are an ~experimental~ Alpha feature." 2020-08-05 22:01:12 +04:00
Ilmir Usmanov
6c475e614a Minor. Update debugger tests 2020-08-05 19:47:55 +02:00
Ilmir Usmanov
68342a1f72 Initialize fake inliner variables on resume path
Otherwise, this will cause R8 to complain.
2020-08-05 19:47:55 +02:00
Ilmir Usmanov
bb5a99ec18 Do not put $completion to LVT if is dead 2020-08-05 19:47:54 +02:00
Florian Kistner
9925866293 203: Fix compilation 2020-08-05 19:36:43 +02:00
Florian Kistner
c792092410 Bump fastutil version to match 203 2020-08-05 19:36:42 +02:00
Nikita Bobko
c5398e8317 Move 'radixPrefix' from compiler modules to IDE modules
`radixPrefix` is used only in IDE now. So let's put it into IDE modules.

This commit is done in order to be able to use code dependent on
`radixPrefix` in `kotlin-ide` repo, because `kotlin-ide` depends on
1.4.0 artifacts of compiler. And `radixPrefix` isn't presented in
those artifacts
2020-08-05 20:17:17 +03:00
Sergey Igushkin
093d4b3108 Revert "Fix typealias usage nullability and annotations lost in deserialization"
This reverts commit 070848a1
2020-08-05 20:17:49 +04:00
Konstantin Tskhovrebov
5edbc75d7b Update KMM plugin user texts.
#Fixed KMM-324
2020-08-05 18:37:27 +03:00
Jinseong Jeon
b57794d96e IR util: IrExpression.isSafeToUseWithoutCopying 2020-08-05 17:07:27 +03:00
Jinseong Jeon
7ef1c74bbf FIR2IR: apply adapted reference conversion to coercion-to-unit 2020-08-05 17:07:27 +03:00
Mikhail Glukhikh
5f80bfd5d4 [FIR] Don't report UNINITIALIZED_VARIABLE on lateinit local variable 2020-08-05 16:47:51 +03:00
Natalia Selezneva
54d96a2dd7 UI for standalone gradle scripts
^KT-39790 Fixed
2020-08-05 15:22:22 +02:00
Mikhail Glukhikh
fc874e72b1 [FIR2IR] Initialize components a bit earlier to prevent lateinit errors 2020-08-05 12:11:34 +03:00
Mikhail Glukhikh
17b289fa00 [FIR] Code cleanup: get rid of FirClass.buildUseSiteMemberScope() 2020-08-05 12:11:34 +03:00
Mikhail Glukhikh
8bb5488a26 [FIR] look at intersectionOverride during override processing
This commit fixes some BB tests broken by previous commit
2020-08-05 12:11:34 +03:00
Mikhail Glukhikh
f1356a809e Fir2IrLazySimpleFunction: generate overridden symbols via FirTypeScope 2020-08-05 12:11:33 +03:00
Alexander Dudinsky
52c01abb83 Increase Xmx size after investigation OOM problem in KMM-316 2020-08-05 10:45:16 +03:00
Alexander Dudinsky
d012cd3272 Add kotlin-test-junit:install in dependencies for the kotlin-plugin install 2020-08-05 10:45:16 +03:00
Alexander Dudinsky
ea0099aa39 Fix testPlatformToCommonExpByInComposite.
In 9d362875da build started fail if mpp
or js targets not configured.
The test testPlatformToCommonExpByInComposite was fixed due it.
2020-08-05 10:45:16 +03:00
Alexander Dudinsky
05d6217f78 Changed gradle-plugin version in Gradle tests.
When 6.5.1 Gradle version was added, more tests have began to fail
because of legacy gradle-plugin versions (1.1., 1.2.) which are not
compatible with the new version of Gradle. This commit updates the used
version of the Gradle plugin to the latest stable (1.3.72) and makes it
configurable from tests.
2020-08-05 10:45:15 +03:00
Alexander Dudinsky
6652a7072c Fix testData due to KT-40551.
Starting from version 1.3.60, unnecessary dependencies with runtime
scopes have been added for modules jvmTest and jsTest. After updating
the plugin version in tests from 1.3.50 to 1.3.72 and master,
tests began to fail because of this. In order not to stop other checks
in tests, they were redone for the current behavior with unnecessary
dependencies.
After fixing bug KT-40551, the old behavior in tests will be returned.
2020-08-05 10:45:15 +03:00
Alexander Dudinsky
0298795b18 Add gradle.properties with kotlin.stdlib.default.dependency=false for tests
In the master version of plugin dependencies on stdlibs are enabled
by default. It is not expected for some tests.
Flag kotlin.stdlib.default.dependency=false fixed it.
2020-08-05 10:45:15 +03:00
Alexander Dudinsky
bc623e97ec Add Gradle version 6.5.1 for tests. 2020-08-05 10:45:15 +03:00
Alexander Dudinsky
1da05c54be Change gradle-plugin versions for tests from 1.3.50 to 1.3.72 2020-08-05 10:45:14 +03:00
Nick
f15f5bccc8 [FIR] Add more diagnostic messages 2020-08-05 10:41:06 +03:00
Victor Petukhov
f45de9d8fb NI: approximate not top-level captured types during code generation
^KT-40693 Fixed
2020-08-05 10:36:36 +03:00
Ilya Matveev
f6d7e7c52a CocoaPods: Fix setting custom framework name
The main scheme of a synthetic project generated for
pod import has the same name as the podspec generated
for the kotlin module (== Gradle project name). But
when starting an Xcode build, we specify the -scheme
argument to a framework name instead of project.name.

By default they are the same, but if a custom framework
name is specified, xcodebuild fails.

Issue #KT-40801 fixed
2020-08-05 06:46:53 +00:00
Mikhail Zarechenskiy
a45f73867a Add compatibility resolve when SAM conversion was applied partially
#KT-40646 Fixed
2020-08-05 00:03:33 +03:00
Sergey Igushkin
070848a1c1 Fix typealias usage nullability and annotations lost in deserialization
This fixes a regression introduced by the commit 4b0da0688a which made
deserializer expand typealiases but didn't take nullability and use site
annotations into account.

Issue #KT-40824 Fixed
2020-08-05 00:19:52 +04:00
Nick
ec4f04095c [FIR] Rearrange FirErrors.kt 2020-08-04 22:40:09 +03:00
Nick
207027b84c [FIR] Fix light tree's supertype FirDelegatedConstructorCall source 2020-08-04 22:37:43 +03:00
Nick
a59cedcd39 [FIR] Fix non-fake sources for constructor delegates 2020-08-04 22:37:42 +03:00
Nick
f74eb07203 [FIR] Fix incorrect diagnostic behaviour + several enum diagnostics 2020-08-04 22:28:49 +03:00
Nick
b76f757d47 [FIR] Add diagnostic for missing primary constructor 2020-08-04 22:28:49 +03:00
Nick
0f213e58db [FIR] Add diagnostic for primary constructor not called 2020-08-04 22:28:48 +03:00
Nick
bb0e1b7390 [FIR] Add diagnostic for constructor delegation cycles 2020-08-04 22:28:48 +03:00
Mikhail Glukhikh
e841b3a77b [FIR] Add diagnostic collection to KotlinToJVMBytecodeCompiler 2020-08-04 22:27:18 +03:00
Mikhail Glukhikh
9c3b8484b9 [FIR TEST] Add CLI test with should-be-error (not yet) 2020-08-04 22:27:18 +03:00
Ilmir Usmanov
824991a9dd Minor. Add tests. 2020-08-04 15:42:38 +02:00
Ilmir Usmanov
bbd4c21595 Cleanup spilled variables
#KT-16222
2020-08-04 15:42:37 +02:00
Ilmir Usmanov
999b41068b Minor. Refactor variables spilling
Split information collection and method node mutation.
2020-08-04 15:42:37 +02:00
Ilmir Usmanov
405c9743ef Do not spill dispatch receiver of suspend functions if it is not used
#KT-20571
2020-08-04 15:42:36 +02:00
Jinseong Jeon
5db7957230 FIR2IR: use type arguments from fully expanded type 2020-08-04 14:44:38 +03:00
Ilya Kirillov
606dc2f723 Fix binary compatibility problems in ImportInsertHelper & ShortenReferences 2020-08-04 12:46:13 +03:00
Victor Petukhov
af48f08f9c NI: take into account flexible types during capturing arguments from expression
^KT-40544 Fixed
2020-08-04 12:38:04 +03:00
vldf
65ebd02a39 [FIR] Fix for CanBeReplacedWithOperatorAssignment Checker 2020-08-04 11:20:42 +03:00
Mikhail Glukhikh
6f3df6faf4 [FIR] Regenerate extended checker tests 2020-08-04 09:35:36 +03:00
Mikhail Glukhikh
181a8bb79e [FIR TEST] Mute failing BB test with Byte/Short.and usage 2020-08-04 08:59:16 +03:00
Jinseong Jeon
47c47be3d3 FIR serializer: serialize annotations on FirTypeRef, not ConeKotlinType 2020-08-04 08:59:16 +03:00
Ivan Kylchik
0a28e5e031 Add argument unwrapping for case when argument is named 2020-08-04 08:59:15 +03:00
Mikhail Glukhikh
2e2099afae [FIR] Introduce NOT_AN_ANNOTATION_CLASS diagnostic 2020-08-04 08:59:15 +03:00
Mikhail Glukhikh
8fd087a964 [FIR] Don't report duplicated UNRESOLVED_REFERENCE on annotation entries 2020-08-04 08:59:15 +03:00
Mikhail Glukhikh
a6e811a67a [FIR] Add status to Java annotation constructor (fix after rebase) 2020-08-04 08:59:15 +03:00
Mikhail Glukhikh
8379b3794a [FIR2IR] Return fallback mode for annotation resolved placeholder 2020-08-04 08:59:15 +03:00
Dmitriy Novozhilov
b63257345b [FIR] Map Class to KClass in java annotations 2020-08-04 08:59:15 +03:00
Mikhail Glukhikh
282a295d43 [FIR] Enable arrayOf transformer in completion (inside annotations) 2020-08-04 08:59:14 +03:00
Dmitriy Novozhilov
721b9b4d8c [FIR] Resolve annotations as calls 2020-08-04 08:59:14 +03:00
Dmitriy Novozhilov
bc1fa8ed7f [FIR] Add constructor for java annotations 2020-08-04 08:59:14 +03:00
Dmitriy Novozhilov
644e9843f9 [FIR] Add initialization of calleeReference for FirAnnotationCall 2020-08-04 08:59:14 +03:00
Dmitriy Novozhilov
614291b2cc [FIR] Make FirAnnotationCall resolvable 2020-08-04 08:59:14 +03:00
Dmitriy Novozhilov
ffd30566be [FIR] Add FirErrorResolvedQualifier for qualifiers with resolve diagnostic 2020-08-04 08:59:14 +03:00
Dmitry Gridin
a5e9401a0a [configuration] change updater number to 1.4.* and 1.5.*
#KT-40639 Fixed
2020-08-04 11:13:30 +07:00
Julian Kotrba
88f508446a Make repeat example more expressive
This commit adds the zero-based index of current iteration from the passed HOF "action" of the repeat function to its associated code sample.

KT-20357
2020-08-04 00:48:06 +03:00
Ilya Gorbunov
a5178bb826 Minor: fix toJavaDuration docs 2020-08-04 00:34:15 +03:00
Ilya Gorbunov
99eb7f391b Fix doc wording around covariance/invariance 2020-08-04 00:33:05 +03:00
Roman Artemev
4f73e08704 [KLIB] Make fake override resolver garbage free as much as possible
- reduce memory pollution during FO resolve
2020-08-03 19:22:07 +03:00
Roman Artemev
876ee265f2 [KLIB] Fix memory leak in fake override resolver 2020-08-03 19:22:07 +03:00
Roman Artemev
e189cb1895 [KLIB] Fix memory leak in linker through haveSeen set 2020-08-03 19:22:06 +03:00
Roman Artemev
19b5fda750 [KLIB] Do not duplicate origin mapping per file 2020-08-03 19:22:06 +03:00
Roman Artemev
c253042948 [KLIB] Reduce amount of descriptors loaded during desc-idSig resolution 2020-08-03 19:22:06 +03:00
Roman Artemev
851c287105 [KLIB] Use SoftReference to hold proto memory
- fix metadata memory leak for KT-40345
2020-08-03 19:22:06 +03:00
Roman Artemev
add0ad6733 [KLIB] Change KLIB IO API
- Use ReadBuffer instead of native java buffer
 - Use Weak buffers for File IO
 - fix klib memory leak for KT-40345
2020-08-03 19:22:06 +03:00
Jinseong Jeon
0e54f98b79 FIR: support adapted callable reference with vararg 2020-08-03 16:37:36 +03:00
Mikhail Glukhikh
4332e95b8a [FIR] Don't transform setter parameter type if it's given explicitly 2020-08-03 16:37:30 +03:00
vldf
8813ebd950 [FIR] Add RedundantSetterParameterType Checker 2020-08-03 16:37:24 +03:00
vldf
a6c9d869fb [FIR] Move RedundantCallOfConversionMethod to extended checkers 2020-08-03 16:31:49 +03:00
vldf
3349739d1e [FIR] Fixes for RedundantReturnUnitType checker 2020-08-03 11:42:19 +03:00
vladislavf7@gmail.com
2384afdd93 [FIR] refactoring for running extended checkers 2020-08-03 11:42:19 +03:00
vldf
cfc09048c6 [FIR] Add RedundantCallOfConversionMethod checker 2020-08-03 10:41:19 +03:00
Mikhail Glukhikh
39d4b79324 [FIR TEST] Fix FE 1.0 / FIR test data for nested / local type alias case 2020-08-02 18:19:47 +03:00
Mikhail Glukhikh
7724d060ff [FIR] Don't compare SYNTAX diagnostics in light tree diagnostic test 2020-08-02 18:19:47 +03:00
Mikhail Glukhikh
4e4fe9f719 [FIR] Support some kinds of fake sources in light builder 2020-08-02 18:19:47 +03:00
Mikhail Glukhikh
951aa8185e [FIR] Avoid duplicate diagnostics on expression.typeRef 2020-08-02 18:19:47 +03:00
Mikhail Glukhikh
dc46d51d9a [FIR TEST] Update diagnostic spec test data 2020-08-02 18:19:47 +03:00
Mikhail Glukhikh
6eab6f2f87 [FIR TEST] Replace OTHER_ERROR with UNRESOLVED_REFERENCE in test data 2020-08-02 18:19:47 +03:00
Nick
c55cdf1935 [FIR] Fix missing ErrorTypeRef for QA and clean DiagnosticCollector 2020-08-02 18:19:46 +03:00
Nick
7086b0cbf3 [FIR] Don't report duplicated errors in component calls typeRefs 2020-08-02 18:19:46 +03:00
Nick
4ceae8dc5e [FIR] Don't report duplicated errors in function calls typeRefs 2020-08-02 18:19:46 +03:00
Nick
6f85a07290 [FIR] Don't report duplicated errors in property declarations 2020-08-02 18:19:46 +03:00
Nick
889324e972 [FIR] Ignore failing test, improve DiagnosticKind, fix UPPER_BOUND 2020-08-02 18:19:45 +03:00
Mikhail Glukhikh
9335e09149 [FIR] Don't report duplicated errors in implicit properties / parameters 2020-08-02 18:19:45 +03:00
Mikhail Glukhikh
ceaffb1e8b [FIR] Don't report duplicated errors in implicit primary constructors 2020-08-02 18:19:45 +03:00
Mikhail Glukhikh
749346b73b [FIR] Don't report duplicated errors on default accessor error type refs 2020-08-02 18:19:45 +03:00
Mikhail Glukhikh
e0d25876b0 [FIR] Don't report simple diagnostics on fake sources 2020-08-02 18:19:44 +03:00
Mikhail Glukhikh
551bdd267d [FIR] Introduce WRONG_NUMBER_OF_TYPE_ARGUMENTS diagnostic 2020-08-02 18:19:44 +03:00
Mikhail Glukhikh
0804c6a0f3 [FIR] Introduce TYPE_ARGUMENTS_NOT_ALLOWED & some other type errors
This commit introduces several different things, in particular:
- check type arguments in expressions
- new TypeArgumentList node to deal with diagnostic source
- ConeDiagnostic was moved to fir:cones
- ConeIntermediateDiagnostic to use in inference (?) without reporting
- detailed diagnostics on error type
2020-08-02 18:19:44 +03:00
Jinseong Jeon
c744dfba9c FIR: distinguish anonymous object as enum entry when scoping
so that `this` reference with the enum entry name as label can be
resolved
2020-08-02 18:06:15 +03:00
Jinseong Jeon
52631b7abd FIR2IR: make local storage track scopes, including anonymous init 2020-08-02 18:05:09 +03:00
Nick
26e3a111d6 [FIR] Add diagnostics for object related problems 2020-07-31 19:34:55 +03:00
Nick
694d3cad4e [FIR] Exposed visibility checker: optimize checks for local visibility 2020-07-31 19:28:10 +03:00
Nick
60462bea1c FirEffectiveVisibilityResolver: search parent in containingDeclarations
When determining effective visibility of 'something',
we use containing declarations from the context to find 'something'
parent, to avoid calling getClassSymbolByFqName for all cases.
2020-07-31 19:28:04 +03:00
Nick
7145caca40 [FIR] Refactor effective visibility calculation
Before this commit, we had effective visibility as a part of FIR status,
so it was integrated into the full pipeline. In this commit,
we introduced "effective visibility as a service" which is now used
only by exposed visibility checker. This allows us to make the thing
universal for all FIR nodes, including nodes for Java / deserialized.
2020-07-31 19:27:58 +03:00
Steven Schäfer
b15e32936e JVM IR: Optimize delegated properties (KT-36814) 2020-07-31 19:00:27 +03:00
vldf
8724efbe8a [FIR] Add empty range checker 2020-07-31 16:28:37 +03:00
vldf
b10defdbab [FIR] Add redundant single string expression template checker 2020-07-31 16:28:37 +03:00
vldf
95e0ba3d5c [FIR] Add ArrayEqualityOpCanBeReplacedWithEquals checker 2020-07-31 16:28:37 +03:00
Ilmir Usmanov
4d21a496fe Minor. Update tests 2020-07-31 14:33:52 +02:00
Dmitry Petrov
e11c90f26c JVM_IR: KT-40293 Box return type for DefaultImpls methods if required 2020-07-31 14:48:12 +03:00
Ilya Chernikov
034d5a948c Add JvmDefault to the new EP method for compatibility with older impls 2020-07-31 12:07:10 +02:00
Ilmir Usmanov
fa8c6deb18 Support restricted suspend lambdas in JVM_IR
#KT-40135 Fixed
2020-07-30 20:40:37 +02:00
Ilmir Usmanov
2c205410fa Check whether the field is indeed being initialized
in checkFieldInExactlyOnceLambdaInitialization
 #KT-40691 Fixed
2020-07-30 19:04:54 +02:00
Nikolay Krasko
d8b76f5b26 Register additional repository id 2020-07-30 19:33:58 +03:00
Vladimir Ilmov
7eca13569b (CoroutineDebugger) Enable agent for versions 1.3.8.*
Gradle artifact name gets changed from 'kotlinx-coroutines-core' to
'kotlinx-coroutines-core-jvm'. So it should support both.
2020-07-30 17:54:35 +02:00
Toshiaki Kameyama
c91858d470 Convert member to extension: do not suggest for delegated properties
#KT-35128 Fixed
2020-07-30 17:32:31 +03:00
Dmitry Petrov
46fccae7d1 PSI2IR: KT-40499 Fix delegated property desugaring
No type arguments were provided for property reference inside delegated
property accessors.
2020-07-30 13:18:36 +03:00
Jinseong Jeon
bff36e0199 FIR2IR: convert annotations on FirTypeRef 2020-07-30 11:25:36 +03:00
Georgy Bronnikov
4ca98041cd IR: update test data 2020-07-30 11:24:08 +03:00
Georgy Bronnikov
a27d63f58f JVM_IR: flexible nullability as annotation
We carry information about flexible nullability of IrType as an
annotation, so there is no need to look at its underlying KotlinType.
2020-07-30 11:24:07 +03:00
Georgy Bronnikov
a2e9521ad5 Make DescriptorlessExternalPackageFragmentSymbol public 2020-07-30 11:24:07 +03:00
Georgy Bronnikov
c2ead0303b IR: remove more descriptor usage 2020-07-30 11:24:07 +03:00
Alexander Gorshenev
9a717e9ecf Don't copy default value parameters for fake overrides 2020-07-29 22:15:10 +03:00
Mark Punzalan
2cfd776092 ForLoopsLowering: Assume step == 1 for *Range (e.g., IntRange) and
handle accordingly (e.g., do not read `step` property).
2020-07-29 20:44:51 +02:00
Dmitry Petrov
09e47fff7b Fix KotlinGradleIT.testCustomCompilerFile
Referencing org.jetbrains.annotations.{Nullable, NotNull} classes in
static initializer causes ClassNotFoundError in testCustomCompilerFile.
2020-07-29 20:33:17 +03:00
Dmitry Petrov
dae358c792 JVM: KT-40664 disable optimization for 'ULong in range of UInt' case 2020-07-29 20:33:17 +03:00
Dmitry Petrov
f2493d0950 JVM: KT-40665 more exact check for intrinsified range 'contains' 2020-07-29 20:33:17 +03:00
Roman Artemev
0559e192ee [JS IR] Support external delegation in case of JS in psi2ir
- fix FE delegation resolver
 - fix critical KT-40650
2020-07-29 19:57:05 +03:00
Nicolay Mitropolsky
c254651ed3 Uast: handling annotations on the property receiver (KT-40539) 2020-07-29 19:42:22 +03:00
Yaroslav Chernyshev
325ad56dcd Populate Kotlin source set roots with KotlinSourceRootTypes
By default Kotlin source root is populated with JavaSourceRootType and
changed during import only if real source folder exists.
Now Kotlin source roots has valid source type right after creation

#KT-37106 Fixed
2020-07-29 19:24:44 +03:00
Ilmir Usmanov
fec845365a Minor. No longer ignore obsolete PRE_RELEASE_CLASS diagnostic
in coroutine tests.
2020-07-29 17:52:01 +02:00
Simon Ogorodnik
ebfcd7e074 J2K: Improve presentation of conversions 2020-07-29 17:56:03 +03:00
Simon Ogorodnik
5c745facf4 J2K: Improve error message in case of incorrect detach 2020-07-29 17:56:02 +03:00
Simon Ogorodnik
dc963e4ff6 Improve J2K progress reporting 2020-07-29 17:56:02 +03:00
Simon Ogorodnik
8bcf1000f6 J2K: Fix java 9 try-with-resources 2020-07-29 17:56:02 +03:00
Simon Ogorodnik
c5005f8695 J2K: Speed-up add imports 2020-07-29 17:56:01 +03:00
Simon Ogorodnik
cd0c644654 J2K: Fix incorrect early detaching of elements in for conversion 2020-07-29 17:56:00 +03:00
Simon Ogorodnik
8c2dd876b5 J2K: Fix incorrect argument remapping when introducing defaults 2020-07-29 17:56:00 +03:00
Simon Ogorodnik
cd7ac55091 J2K: Show converted/total file counts 2020-07-29 17:55:59 +03:00
Simon Ogorodnik
468af0bb85 J2K: Fix type parameters in LHS of callable reference 2020-07-29 17:50:10 +03:00
Leonid Startsev
96d0b1c47a Update serialization runtime and fix test data
Revert "Mute/ignore 'PROVIDED_RUNTIME_TOO_LOW' in tests"
2020-07-29 14:20:33 +03:00
Nikolay Krasko
a6a22d1cde Revert "Populate Kotlin source set roots with KotlinSourceRootTypes"
This reverts commit e2634190
2020-07-29 12:05:42 +03:00
Yaroslav Chernyshev
e263419088 Populate Kotlin source set roots with KotlinSourceRootTypes
By default Kotlin source root is populated with JavaSourceRootType and
changed during import only if real source folder exists.
Now Kotlin source roots has valid source type right after creation

#KT-37106 Fixed
2020-07-29 10:26:42 +03:00
Ilmir Usmanov
4fb5f8603a Keep $continuation in LVT
in case of suspend functions and `this` is case of lambdas, since they
are used in async stack trace generation.
Update tests.
 #KT-40661 Open
2020-07-29 00:01:12 +02:00
Ilmir Usmanov
db40808186 Minor. Remove unused SourceFrames 2020-07-29 00:01:11 +02:00
Ilmir Usmanov
70e91bd5db Shrink and split LVT records of variables according to their liveness
Otherwise, debugger will show uninitialized values of dead variables
after resume.
 #KT-16222
 #KT-28016 Fixed
 #KT-20571 Fixed
2020-07-29 00:01:10 +02:00
Ilmir Usmanov
e5995f0c12 Update R8
Because old version throws assertion error if parameter's LVT record
does no span the whole function.
2020-07-29 00:01:10 +02:00
Ilmir Usmanov
60875f96b4 Do not take LVT into account when calculating liveness of variables 2020-07-29 00:01:09 +02:00
Alexander Udalov
687d13a320 IR: cleanup expression implementations
Remove unused constructors with descriptors, minimize usages of
secondary constructors and make some properties non-lateinit, fix some
inspections.
2020-07-28 20:05:58 +02:00
Alexander Udalov
e36d3ba4f6 IR: remove IrNoArgumentsCallableReferenceBase
To simplify transformation of IR element hierarchy to classes.
2020-07-28 20:05:57 +02:00
Dmitriy Novozhilov
f270cd8d6e [FIR] Update testdata due to lack of callee reference in FirResolvedQualifier 2020-07-28 20:47:07 +03:00
Dmitriy Novozhilov
f283f2db43 [FIR] Improve diagnostic reporting & don't use error symbol for candidate if possible
Also introduce few new diagnostics:
- NONE_APPLICABLE more many inapplicable candidates
- HIDDEN for visible candidates
2020-07-28 20:46:56 +03:00
anastasiia.spaseeva
5c0528b61e [Spec tests] Add tests for primary constructors declaration 2020-07-28 20:26:33 +03:00
anastasiia.spaseeva
0488dc985f [Spec tests] Add tests for intersection and OR 2020-07-28 20:26:32 +03:00
anastasiia.spaseeva
46774fb6d6 [Spec tests] Add call without an explicit receiver tests for top-level non-extension functions 2020-07-28 20:26:32 +03:00
anastasiia.spaseeva
bef59055cd [Spec tests] Fix test cases structure 2020-07-28 20:26:31 +03:00
anastasiia.spaseeva
4ad3847224 [Spec tests] Add tests for subtyping rules for simple classifier type 2020-07-28 20:26:30 +03:00
anastasiia.spaseeva
1801344c76 [Spec tests] Add tests for inner-and-nested-type-contexts section 2020-07-28 20:26:29 +03:00
anastasiia.spaseeva
d5ddb26180 [Spec tests] Add overload resolution tests for plus assign operator call 2020-07-28 20:26:28 +03:00
anastasiia.spaseeva
1d83c59e80 [Spec tests] Actualize test for callable reference section 2020-07-28 20:26:27 +03:00
anastasiia.spaseeva
4db209648d [Spec tests] Update spec version 2020-07-28 20:26:26 +03:00
anastasiia.spaseeva
3f862830f2 [Spec tests] Add tests for resolving callable references and some co-tests 2020-07-28 20:26:24 +03:00
anastasiia.spaseeva
cfbfec77a5 [Spec tests] Add tests for Algorithm of MSC selection 2020-07-28 20:26:23 +03:00
anastasiia.spaseeva
73850e97d7 [Spec tests] Add test for Coercion to Unit error diagnostics absence 2020-07-28 20:26:22 +03:00
anastasiia.spaseeva
26ac87d9be [Spec tests] Update spec testData 2020-07-28 20:26:21 +03:00
Alexander Udalov
f240d51d2c IR: do not inherit IrFakeOverride* from IrFunction/IrProperty
This will help to reduce boilerplate after making the latter classes.

Without this change, IrFunctionCommonImpl would not be able to be a
class because it would introduce a diamond class hierarchy, and thus
that would require copying all its contents to IrFunctionImpl and
IrFakeOverrideFunctionImpl.
2020-07-28 19:05:12 +02:00
Alexander Udalov
4892737cc9 Use IrFactory in kotlin-serialization-compiler 2020-07-28 19:04:44 +02:00
Alexander Udalov
0909894a96 PIR: make most implementations and carriers internal 2020-07-28 19:04:44 +02:00
Alexander Udalov
cce55f1609 IR: add module ir.tree.impl, move main IR implementation there 2020-07-28 19:04:44 +02:00
Alexander Udalov
77247deb23 IR: add module ir.tree.persistent, copy PIR implementation there
Use PersistentIrFactory in JS IR compiler entry points.
2020-07-28 19:04:43 +02:00
Alexander Udalov
9aed92d2dd Partially revert "Persistent IR implementation"
This partially reverts commit f437da8ee5.
Changes related to carriers and others are still there. They will be
moved out to a separate module in a subsequent commit.
2020-07-28 19:04:43 +02:00
Dmitry Petrov
980b91d082 JVM: generate 'Deprecated' on method as runtime-visible annotation
We generate @java.lang.Deprecated annotation on methods of $DefaultImpls
classes in compatibility mode. This annotation has RUNTIME retention and
should be visible.

Also, get rid of representing annotations as Class'es (yes we know that
these annotations are in compiler CLASSPATH, but we should not rely on
such classes and associated information).
2020-07-28 18:19:20 +03:00
Dmitry Petrov
4fdccb3b35 JVM_IR: don't generate repeated ElementType values in @Target 2020-07-28 18:19:20 +03:00
Ilya Goncharov
c065210b56 [Gradle, JS] Reuse task requirements
^KT-39825 fixed
2020-07-28 18:17:05 +03:00
Ilya Goncharov
9a3ae4f4fa [Gradle, JS] Common webpack configuration
^KT-39825 fixed
2020-07-28 18:16:51 +03:00
vldf
a2b26c00a1 Uncommented ControlFlowAnalysisBenchmark 2020-07-28 17:10:02 +03:00
vldf
fca0b7fedd [FIR] Add CFA benchmark 2020-07-28 14:30:40 +03:00
vldf
d7b3a86f5e [FIR] Add "can be val" extended checker 2020-07-28 14:17:38 +03:00
Jinseong Jeon
da6e96f4f1 FIR2IR: don't declare dispatch receiver for local functions 2020-07-28 13:43:10 +03:00
Jinseong Jeon
5a3367e09c FIR: initial support of suspend conversion for function reference 2020-07-28 13:37:05 +03:00
Alexander Udalov
b9243aad24 Minor, fix test data in bytecodeListing/specialBridges 2020-07-28 12:12:39 +02:00
Alexander Udalov
df324d5a08 IR: pull up common accept/transform implementations to interfaces
To avoid duplicating them among the main, persisting, lazy, and
fir2ir-lazy implementations.

Also reformat a bit, and avoid storing descriptor in a field in some
places.
2020-07-28 12:05:24 +02:00
Alexander Udalov
12d2a02d22 JS IR: drop JsIrDeclarationBuilder
Move buildValueParameter back to JsIrBuilder, and use common IR builders
directly where buildFunction was called.
2020-07-28 12:05:24 +02:00
Alexander Udalov
0d605a6b7f IR: create IrBlockBody via IrFactory 2020-07-28 12:05:24 +02:00
Alexander Udalov
9ad4a754ce IR: create IrExpressionBody via IrFactory 2020-07-28 12:05:24 +02:00
Alexander Udalov
d1dc938a5d IR: use IrFactory in IR builders 2020-07-28 12:05:24 +02:00
Alexander Udalov
898dd20a9e IR: use IrFactory in misc utils 2020-07-28 12:05:23 +02:00
Alexander Udalov
f359f36ed9 IR: add IrFactory to IrDeclaration, use in deep copy 2020-07-28 12:05:23 +02:00
Alexander Udalov
305288aa82 IR: use IrFactory in psi2ir 2020-07-28 12:05:23 +02:00
Alexander Udalov
8c41ba8ee4 IR: use IrFactory in fir2ir 2020-07-28 12:05:23 +02:00
Alexander Udalov
9356f87f28 IR: use IrFactory in linker 2020-07-28 12:05:23 +02:00
Alexander Udalov
db4cbe7103 IR: use IrFactory in SymbolTable 2020-07-28 12:05:23 +02:00
Alexander Udalov
c6a127e87e IR: introduce IrFactory
This is needed to refactor IrPersistingElementBase-based implementations
into another module, to use it in JS IR.
2020-07-28 12:05:23 +02:00
Kirill Shmakov
96968cd9c9 Fix build after rebasing 2020-07-28 12:55:38 +03:00
Kirill Shmakov
96160cbb55 Adapt AS wizard to changes in main wizard 2020-07-28 12:26:19 +03:00
Kirill Shmakov
5c8833f608 Wizard: improve mobile app template 2020-07-28 12:26:19 +03:00
Ilya Kirillov
63fa6674a3 Wizard: temporary add ios shortcut target
Temporary as it will not be needed when HMPP wizard will be ready
2020-07-28 12:26:19 +03:00
Ilya Kirillov
f330cd3697 Wizard: relocate AndroidManifest.xml for MPP module 2020-07-28 12:26:19 +03:00
Ilya Kirillov
b3d48cda8c Wizard: add common tests for iOS/Android template 2020-07-28 12:26:19 +03:00
Ilya Kirillov
5ffcaf6508 Wizard: add shared code for iOS/Android template
fix android
2020-07-28 12:26:19 +03:00
Ilya Kirillov
66c756ad0f Wizard: add ability for wizard to generate expected/actual declarations in MPP module 2020-07-28 12:26:18 +03:00
Ilya Kirillov
7d1036ee7e Wizard: use property for storing module dependency 2020-07-28 12:26:18 +03:00
Ilya Kirillov
dbc43b66bf Wizard: introduce ModuleConfiguratorProperty 2020-07-28 12:26:18 +03:00
Ilya Kirillov
74d6919c7c Wizard: wrap property into PluginProperty for plugin properties 2020-07-28 12:26:18 +03:00
Ilya Kirillov
3c3ba361e8 Wizard: specify path for plugin entities in one place 2020-07-28 12:26:18 +03:00
Ilya Kirillov
c05c72387e Wizard: fix node js templates 2020-07-28 12:26:18 +03:00
aleksandrina-streltsova
63e2d771b3 Get rid of reflection in new project wizard core: manually specify properties in plugins 2020-07-28 12:26:17 +03:00
Ilya Kirillov
cc35529b9a Wizard: get rid of reflection: specify plugin path by hand 2020-07-28 12:23:57 +03:00
Ilya Kirillov
3ed11c0491 Wizard: get rid of reflection: force plugins to specify settings & tasks directly 2020-07-28 12:23:57 +03:00
vldf
eadd3f00f2 [FIR] Add CanBeReplacedWithOperatorAssignmentChecker 2020-07-28 10:13:28 +03:00
Kevin Bierhoff
fa8c6e7fb6 Uast: KT-40578: resolve Kotlin property writes to setters (#3597)
* KT-40578: resolve Kotlin property writes to setters

* limit to non-constructor properties

* Uast: `KotlinIDERenderLogTest.testConstructors` fix

Co-authored-by: Nicolay Mitropolsky <nicolay.mitropolsky@jetbrains.com>
2020-07-28 10:03:22 +03:00
Sergey Bogolepov
5851a7dea0 [kotlinx-metadata-klib] Proper support for nullable enum entry fields 2020-07-28 11:59:17 +07:00
Sergey Rostov
45f0328f21 scripting: preload scripting support plugins 2020-07-27 19:44:03 +00:00
Sergey Rostov
b5e04378ed scripting, ucache: don't init caches at start up
init it in async instead. all usages will be updated thanks to
highlighting/reindexing that is called after cache is constructed.

#KT-40242 Fixed
2020-07-27 19:44:03 +00:00
Dmitry Petrov
43fcb2330e JVM_IR: fix source file name for mutlifile class facades 2020-07-27 19:13:37 +03:00
Dmitry Petrov
89a0b3e944 Check class source in bytecode listing tests 2020-07-27 19:13:37 +03:00
Dmitriy Dolovov
b47946cbba Report interop functions with non-stable parameter names
^KT-34602
2020-07-27 23:11:36 +07:00
Dmitriy Dolovov
3d9093583f Metadata: 'non-stable parameter names' flag for callables
^KT-34602
2020-07-27 23:11:30 +07:00
Ilya Goncharov
8cace2bab4 [Gradle, JS] Add tests on kotlin/js module with js files 2020-07-27 19:00:12 +03:00
Ilya Goncharov
0b88f457e8 [Gradle, JS] Use .meta.js as source of "name" and "main" fields
^KT-40342 fixed
2020-07-27 19:00:12 +03:00
Victor Petukhov
cca64b8fab NI: use the inferred type to check of nullable array for vararg
^KT-40555 Fixed
2020-07-27 18:24:31 +03:00
Steven Schäfer
9d63412b3e JVM IR: Produce correct generic signatures for special bridge methods 2020-07-27 17:02:24 +02:00
Steven Schäfer
c16b548dff JVM IR: Don't produce annotations on builtin stub, toArray, and bridge methods 2020-07-27 17:02:24 +02:00
Andrei Klunnyi
f661b7604b KT-40557 Scratch: .kt files are treated as Kotlin scratches, opening fails
https://ea.jetbrains.com/browser/ea_problems/224367
2020-07-27 15:36:02 +02:00
Andrei Klunnyi
0e46a980f6 EA- 235760 // additional logging
https://ea.jetbrains.com/browser/ea_problems/235760
2020-07-27 15:36:00 +02:00
Andrei Klunnyi
c27453632e EA-235769 // StringIndexOutOfBoundsException
https://ea.jetbrains.com/browser/ea_problems/235769
2020-07-27 15:35:59 +02:00
Andrei Klunnyi
4afa50e081 EA-235759 // NPE fix
https://ea.jetbrains.com/browser/ea_problems/235759
2020-07-27 15:35:58 +02:00
Andrei Klunnyi
29281fd0bf EA-235761 // NPE fix
https://ea.jetbrains.com/browser/ea_problems/235761
2020-07-27 15:35:57 +02:00
Andrei Klunnyi
e63951c38c EA-235765 // NPE at refactoring suggestion
Fixed exception:
java.lang.NullPointerException: null cannot be cast to non-null type
org.jetbrains.kotlin.descriptors.CallableDescriptor

More info: https://ea.jetbrains.com/browser/ea_problems/235765
2020-07-27 15:35:55 +02:00
Dmitry Gridin
e8fd69fde1 [formatter] fix infinite recursion
Already exists in the new repo: original-hash e7ea6926a8a414ab6082299d99239ad167ab75a2

#KT-40636 Fixed
2020-07-27 19:56:19 +07:00
Ryan Nett
b1173317c5 Change scripting Severity enums to order from DEBUG to FATAL.
#KT-39502 fixed
2020-07-27 14:29:30 +02:00
Konstantin Tskhovrebov
59f6c0c273 Add flag for avoid double MPP gradle module resolve. 2020-07-27 15:11:48 +03:00
Ilya Goncharov
5444ffaf4b [Gradle, JS] Deprecate produceExecutable
^KT-40568 fixed
2020-07-27 14:44:47 +03:00
Ilya Goncharov
d9c269ed6b [Gradle, JS] Disable binaries.executable by default in wizard
^KT-40461 fixed
2020-07-27 14:35:45 +03:00
Natalia Selezneva
8d1f9df802 Do not show warning when multiple Gradle Definitions are loaded
This will happen when there are multiple gradle project linked to one IDEA project
andthey have different gradle versions
2020-07-27 13:08:01 +03:00
Ilya Matveev
a62f65940d Gradle, CocoaPods: Use synthetic dir as a working dir for pod gen
'Pod gen' creates an empty folder named 'Pods' in a directory where it
is executed. Earlier, 'pod gen' was executed in a project root
directory, so this `Pods` folder was created in a VCS-controlled
place. This patch fixes this issue by running 'pod gen' in a directory
where the synthetic project is located.
2020-07-27 10:02:07 +00:00
Ilya Matveev
7c3eda31fa Gradle, CocoaPods: Fix non-compilable dummy header
Issue #KT-39999 fixed
2020-07-27 10:02:07 +00:00
Ilya Matveev
85908713b1 Gradle, CocoaPods: Support pods with dashes in names
See https://github.com/JetBrains/kotlin-native/issues/2884
2020-07-27 10:02:06 +00:00
Zalim Bashorov
635869f15a Rewrite className helper to fix tests on android
Since android tests preprocess test data and
(at least) replace package for files and fix package usages
it's preferred to use fqnames explicitly
instead of assembly them from parts, as it was before.
2020-07-25 15:28:36 +03:00
Mikhail Glukhikh
0ded1d7006 FirBasedSignatureComposer: generate better error messages 2020-07-24 19:47:28 +03:00
Mikhail Glukhikh
40256aa43d Fir2IrLazyClass: generate enum values() / valueOf() properly 2020-07-24 19:47:28 +03:00
Mikhail Glukhikh
8bae0f2d0c [FIR2IR] Handle local visibility around signature composer properly 2020-07-24 19:47:27 +03:00
Mikhail Glukhikh
828524bde4 [FIR2IR] Fix conversion of default vararg arguments for annotations 2020-07-24 19:47:27 +03:00
Mikhail Glukhikh
240baa64a5 Fir2IrConverter: initialize call generator earlier to avoid lateinit err 2020-07-24 19:47:26 +03:00
Mikhail Glukhikh
2b52988f1b [FIR TEST] Add failing BB test with Deprecated annotation 2020-07-24 19:47:19 +03:00
Denis Zharkov
df1719c64c Fix incorrect mixed named/positioned arguments in project code
^KT-40404 Fixed
2020-07-24 13:36:52 +03:00
Denis Zharkov
dc6efa5a61 Fix incorrect handling of mixed named/positional arguments
^KT-40404 Fixed
2020-07-24 13:36:52 +03:00
Mikhail Bogdanov
d083297366 Support additional flags in MPP tests. Add diagnostic tests for defaults 2020-07-24 12:10:04 +02:00
Mikhail Bogdanov
125c72cb8d New default checks for mixed hierarchies
Old and new schemes
2020-07-24 12:10:04 +02:00
Denis Zharkov
de02b31ad7 FIR: Use phasedFir in resolve
^KT-40376 Fixed
2020-07-24 12:32:29 +03:00
Yaroslav Chernyshev
0de29e641d Fixed bug with pureKotlinSourceFolders for common modules 2020-07-24 12:22:00 +03:00
Yaroslav Chernyshev
142bd2e009 Filtering pureKotlinSourceFolders for existing package directories 2020-07-24 12:21:59 +03:00
Yaroslav Chernyshev
e6670d439f Small renaming classifier -> disambiguationClassifier 2020-07-24 12:21:58 +03:00
Yaroslav Chernyshev
96d9dad429 Fixed tests for pureKotlinSourceFolders by extending created facets 2020-07-24 12:21:57 +03:00
Yaroslav Chernyshev
f490085142 Support pureKotlinSourceFolders for MPP projects
#KT-34271 Fixed
#KT-32963 Fixed
2020-07-24 12:21:57 +03:00
nataliya.valtman
fde8a34c32 KT-40058 NPE from mpp gradle plugin on kotlinx.benchmarks 2020-07-24 10:46:45 +03:00
Ivan Kylchik
bc41681a2e Fix gradle import error after introducing new gradle task in benchmarks 2020-07-23 21:18:32 +03:00
Vyacheslav Gerasimov
96ac6e612d Build: Replace androidIdeTest task with kaptIdeTest
We dont run android ide tests anymore
2020-07-23 19:18:18 +03:00
Vyacheslav Gerasimov
803d24cd42 Build: Remove pluginTests task and deduplicate kapt test task 2020-07-23 19:18:17 +03:00
Vyacheslav Gerasimov
ee642e69b0 Build: Introduce mainIdeTests task 2020-07-23 19:18:17 +03:00
Dmitry Petrov
e2a4ca10d6 JVM_IR: fix inner class attributes for private class in interface 2020-07-23 19:13:28 +03:00
Dmitry Petrov
0741781462 Compare inner class access flags in bytecode listing tests 2020-07-23 19:13:28 +03:00
Natalia Selezneva
8d894929ae Minor: unify logging in scripting 2020-07-23 16:31:32 +03:00
Natalia Selezneva
8a6cdcba29 Do not hold a lock during loading script templates from dependencies
^KT-40383 Fixed
2020-07-23 16:24:13 +03:00
Natalia Selezneva
493c287bb0 Minor: fix notification text when script configuration is missing after request 2020-07-23 16:20:57 +03:00
Ivan Kylchik
265873becd Comment out runBenchmark tasks due to gradle import error 2020-07-23 15:20:35 +03:00
Roman Golyshev
be06c51aa7 KT-40363 Handle non-octal int literals in for-loop conversions
- See EA-210233
- ^KT-40363 Fixed
2020-07-23 11:24:48 +00:00
Roman Golyshev
cba671a3ef KT-40359 Catch NumberFormatException during literal conversion
- Instead of failing J2K conversion completely, insert TODO expression
to the resulting code (it is better to have a converted code with TODO
than to have nothing at all)
- See EA-210233 for similar exceptions
- ^KT-40359 Fixed
2020-07-23 11:24:48 +00:00
Roman Golyshev
cc0a787735 Add null-checking to KotlinIdeaResolutionException constructors
- NPE here leads to loosing the actual exception
- EA-235059 Fixed
2020-07-23 11:24:47 +00:00
Nicolay Mitropolsky
f7031e65ba Uast: don't throw exception if can't get a receiver parameter for annotation (KT-40494) 2020-07-23 10:33:44 +03:00
Jinseong Jeon
7872b21914 FIR: handle object invoke via type alias 2020-07-23 09:34:42 +03:00
Svyatoslav Kuzmich
4a803e9d2f [JS IR] Support object declaration export
Fixes KT-39117 and KT-39367
2020-07-23 08:21:59 +03:00
Svyatoslav Kuzmich
4027dae594 [JS] Add js/js.translator/testData/package-lock.json 2020-07-23 08:21:57 +03:00
Natalia Selezneva
be371c9294 Remove optimization in KotlinScriptDependenciesClassFinder
Scope can contains only classes for one script,
but allScriptDependenciesScope contains classes for all scripts
2020-07-23 00:00:51 +03:00
Natalia Selezneva
be8374a1a8 Minor: fix comments 2020-07-23 00:00:50 +03:00
Natalia Selezneva
e708e3f1c5 Do not suggest to load gradle.kts configurations after project reopening
For projects with distributionType=WRAPPED
Workaround for KT-40394

The original problem is that GradleInstallationManager.resolveGradleVersion returns null is case of distributionType=WRAPPED

^KT-40394 Fixed
2020-07-23 00:00:50 +03:00
Natalia Selezneva
300e9581de Fix UI for Kotlin Scripting page
Show 15 items in the list by default
Show hint at the top
Fixed for 201+

^KT-40097 Fixed
2020-07-22 23:49:47 +03:00
Natalia Selezneva
dd20b9062a Completion for script inside module should provide classes from related module
^KT-35825 Fixed
2020-07-22 23:49:47 +03:00
Alexander Udalov
65d3ae6253 JS IR: move declaration creation from IrBuilder to JsIrDeclarationBuilder
This is a temporary class until IrDeclarationFactory is there.
2020-07-22 22:40:08 +02:00
Alexander Udalov
d3a34a8898 Psi2Ir: somewhat simplify Psi2IrTranslator API
Inline some methods only used once, deduplicate usages, rearrange
parameters, etc.
2020-07-22 22:38:21 +02:00
Alexander Udalov
241f82c70f IR: avoid storing unnecessary fields in IrPropertyImpl 2020-07-22 22:38:21 +02:00
Alexander Udalov
3f06f8a6ba IR: avoid storing unnecessary fields in IrFunctionImpl 2020-07-22 22:38:20 +02:00
Alexander Udalov
517c3e1020 IR: introduce IrFakeOverrideFunction, IrFakeOverrideProperty
Use them instead of the implementations. This will allow to refactor
creation to a factory and allow to use other implementations in the
future.
2020-07-22 22:38:20 +02:00
Alexander Udalov
ca5eb40fa5 IR: minor, avoid usages of IrBlockBodyImpl/IrExpressionBodyImpl 2020-07-22 22:38:20 +02:00
Mark Punzalan
174576af61 ForLoopsLowering: Handle Sequence<*>.withIndex(). 2020-07-22 22:32:29 +02:00
Mark Punzalan
132960a695 ForLoopsLowering: Eliminate use of @ObsoleteDescriptorBasedAPI. 2020-07-22 22:32:29 +02:00
Mark Punzalan
b1ce21bc55 ForLoopsLowering: Reduce unnecessary temporary variables for the
"checked step" (check for a positive step arg) and "negated step"
(negate the step arg when the nested step is negative).
2020-07-22 22:32:29 +02:00
Mark Punzalan
291d62f653 ForLoopsLowering: Move handlers to sub-package and separate files. 2020-07-22 22:32:29 +02:00
Ivan Kylchik
44d283eb07 Fix FIR benchmark memory leak 2020-07-22 20:18:26 +03:00
Ivan Kylchik
be4dbf2dcd Create gradle scripts to run and analyze benchmark results 2020-07-22 20:18:25 +03:00
Ivan Kylchik
29d0e3dbb5 Reuse createSession function for FIR in benchmark 2020-07-22 20:18:24 +03:00
Dmitry Petrov
1272162a7f JVM_IR: generate "safe" names for functions in init blocks 2020-07-22 19:49:48 +03:00
Yaroslav Chernyshev
bb8f857809 [Gradle, Import] Added externalSystemId into facet for mpp projects
#KT-39803 Fixed
2020-07-22 19:44:09 +03:00
Ilya Goncharov
e5b0498eb6 Fix tests for Gradle kts and groovy dsl
^KT-40527 fixed
2020-07-22 14:04:57 +03:00
Ilya Goncharov
ae0bedd2ac [Gradle, JS] Different module kind for browser and nodejs
^KT-40527 fixed
2020-07-22 14:04:29 +03:00
Ilya Goncharov
38ec3ffb4a [Gradle, JS] Statically calculated module configurator id
^KT-40527 fixed
2020-07-22 14:04:15 +03:00
Ilya Goncharov
bf1b85343f [Gradle, JS] Remove copyright from template of node.js
^KT-40527 fixed
2020-07-22 14:03:40 +03:00
Ilya Goncharov
2d60d2c0e6 [Gradle, JS] Divide allowSinglePlatform
^KT-40527 fixed
2020-07-22 14:02:02 +03:00
Ilya Goncharov
af367b01ec [Gradle, JS] Add test on node js single platform project
^KT-40527 fixed
2020-07-22 14:01:50 +03:00
Ilya Goncharov
cb60b9e59c [Gradle, JS] singleplatformJs -> singlePlatformJsBrowser
^KT-40527 fixed
2020-07-22 14:01:20 +03:00
Ilya Goncharov
01ec8b5262 [Gradle, JS] Fix typo and add node js module configurator
^KT-40527 fixed
2020-07-22 13:59:46 +03:00
Ilya Goncharov
0d606e1346 [Gradle, JS] Fix id and text in simple js module configurators
^KT-40527 fixed
2020-07-22 13:59:33 +03:00
Ilya Goncharov
4c5cd44e75 [Gradle, JS] Localize Module Type
^KT-40527 fixed
2020-07-22 13:59:15 +03:00
Ilya Goncharov
29e37ee15f [Gradle, JS] Fix test for js single platform
^KT-40527 fixed
2020-07-22 13:58:47 +03:00
Ilya Goncharov
a866e51402 [Gradle, JS] NodeJs template files
^KT-40527 fixed
2020-07-22 13:58:32 +03:00
Ilya Goncharov
95f6669275 [Gradle, JS] Add NodeJs template plugin
^KT-40527 fixed
2020-07-22 13:58:19 +03:00
Ilya Goncharov
6866fdc3e1 [Gradle, JS] Add NodeJs template project
^KT-40527 fixed
2020-07-22 13:57:44 +03:00
Ilya Goncharov
4de31da0f3 [Gradle, JS] Fix typo
^KT-40527 fixed
2020-07-22 13:57:07 +03:00
Ilya Goncharov
e8dfc4dcd0 [Gradle, JS] JsSinglePlatform -> BrowserJsSinglePlatform
^KT-40527 fixed
2020-07-22 13:56:53 +03:00
Ilya Goncharov
b4334a3a3b [Gradle, JS] Fix formatting in Gradle Kotlin/JS wizard
^KT-40149 fixed
2020-07-22 13:23:03 +03:00
Jinseong Jeon
e1abaa9b51 FIR: special visibility handling for monitor{Enter|Exit} 2020-07-22 12:16:32 +03:00
Jinseong Jeon
85f692ab40 FIR2IR: use DescriptorWithContainerSource if container source is available
The use of DescriptorWithContainerSource is the key to trigger the
proper generation of stub facade class as parent.
2020-07-22 12:16:32 +03:00
Alexander Gorshenev
c076d81f0c [IR FAKE OVERRIDES] Properly account for outer class type parameters 2020-07-22 12:02:51 +03:00
Pavel Kirpichenkov
1ef17c6f3a Drop isErrorTypeAllowed flag from type system context
The flag was used exclusively during calculation of common super type.
This change relies on assumption, that common super type is
NOT calculated in IR type system context.
2020-07-22 11:41:42 +03:00
Pavel Kirpichenkov
710659324c [NI] Fix common supertype of types with error supertypes
Enable check for error supertypes during CST calculation in classic type system context.
Cyclic upper bound + known type parameters of superclasses may create non-error types
with error supertypes. Such types don't have common constructors with other normal types
and cause assertion errors during intersection.

^KT-36951 Fixed
2020-07-22 11:41:42 +03:00
Ilya Gorbunov
95cc35f22e Package builtins with jvm reflect into IDEA plugin only
Leave builtins with common reflect for stand-alone compiler.
2020-07-22 11:08:14 +03:00
Stanislav Erokhin
0c094b1719 Serialize jvm reflect into builtIns
Basically this is revert of 427e34fe5a commit
This was done due to the KT-39728.
Also we do pick every file separately, because builtIn serializer
unable to filter expects
2020-07-22 11:08:14 +03:00
Stanislav Erokhin
67090e1afb Move KTypeProjection to separate file 2020-07-22 11:08:14 +03:00
Zalim Bashorov
ee26fd4959 [KJS FE] Change severity of NON_EXPORTABLE_TYPE from error to warning
The change is required to avoid breaking examples using kotlin-wrappers
until we find an acceptable solution for them.

#KT-39873 Fixed
2020-07-22 10:51:41 +03:00
Denis Zharkov
41bd013796 Fix incorrect usages of @NotNull type parameters in project sources
^KT-36770 In progress
2020-07-22 10:16:14 +03:00
Denis Zharkov
037ff2fa52 Fix incorrect handling of @NotNull type parameters
^KT-36770 In progress
^KT-40114 Relates
^KT-28785 Relates
2020-07-22 10:16:14 +03:00
Denis Zharkov
f1c68a9080 Introduce JavaTypeEnhancement component
It's necessary to allow using language version settings in type enancement
2020-07-22 10:16:14 +03:00
Denis Zharkov
240311d9c7 Minor. Reformat JavaNullabilityChecker 2020-07-22 10:16:14 +03:00
Dmitry Petrov
d93885e71c Add tests for deprecated properties 2020-07-21 22:25:44 +03:00
Dmitry Petrov
e84339a0d3 JVM_IR: fields for deprecated enum entries have ACC_DEPRECATED flag
'Deprecated' annotation can't be applied to field itself.
2020-07-21 22:25:44 +03:00
Roman Artemev
edab3e3ba9 [PLUGIN API] Add referenceTypeAlias API to IrPluginContext
- attempt to fix KT-40193
2020-07-21 18:38:33 +03:00
Roman Artemev
c4b4912a71 Revert "[PLUGIN API] Make referenceClass resolve type aliases too" 2020-07-21 18:38:32 +03:00
Anton Bannykh
cb15570d75 [JS IR BE] Fix validation errors (duplicate nodes and incorrect parent) 2020-07-21 18:25:17 +03:00
Vyacheslav Gerasimov
d36d62e226 Add info about -Pteamcity to readme and make warning less annoying 2020-07-21 18:05:21 +03:00
Vyacheslav Gerasimov
a4457ba7ac Build: Setup dependency on dist for :compiler:fir:analysis-tests:test 2020-07-21 17:24:59 +03:00
Vyacheslav Gerasimov
58ee95c8a3 Build: Add root IDE test tasks to split tests in 3 parts 2020-07-21 17:24:59 +03:00
Vyacheslav Gerasimov
036c359993 Build: Make local profile warning more visible 2020-07-21 17:24:58 +03:00
Vyacheslav Gerasimov
d9fbaadb2e Build: Upgrade Gradle Enterprise plugin to 3.3.4 2020-07-21 17:24:58 +03:00
Roman Artemev
d7a0dbfae8 [PLUGIN API] Make referenceClass resolve type aliases too
- fix KT-40193
2020-07-21 15:36:31 +03:00
Leonid Startsev
a0154b9851 Add JarUtil.getJarAttribute to proguard rules
This method is used by serialization plugin to read runtime JAR
manifest.

Maven serialization plugin seems to use proguarded compiler
distribution,
so to use this method, it should be kept.

Size increased for about 2kb.
2020-07-21 15:10:08 +03:00
Leonid Startsev
e3f42721e9 Mute/ignore 'PROVIDED_RUNTIME_TOO_LOW' in tests 2020-07-21 15:10:08 +03:00
Leonid Startsev
df5f38fec8 Implement reading kx.serialization runtime metadata from jar manifest
That allows to check whether current compiler plugin can work with
a given runtime version. Implementation-Version can help to detect whether
runtime version is too low, and Require-Kotlin-Version detects whether
runtime version is too high.

Corresponding diagnostic for Require-Kotlin included.
Implement minimal runtime version check for kotlinx.serialization
plugin.

 #KT-40036 Fixed

Cache result from getVersionsForCurrentModule in BindingTrace.
Hide check in the IDE, because caching in trace does not work there.
2020-07-21 15:10:08 +03:00
Leonid Startsev
7db0bf8195 Add new serialization runtime packages
encoding and descriptors. Rename ContextSerializer to Contextual.
Unify getClassFrom*Package functions.
2020-07-21 15:02:06 +03:00
Ivan Kylchik
8b9fb6a6cd [FIR] Remove FirOperatorCall node from fir tree 2020-07-21 13:54:19 +03:00
Ivan Kylchik
3c01a39846 [FIR] Update test data after introducing new fir nodes 2020-07-21 13:54:17 +03:00
Ivan Kylchik
d77d733244 [FIR] Complement fir rendering with newly created nodes 2020-07-21 13:54:17 +03:00
Ivan Kylchik
9a119a6757 [FIR] Replace all necessary usages of operator call with new ones
#KT-38333 Fixed
2020-07-21 13:54:16 +03:00
Ivan Kylchik
def47bdd9d [FIR] Add new equalityOperatorCall node in control flow graph 2020-07-21 13:54:15 +03:00
Ivan Kylchik
d23e9940ec [FIR] Change fir builder to use newly created nodes 2020-07-21 13:54:15 +03:00
Ivan Kylchik
708c8b8ef3 [FIR] Create additional nodes to replace operator call in some places
1. FirAssignmentOperatorStatement - represent assignment operations
such as =, +=, -=, /=, %=
2. FirEqualityOperatorCall - represent boolean operations such as ==,
!=, ===, !==

#KT-38333 In Progress
2020-07-21 13:54:14 +03:00
Roman Artemev
8c4930da2e [KLIB] Drop API which is no longer used 2020-07-21 13:15:35 +03:00
Roman Artemev
bb20e4759b [KLIB] Use queue to track classes required fake override resolve
- Avoid module visiting to prevent lazy bodies loading
2020-07-21 13:15:35 +03:00
vladislavf7@gmail.com
2b0639d4ad [FIR] Cleanup and refactoring for checkers 2020-07-21 12:13:10 +03:00
vladislavf7@gmail.com
fb946a6a3f [FIR] Move extended checkers list 2020-07-21 12:13:10 +03:00
vladislavf7@gmail.com
751ed60e42 [FIR] Fix redundant visibility modifier checker 2020-07-21 12:13:10 +03:00
vladislavf7@gmail.com
a8ff5d17dc [FIR] Fix redundant modality modifier checker
Fixed function FirDeclaration.hasBody() and some others improvement
2020-07-21 12:13:10 +03:00
vladislavf7@gmail.com
a988234bbf [FIR] Fix redundant explicit type checker 2020-07-21 12:13:09 +03:00
Pavel Punegov
eecb43d4c9 Ignore test in Native backend 2020-07-21 11:26:57 +03:00
Ilya Gorbunov
bace1b8055 Increase stdlib-js mocha test timeouts to 10s
Some tests often do not fit into the default timeout when running tests
in parallel on CI.
2020-07-21 05:43:38 +03:00
Steven Schäfer
d62a6a2631 JVM IR: Do not create accessors for enum entry constructors 2020-07-20 22:37:49 +02:00
Alexander Udalov
71730696b2 JVM IR: rename JvmDeclarationFactory -> JvmCachedDeclarations 2020-07-20 22:26:11 +02:00
Alexander Udalov
c7f9dc1c40 IR: rename DeclarationFactory to InnerClassesSupport, move out of context
Methods of the common interface DeclarationFactory were only used in
lowerings in InnerClassesLowering, which were used in JVM and JS, not
Native. Therefore, it makes sense to have this as a separate interface
and pass its implementation to these lowerings directly, instead of
declaring it in the common context (which is not going to be implemented
in Native).
2020-07-20 22:26:11 +02:00
Alexander Udalov
cf884fb048 IR: remove JVM-specific methods from DeclarationFactory 2020-07-20 22:26:11 +02:00
Alexander Udalov
6907decd99 Report file name on exception from ASM in BinaryJavaClass
This is useful to diagnose cases like KT-40339
2020-07-20 22:25:55 +02:00
Matthew Gharrity
221d49a995 Set wantsDiagnostics() in AbstractFilteringTrace
report() already delegates to the parentTrace, so
wantsDiagnostics() should delegate to it as well.
2020-07-20 21:12:25 +03:00
Dmitry Petrov
2e31f95554 Update testData 2020-07-20 20:04:32 +03:00
Dmitry Petrov
2b9606becf JVM_IR: field for suspend main parameter is synthetic 2020-07-20 20:04:31 +03:00
Dmitry Petrov
7be9b18ff4 JVM: field for suspend main parameter is synthetic 2020-07-20 20:04:31 +03:00
Dmitry Petrov
6bc44a366a JVM_IR: fields for suspend lambda parameters are synthetic 2020-07-20 20:04:31 +03:00
Dmitry Petrov
bae6037f00 JVM: fields for suspend lambda parameters are synthetic 2020-07-20 20:04:31 +03:00
Dmitry Petrov
fa75518bd7 JVM_IR: don't skip nullability annotations on private fields
Unfortunately, some annotation processors rely on those annotations.
2020-07-20 20:04:31 +03:00
Dmitry Petrov
d30c67db14 JVM: don't skip nullability annotations on private fields
Unfortunately, some annotation processors rely on those annotations.
2020-07-20 20:04:30 +03:00
Victor Petukhov
b0ac046b05 NI: decrease fixation priority for variables which have only incorporated from upper bound constraints
^KT-40045 Fixed
^KT-39633 Fixed
2020-07-20 19:20:18 +03:00
Ilya Goncharov
081248f859 [Gradle, JS] Extract properties provider in KotlinJsTarget 2020-07-20 17:44:12 +03:00
Ilya Goncharov
4917643583 [Gradle, JS] Check if not both compiler 2020-07-20 17:40:52 +03:00
Ilya Goncharov
61b5a738da [Gradle, JS] Rename flag for legacy
^KT-40320 fixed
2020-07-20 16:51:37 +03:00
Ilya Goncharov
e776444459 [Gradle, JS] binaries executable for legacy by default
^KT-40320 fixed
2020-07-20 16:51:22 +03:00
Ilya Goncharov
f7beea10a5 [Gradle, JS] Common configure should be last otherwise user settings can
be overwrote

^KT-40320 fixed
2020-07-20 16:51:08 +03:00
Jim Sproch
814bd48148 Keep members of com.google.common dependencies intact
It is a workaround for KTI-298
#KT-40354 In progress
2020-07-20 15:05:16 +03:00
Dmitriy Novozhilov
236dfe60f1 [FIR] Correctly build scopes for resolve of different parts of constructors
#KT-40409 Fixed
2020-07-20 14:38:17 +03:00
Dmitriy Novozhilov
94ff457e43 [FIR] Handle erroneous situation with type projection in supertype 2020-07-20 14:38:17 +03:00
Dmitriy Novozhilov
c94d583e2e [FIR] Add substitution for inner classes to supertype resolve
KT-38992 Fixed
2020-07-20 14:38:16 +03:00
Dmitriy Novozhilov
cf555ef2b6 [FIR] Move FirNestedClassifierScopeWithSubstitution to separate file 2020-07-20 14:38:16 +03:00
Dmitriy Novozhilov
07e12f98b5 [FIR] Substitute supertypes in nested classifier scope
KT-38992
2020-07-20 14:38:16 +03:00
Dmitriy Novozhilov
cedd1c133e [FIR] Match type in super<type> access with actual supertypes of class 2020-07-20 14:38:16 +03:00
Dmitriy Novozhilov
1ce4eca3a6 [FIR] Infer type arguments for captured parameters of inner classes
KT-38992
2020-07-20 14:38:16 +03:00
Dmitriy Novozhilov
1c622a5a3f [FIR] Add transformConversionTypeRef to FirTypeOperatorCall 2020-07-20 14:38:16 +03:00
Dmitriy Novozhilov
1b78950ebb [FIR] Don't transform property initializers in type resolve 2020-07-20 14:38:16 +03:00
Dmitriy Novozhilov
9e94189852 [FIR] Add transformTypeParameters to FirTypeParameterRefsOwner 2020-07-20 14:38:15 +03:00
Mikhail Zarechenskiy
4083111dab Fix SAM conversion when lambda is the last expression of another lambda
#KT-39691 Fixed
2020-07-20 14:30:40 +03:00
Mikhail Zarechenskiy
a15d3c76b6 Fix references to sam adapted functions, also fix lookup location
#KT-31025 Fixed
2020-07-20 14:30:40 +03:00
Mikhail Zarechenskiy
0c79de1a98 Prohibit adapted reference resolve against reflective types
There are design questions about reflection for adapted references,
 so the current proposal is to prohibit reflection on them and support
 it properly later

 #KT-40406 Fixed
2020-07-20 14:30:39 +03:00
Vladimir Ilmov
d8de37f665 (CoroutineDebugger) using WeakReference as lastObservedFrame
relates to #KT-40073
2020-07-20 11:44:51 +02:00
Vladimir Ilmov
bcf1954860 (CoroutineDebugger) added support for DebugCoroutineInfoImpl in kotlinx-coroutines-core:1.3.8
relates to #KT-40073
2020-07-20 11:44:51 +02:00
Vladimir Ilmov
b43b238030 (CoroutineDebugger) embed agent into gradle JavaExec task
#KT-40417 fixed
2020-07-20 11:44:32 +02:00
Vladimir Ilmov
217428212f (CoroutineDebugger) Refactoring of retrieving BaseContinuationImpl chains 2020-07-20 11:43:23 +02:00
Vladimir Ilmov
14766a3e1a (CoroutineDebugger) lv 'task' added to tests in EventLoopImplBase kotlinx-coroutines-core:1.3.7 2020-07-20 11:38:01 +02:00
Vladimir Ilmov
e49f3b567b (CoroutineDebugger) minimum supported version kotlinx-coroutines-core.1.3.8
Workaround for starting agent on windows removed, version upgraded in tests
 #KT-40073 fixed
2020-07-20 11:38:00 +02:00
Denis Zharkov
cd896ae6c8 FIR: Implement FE 1.0 semantics for super unqualified calls
See original logic at org.jetbrains.kotlin.types.expressions.unqualifiedSuper.UnqualifiedSuperKt#resolveUnqualifiedSuperFromExpressionContext

^KT-39070 Fixed
^KT-39599 Related
2020-07-20 12:24:51 +03:00
Denis Zharkov
dfc75f3447 FIR: Support fake elements for light tree 2020-07-20 12:24:27 +03:00
Denis Zharkov
fea1fb0fc3 FIR: Rename FirSourceElement::withKind to fakeElement
And reinforce its contract
2020-07-20 12:24:27 +03:00
Denis Zharkov
376d3385d0 FIR: Handle super-receiver case in a special way
Before this change, it was resolved independently of containg call
But in fact, the type of `super` depends on the name of the callee
(see KT-39599 and KT-39070)
2020-07-20 12:24:27 +03:00
Jinseong Jeon
628b8b56b7 FIR2IR: convert annotations on type aliases 2020-07-20 09:40:52 +03:00
Jinseong Jeon
4e14f9500f FIR: account for vararg when creating KFunction type for callable reference 2020-07-20 09:39:34 +03:00
Mikhail Zarechenskiy
e5e50eabe9 Update testdata after 41a0cfe002 2020-07-20 07:04:59 +03:00
Yan Zhulanow
b351556b1f Fix testJarsWithDependenciesWithinClasses() compilation after unsuccessful cherry-pick 2020-07-20 06:10:36 +09:00
Anton Yalyshev
64aaeb52f5 Add change notes for 1.4-M1,2,3,RC builds #KT-40311 Fixed 2020-07-19 11:56:06 +03:00
Jim Sproch
a4a398239b Fallback to fileEntry provided by irFile 2020-07-18 11:16:09 +03:00
Georgy Bronnikov
c901e82a55 IR: add IrSimpleFunction.isInfix 2020-07-18 11:03:33 +03:00
Ivan Gavrilovic
8e4bc06b3c Create a valid jar in KaptIncrementalWithIsolatingApt test 2020-07-18 05:06:16 +09:00
Ivan Gavrilovic
77ba9a1bbb KT-34604: Fix race condition in KAPT
KAPT was relying on clearing JarFileFactory to make sure
annotation processing does not hold onto annotation processing
classpath once done. Once KAPT switched to using Gradle workers, multiple
KAPT runs were sharing the same class loader ie. the same version
of JarFileFactory. Clearing the cache resulted in race condition,
as some runs were unable to load processors from jars.

This commit fixes this problem by avoiding the use of ServiceLoader
which was causing the issue. Jars would be added to the cache, but
they would never be removed. That's why JarFileFactory had to be
clearned manually. By loading the processor names manually (simply
exploring the classpath), no file handles leak.

Fixes https://youtrack.jetbrains.com/issue/KT-34604
Test: verified against the test project from the bug
2020-07-18 05:06:15 +09:00
Ivan Gavrilovic
111a2ece72 KAPT: Fix error reporting
When incremental analysis is unable to run, handle
failure gracefully. More info will be provided by
compiler diagnostics.

Fixes KT-36302
2020-07-18 05:06:15 +09:00
Ivan Gavrilovic
11251a93ac KAPT: Fix serialization of class structure data
When serializing ClasspathEntryData, ids assigned to types were
incorrect, resulting in corrupt data when deserializing files. This
happened if there were dependencies between classes.

Fixes KT-39876
Test: ClasspathAnalyzerTest
2020-07-18 05:06:15 +09:00
Jim Sproch
ccbb2eaba9 Make linker visible to compiler plugins 2020-07-17 21:18:07 +03:00
Toshiaki Kameyama
80e4e7939d "Create abstract function" quick fix: don't suggest it if super classes are not writable
#KT-40215 Fixed
2020-07-17 19:35:02 +03:00
Vladimir Ilmov
0c832e30bf (CoroutineDebugger) Memory leak fixed on IDEA quit: 'org.jetbrains.kotlin.idea.debugger.coroutine.view.XCoroutineView
#KT-40386 fixed
2020-07-17 18:01:30 +02:00
Dmitriy Dolovov
6de848a15c [Commonizer] Introduce success marker file in Gradle task
The success marker file is written to the disk only upon successful
commonization. If something goes wrong, this file is not written to
the disk. So the subsequent call of 'runCommonizer' task will be
considered not up-to-date.

^KT-40120
2020-07-17 22:09:08 +07:00
Dmitriy Dolovov
178b5db8de [Commonizer] More precise up-to-date checks in Gradle task
Don't annotate the whole 'distributionDir' with @InputDirectory.
The contents of the distribution directory may grow over time due to
compilation cache and new commonized libraries.

Don't annotate 'baseDestinationDir' with @InputDirectory. The base
destination directory may contain numerous subdirectories with the
libraries produced for different combinations of commonized targets.
This means that the contents of the base directory will grow over time.

Use more precise directory up-to-dateness checks:
* Annotate the directory with the original common libraries
  (i.e. 'stdlib') as @InputDirectory.
* Annotate the directory with the original platform libraries
  (all targets altogether) as @InputDirectory.
* For each combination of commonized targets mark the list of the
  directories with resulting libraries as @OutputDirectories.

^KT-40120
2020-07-17 22:09:08 +07:00
Sergey Igushkin
d3f9f4f3e8 Fix stdlib-by-default failures when configuration has been resolved
Issue #KT-38221
2020-07-17 18:36:08 +04:00
Ilya Kirillov
dccac34282 J2K: do not run runUndoTransparentAction outside EDT
#KT-39739 fixed
2020-07-17 16:02:46 +03:00
Ilya Kirillov
d16f246375 Wizard: do not add stdlib for gradle based projects
#KT-40407 fixed
2020-07-17 16:02:44 +03:00
Ilya Kirillov
d2113766e1 Wizard: do not add NPM dependencies for Kotlin/JS wrappers
Those dependencies are included now into corresponding libraries

#KT-40377 fixed
2020-07-17 16:02:42 +03:00
Ilya Kirillov
9f5dd59d75 Wizard: do not add test task for JS when no test framework is chosen
#KT-40378 fixed
2020-07-17 16:02:40 +03:00
Ilya Kirillov
0208fad057 Wizard: do not allow to choose Frontend Application template & JS Library at the same time
#KT-40371 fixed
2020-07-17 16:02:39 +03:00
Ilya Kirillov
fdc06b2c1c Wizard: fix Android SDK path on Windows
#KT-40232 fixed
2020-07-17 16:02:38 +03:00
Pavel Kirpichenkov
a153e7fe30 Changes after review
#KT-37219
2020-07-17 15:27:37 +03:00
Mikhail Zarechenskiy
10bd3a11b8 Improve message about compatibility warning a bit
Relates to #KT-40111
2020-07-17 14:27:20 +03:00
Mikhail Zarechenskiy
fcf7a55ccc Fix delegated property resolve on number literals and proper types
There is no need to update type of delegate expression if it's already
 resolved correctly (doesn't include non-proper types). In almost all
 cases it was fine except number literals as there we didn't box
 expression in backend and got problems at bytecode verification stage

 #KT-40057 Fixed
2020-07-17 14:27:20 +03:00
Yunir Salimzyanov
e5bca3ce29 Enable execution of muted on database tests marked as FLAKY (KTI-288)
It became possible to do, because all the muted flaky tests are now
synchronized with TeamCity and muted there too
2020-07-17 14:01:23 +03:00
Alexander Dudinsky
27e7116f60 Added the gradle plugin SNAPSHOT version support for some tests.
`ImportAndCheckNavigation` and `GradleMultiplatformHighlightingTest` now
use the SNAPSHOT version of the gradle plugin also.
2020-07-17 13:55:25 +03:00
Mikhail Glukhikh
80022cccd9 [FIR] Introduce & use processOverriddenPropertiesWithDepth 2020-07-17 12:46:02 +03:00
Jinseong Jeon
13ef97e51e FIR2IR: set proper visibility of backing fields with @JvmField 2020-07-17 12:42:11 +03:00
Jinseong Jeon
f3475fd098 FIR2IR: store and convert annotations on enum entry 2020-07-17 09:48:45 +03:00
Vladimir Dolzhenko
a1ffc0b25a Handle standalone gradle scripts before (build|settnings|init).gradle.kts
#KT-39916 Fixed
2020-07-17 05:36:02 +00:00
Mikhail Zarechenskiy
a6e58edfb9 Update test data, unmute test
Now behavior is the same as in OI for these cases.
 The behavior was changed in 100a6f70ca
2020-07-17 07:47:15 +03:00
Abduqodiri Qurbonzoda
a05681001f Mark with @DeprecatedSinceKotlin #KT-22423 and #KT-28753 2020-07-17 02:39:20 +03:00
Ilya Gorbunov
87cb6372a0 Specify DeprecatedSinceKotlin for recently deprecated min/max funs
#KT-38854
2020-07-16 22:58:25 +03:00
Ilya Gorbunov
a9f4479557 Add stdlib-gen DSL support for DeprecatedSinceKotlin annotation 2020-07-16 22:58:25 +03:00
Vladimir Dolzhenko
5eb0242941 Add missed application component PluginStartupComponent for AS40
Relates to #KTI-299
2020-07-16 21:01:26 +02:00
Shagen Ogandzhanian
fa1e3169df Update dukat dependency to 0.5.7 2020-07-16 18:19:36 +02:00
Mikhail Glukhikh
026a6ffab2 FirUpperBoundViolatedChecker: code cleanup 2020-07-16 19:09:33 +03:00
Nick
1ea5678932 [FIR] UPPER_BOUND_VIOLATED optimizations 2020-07-16 19:04:29 +03:00
Nick
41a0cfe002 [FIR] Add diagnostic UPPER_BOUND_VIOLATED 2020-07-16 19:04:22 +03:00
Toshiaki Kameyama
b9a220c624 AddSuspendModifierFix: suggest in inline lambda
#KT-38139 Fixed
2020-07-16 18:49:29 +03:00
Vyacheslav Karpukhin
982f429d6b Moved the IdeaDefaultIdeTargetPlatformKindProvider declaration from jps.xml back to jvm-common.xml 2020-07-16 16:38:56 +02:00
Igor Chevdar
3c4f0d3c9e [box-tests] Added test 2020-07-16 19:23:03 +05:00
Igor Chevdar
8bbbee8ffd [IR] Supported IrFunctionExpression in ClosureAnnotator
It may be encountered during local classes extraction from inline lambdas
2020-07-16 19:23:02 +05:00
Alexander Udalov
c9fdef8233 IR: use buildField where possible 2020-07-16 16:09:31 +02:00
Alexander Udalov
2d723f1c51 IR: use buildClass where possible 2020-07-16 16:09:31 +02:00
Alexander Udalov
5b1193407a IR: use buildConstructor where possible 2020-07-16 16:09:31 +02:00
Alexander Udalov
6aa09f61d4 IR: use buildFun where possible 2020-07-16 16:09:30 +02:00
Alexander Udalov
39e38c7049 IR: introduce buildVariable, use where possible 2020-07-16 16:09:30 +02:00
Alexander Udalov
c3560e5854 IR: use buildTypeParameter, minor cleanup 2020-07-16 16:09:30 +02:00
Alexander Udalov
4b5464c6cc IR: introduce buildReceiverParameter, use where possible 2020-07-16 16:09:30 +02:00
Alexander Udalov
b36a6114aa IR: use buildValueParameter where possible 2020-07-16 16:09:29 +02:00
Vladimir Ilmov
378d0a757a DebuggerClassNameProvider refactoring 2020-07-16 16:05:01 +02:00
Alexander Dudinsky
f6a16c5203 Move some tests from common mute database to platforms specific 2020-07-16 15:43:01 +03:00
Victor Petukhov
e754585e38 NI: add fallback strategy to get lexical scope to checking coroutine call legality
^KT-40247 Fixed
^KT-40337 Fixed
2020-07-16 15:33:27 +03:00
Vladimir Dolzhenko
5951e7500a Register KOTLIN_BUNDLED via application component in 193
#KTI-299 Fixed
2020-07-16 12:32:52 +00:00
Vladimir Dolzhenko
345528d8f5 Use public api to register KOTLIN_BUNDLED macros
Relates to #KT-39968
2020-07-16 12:32:51 +00:00
vladislavf7@gmail.com
ab2128f55d [FIR] extended checkers infrastructure refactoring
Removed strange way to enable Extended Checkers and add new way to do it
2020-07-16 15:11:32 +03:00
vladislavf7@gmail.com
38543ce2a3 [FIR] add way to configure session in Diagnostic Tests 2020-07-16 15:11:32 +03:00
Svyatoslav Kuzmich
609f0ca9bc [JS IR] .d.ts generation for module systems
Support .d.ts generation for UMD, AMD, CommonJS module kinds in
addition to existing "plain" module kind.
2020-07-16 14:02:06 +03:00
nataliya.valtman
ee23e39b3c KT-37720 replace FileSystemLocation with File for TransformAction 2020-07-16 13:39:55 +03:00
Yunir Salimzyanov
63ba883a77 Refactoring of muteWithDatabase
- remove unused function RunNotifier.withMuteFailureListener
- inline some functions (isIgnoredInDatabaseWithLog, etc.)
- change declaration of mutedMessage
- change naming of AutoMute related functions
- extract to separate function isPresentedInDatabaseWithoutFailMarker
2020-07-16 13:16:41 +03:00
Roman Golyshev
fb9b3f96de KT-40301 Add more diagnostics for 'Module is not contained in resolver'
- See [EA-214260](https://ea.jetbrains.com/browser/ea_problems/214260)
2020-07-16 10:14:22 +00:00
Roman Golyshev
8fd16f4a39 Add contract to checkWithAttachment
- This way it is more convenient to use with null checks
2020-07-16 10:14:21 +00:00
Ilya Muradyan
0ff45f1cc4 Merge pull request #3544 from JetBrains/rr/ileasile/scopes-resolver-option
Add dependency scopes option for scripting (Ivy and Maven) resolvers
2020-07-16 13:03:01 +03:00
Vyacheslav Gerasimov
628efcb189 Build: Add kotlin.build.dependencies.iu.enabled property
Alias for intellijUltimateEnabled
2020-07-16 13:00:25 +03:00
Vyacheslav Gerasimov
996e529944 Build: Allow intellijUltimateEnabled without kotlin-ultimate directory
This allows to build against idea ultimate locally
2020-07-16 13:00:24 +03:00
Vyacheslav Gerasimov
34c1316ae0 Build: Enable local build cache with org.gradle.caching=true 2020-07-16 13:00:24 +03:00
Vyacheslav Gerasimov
2e7cb2b829 Build: Enable parallel builds with org.gradle.parallel=true 2020-07-16 13:00:24 +03:00
Jinseong Jeon
50f1f8f0eb FIR: consider more functional types during SAM resolution 2020-07-16 12:56:18 +03:00
Jinseong Jeon
d66c6c7e1e FIR serializer: transform KSuspendFunction types too 2020-07-16 12:56:18 +03:00
Ivan Kylchik
85e822e283 [FIR] Support smartcast after reference equality check
#KT-39000 Fixed
2020-07-16 12:43:55 +03:00
vladislavf7@gmail.com
63f7e95c89 [FIR] Add RedundantExplicitTypeChecker 2020-07-16 12:39:13 +03:00
Yunir Salimzyanov
3c798502c8 Synchronize muted TeamCity tests with database for .bunch configurations 2020-07-16 11:04:59 +03:00
Jinseong Jeon
c7a37eb6b2 FIR deserializer: load annotations on extension receiver parameters 2020-07-16 10:42:51 +03:00
Dmitriy Dolovov
02f08b16d6 [Commonizer] Ignore CallableDescriptor.hasSynthesizedParameterNames attribute 2020-07-16 14:26:37 +07:00
Mikhail Zarechenskiy
100a6f70ca Relax rules about inferring to Nothing for special calls
#KT-37388 Fixed
 #KT-38427 Fixed
 #KT-39953 Fixed
 #KT-38899 Fixed
2020-07-16 09:56:46 +03:00
Anton Bannykh
e45cd02b01 KLIB: add EmptyPackageFragment's to fix ModuleDescritor.getSubPackagesOf 2020-07-15 20:42:23 +03:00
Abduqodiri Qurbonzoda
d2c9fc41f1 Replace @LowPriorityInOverloadResolution with @DeprecatedSinceKotlin #KT-37101 2020-07-15 20:36:57 +03:00
Abduqodiri Qurbonzoda
4ac1b7748a Advance bootstrap to 1.4.20-dev-2133 2020-07-15 20:36:56 +03:00
Roman Artemev
cd9f59325e [KLIB] Fix deserialization of anonymous classes
In case of initializing property or function with anonymous object the
object is being exposed outside its field/function's scope and
accessible on previous level. In this case in `declarations only` mode
we have unbound symbols. Fix is to force body/initializer loading in
such cases.

Make sure it is deserialized in `declarations'only` mode too.

 - Fix KT-40216
 - Add test
2020-07-15 18:23:29 +03:00
Roman Artemev
d31de6c8de [Psi2IR] Improve assertion message 2020-07-15 18:23:28 +03:00
Alexander Dudinsky
d89083cd8c Fixup the tests vs master-gradle-plugin
Defined 4.0 and 1.3.0 as default versions of Gradle and plugin for PluginTargetVersions
Use `{{kotlin_plugin_repositories}}` template in testData of ImportTests
Update "mute" databases for new tests

Add `kotlin.stdlib.default.dependency=false` to some testData
2020-07-15 17:10:36 +03:00
Andrey Uskov
005314ce06 Support running import tests on bootstrap version of gradle plugin 2020-07-15 17:09:36 +03:00
Victor Petukhov
b0c96a61ec Don't try to infer postponed variables on lambdas without BuilderInference annotation
^KT-39618 Fixed
2020-07-15 16:19:43 +03:00
nataliya.valtman
9e737156dd KT-37720 Replace ArtifactTransform with TransformAction 2020-07-15 15:57:54 +03:00
Andrei Klunnyi
b9585dabd4 KT-32368 Rework Inline hints settings // fix QuickFixTestGenerated$AutoImports.testKt17525 2020-07-15 13:25:00 +02:00
Andrei Klunnyi
1639cadbb7 KT-32368 Rework Inline hints settings // remove non-existent ReturnHintLinePainter 2020-07-15 13:00:16 +02:00
Jinseong Jeon
30b91b128a FIR: adjust type of integer operator call as property initializer 2020-07-15 13:56:40 +03:00
Mikhail Glukhikh
ddd26de139 FirTypeIntersectionScope: extract 'createIntersectionOverride' 2020-07-15 13:36:31 +03:00
Mikhail Glukhikh
9934f7d56e [FIR TEST] Add test for KT-40327 2020-07-15 13:36:31 +03:00
Mikhail Glukhikh
92d40c27e2 FirBasedSignatureComposer: build signature even for private classes
FIR2IR assumes that we can build signature for any non-local class.
Later we can drop this assumption.
2020-07-15 13:36:31 +03:00
Mikhail Glukhikh
07b0ffef84 [FIR] Introduce & use remapArgumentsWithVararg 2020-07-15 13:36:30 +03:00
Jinseong Jeon
5c4f978073 FIR: transform arrayOf call with empty arguments 2020-07-15 13:36:30 +03:00
Jinseong Jeon
db9d42c153 IrConstTransformer: handle vararg with spread elements properly 2020-07-15 13:36:30 +03:00
Jinseong Jeon
5600eefea5 FIR: add support for varargs in annotation calls 2020-07-15 13:36:30 +03:00
Jinseong Jeon
4e6bd33eca FIR: create argument mapping for annotation call in general 2020-07-15 13:36:30 +03:00
Jinseong Jeon
1a861b2df9 FIR2IR: don't create synthetic class for enum entry w/o members 2020-07-15 13:36:30 +03:00
Juan Chen
2ea3579281 [FIR] add support for generic cases of delegation by implementation
Add type parameters for generic delegated members and type
substitution when implementing instantiated super interfaces.
2020-07-15 13:36:29 +03:00
Mikhail Glukhikh
93632d2a18 FIR declaration transformer: unwrap synthetic property accessor properly 2020-07-15 13:36:29 +03:00
Mikhail Glukhikh
031f03a903 Introduce FirDeclarationOrigin.INTERSECTION_OVERRIDE 2020-07-15 13:36:29 +03:00
Mikhail Glukhikh
9107944b05 FirSyntheticProperty: take returnTypeRef directly from delegate 2020-07-15 13:36:29 +03:00
Mikhail Glukhikh
e2678149cb FirClassSubstitutionScope: fix overridden symbols traversing 2020-07-15 13:36:29 +03:00
Mikhail Glukhikh
10a1d5c03b FirTypeIntersectionScope: add intersection overrides caching 2020-07-15 13:36:28 +03:00
Mikhail Glukhikh
c1d223dbde FirTypeIntersectionScope: enhance support of inherited default parameters 2020-07-15 13:36:28 +03:00
Mikhail Glukhikh
c46fac3464 FirTypeIntersectionScope: support inherited default parameters 2020-07-15 13:36:28 +03:00
Mikhail Glukhikh
7a2ea49399 FirTypeIntersectionScope: introduce "intersection" fake overrides 2020-07-15 13:36:28 +03:00
Mikhail Glukhikh
5a422b5ef6 FirTypeIntersectionScope: optimize/cleanup processOverriddenFunctions 2020-07-15 13:36:28 +03:00
Mikhail Glukhikh
1bbed6c4ed [FIR2IR] Use FIR-specific methods to search for overridden functions 2020-07-15 13:36:28 +03:00
Mikhail Glukhikh
59cc9d4bc6 [FIR] Introduce FirTypeScope.processOverriddenFunctionWithDepth 2020-07-15 13:36:28 +03:00
Mikhail Glukhikh
8a29021aad [FIR2IR] Make data class synthetic members public API 2020-07-15 13:36:27 +03:00
Mikhail Glukhikh
521901f09a [FIR2IR] Cache type parameters for existing IR classes properly
Before this commit, we just recreated class header
for external IR class found by signature. However, it's not required,
because super-types, type parameters, etc. are already initialized.
So now we just read type parameters and build cache for them.
2020-07-15 13:36:27 +03:00
Victor Petukhov
d2f5fbdd08 Fix failing on AS test with inserting -Xinline-classes to build script 2020-07-15 13:35:16 +03:00
Kirill Shmakov
c8b3e622f1 Fix typo in field name 2020-07-15 10:52:42 +03:00
vladislavf7@gmail.com
d96772444e [FIR] Fix redundant visibility checker 2020-07-15 09:42:30 +03:00
Dmitry Savvinov
9b8128aaa8 Coerce commonTest to common in HMPP
Otherwise, Android import won't add dependency from androidTest to
commoonTest. See KT-38744 for details

^KT-38744 Fixed
2020-07-15 11:18:34 +07:00
Ilya Muradyan
1ac9b4c38f Add dependency scopes option for scripting resolvers 2020-07-14 23:42:00 +03:00
Vyacheslav Gerasimov
742b98bed6 Build: Fix stdlib-js-ir commonMainSources task dependency on version 2020-07-14 20:29:11 +03:00
vladislavf7@gmail.com
fb5fb44993 [FIR] Add RedundantModalityModifierChecker 2020-07-14 19:56:41 +03:00
Vyacheslav Gerasimov
e7c88a4349 Build: Add KotlinVersionCurrentValue to runtime classpath normalization
To avoid cache misses between local and remote build
2020-07-14 17:51:45 +03:00
Vyacheslav Gerasimov
e215d94b7b Build: Fix JavaExec task configuration
Setting some properties is not allowed in doFirst anymore in Gradle 6.5
2020-07-14 17:51:45 +03:00
Victor Petukhov
bf23b39d76 Add using -Xinline-classes by default in IDE intentions
^KT-34209 Fixed
2020-07-14 17:43:44 +03:00
Pavel Kirpichenkov
79d7babb57 Add test checking file annotations resolution
#KT-37219 Fixed
2020-07-14 17:07:42 +03:00
Nikolay Krasko
36a46482c5 Unmute IdeReplCompletionTestGenerated.testDefinedExtension in 202
Lost this line from 16c5ba0988
 during the mute-platform.csv.202 creation.
2020-07-14 17:05:30 +03:00
Natalia Selezneva
5954fe528b gradle.kts: do not return ErrorScriptDefinition into GradleBuildRootManager
In this case script definition is saved into script info,
but only real script definitions should be cached
In case of null script configurations will be reloaded into cache when scriptdefinitions will be ready

^KT-39910 Fixed
2020-07-14 15:30:21 +03:00
Natalia Selezneva
3e3f8aeb93 Mark importing as complete in case of some unexpected behavior
For example in case when script contains some errors gradleHome might be null
Then build root should be marked as updated
Also notification should be updated
2020-07-14 15:30:20 +03:00
Ilya Goncharov
2c67ab924f [Gradle, JS] this globalObject in webpack
^KT-40159 fixed
2020-07-14 14:42:26 +03:00
Andrei Klunnyi
93a82060d4 KT-39788 MPP, Gradle runner: Run does not add resource directory to classpath // gradle runner support
Before this commit "delegate to Gradle" option was not taken into
consideration. Was it MPP or SPP, KotlinRunConfiguration was always
executed by platform runner (as a default one). The reason behind this
was that there was no dedicated class (extension point) responsible for
Gradle-Kotlin pair. Now its KotlinGradleAppEnvProvider.
2020-07-14 11:24:59 +00:00
Andrei Klunnyi
681c2e9492 KT-39788 MPP, Gradle runner: Run does not add resource directory to classpath // classpath fix
The reason of resource directory absence was that it couldn't be loaded
from the project configuration file. Just after the import it remained
in the memory and runner couldn' get it. KotlinOutputPathsDataService as
a pair to KotlinOutputPaths is what was missing. Details are provided
below.
------------------------------------------------------------------------
On a disk configuration represents a binary file containing serialized
graph of external project structure. It contains nodes belonging to both
IDEA and its plugins.

To deserialize a node IDEA tries to load its class using a chain of
class-loaders: its own and those provided by actual set of plugins.
The nuance is how to get plugins' ones. The approach is the following.
There is an association between a node's payload and a service which is
supposed to consume it see KotlinOutputPathsDataService#getTargetDataKey
and DataNode#getKey). Plugin services are guaranteed to be loaded by
plugin class loader.
No association - service - no plugin, node was just skipped.
------------------------------------------------------------------------
2020-07-14 11:24:58 +00:00
Ilya Muradyan
07b566dd02 Add @JvmDefault for getPossibleSyntheticNestedClassNames 2020-07-14 14:17:58 +03:00
Zalim Bashorov
340512e27a [KJS] Throw exception on recursive types provided to typeOf and provide proper support later within KT-40173
#KT-38140 fixed
2020-07-14 14:14:13 +03:00
Zalim Bashorov
c552933459 [Test infra] Take into account transitive compatible targets while checking compatibility. 2020-07-14 14:14:12 +03:00
Zalim Bashorov
ca37c6bfe6 [KJS FE] Allow using typeOf with non-reified type parameters
#KT-38771 fixed
2020-07-14 14:14:11 +03:00
Ilya Goncharov
9d362875da [Gradle, JS] Fail build in case when mpp or js targets not configured
^KT-40210 fixed
^KT-40300 fixed
2020-07-14 13:59:00 +03:00
Sergey Igushkin
62aed1b53a Add kotlin.stdlib.default.dependency=false to avoid stdlib default dep 2020-07-14 14:47:40 +04:00
Sergey Igushkin
ad9d011ed0 Fix stdlib default dependencies with Android
* In Android test-related source sets, add an implementation dependency,
  not an api one, because adding dependencies to the api configurations
  leads to warnings from AGP

* Add the default stdlib dependency only to the Android main source set,
  as duplicating it elsewhere leads to issue with publishing the project
  with the `maven` plugin (duplicate conf2ScopeMappings)
2020-07-14 14:47:16 +04:00
Sergey Igushkin
d83d3304a5 KT-38221: Stdlib by default; KT-40225 Single dependency on kotlin-test
* Add a DSL property `kotlin.coreLibrariesVersion` that is used as the
  default version for all org.jetbrains.kotlin dependencies instead of
  the plugin version used previously – the pluging version is the
  default now.

* Support omitting the `kotlin-stdlib-*` dependencies in all kinds of
  projects. For the JVM source sets, choose the stdlib module by
  checking the jvmTarget in the compilations – if all compilations
  target 8+ then use `kotlin-stdlib-jdk8`.

* Support adding a single dependency on the fake module
  `kotlin-test-multiplatform` that is later expanded into the
  appropriate dependencies on `kotlin-test-*` modules. For JVM source
  sets, detect the test framework by inspecting the test tasks.

* (minor) Fix _executionSource not updated in KotlinJvmTestRun

* (minor) Lazily query `kotlinUsageContext`'s dependency-related
  properties to avoid freezing the configurations

Issue #KT-38221 Fixed
Issue #KT-40225 Fixed
2020-07-14 14:47:13 +04:00
Ilya Goncharov
49c8d99f61 [Gradle, JS] Resolution of compilation's configurations inside NPM conf
^KT-40201 fixed
2020-07-14 13:13:45 +03:00
Ilya Goncharov
40311dbe05 [Gradle, JS] Fix test on public package json with dependencies
^KT-40201 fixed
2020-07-14 13:13:35 +03:00
Ilya Goncharov
c5f89ebc0d [Gradle, JS] Add dev dependencies into public package json
^KT-40201 fixed
2020-07-14 13:13:18 +03:00
Mikhail Zarechenskiy
bb23556ead Don't perform Unit-conversion for functional types with type variables
#KT-40269 Fixed
2020-07-14 13:05:28 +03:00
Mikhail Zarechenskiy
09b44b3189 Fix rewrite at slice exception for callable references inside flatMap
#KT-40254 Fixed
2020-07-14 13:05:28 +03:00
Andrei Klunnyi
1e4c554bcd KT-32368 Rework Inline hints settings // compatibility with earlier IDEA versions 2020-07-14 10:03:51 +00:00
Andrei Klunnyi
604e270a73 KT-32368 Rework Inline hints settings // preview text 2020-07-14 10:03:50 +00:00
Andrei Klunnyi
7a69cf587e KT-32368 Rework Inline hints settings // HintType cleanup 2020-07-14 10:03:50 +00:00
Andrei Klunnyi
d6692a8062 KT-32368 Rework Inline hints settings // flattern parameter name hints menu 2020-07-14 10:03:49 +00:00
Andrei Klunnyi
be0cde1d70 KT-32368 Rework Inline hints settings // remove suspending call hints
Suspending call hints were removed according to KT-30928 and KT-39271.
2020-07-14 10:03:48 +00:00
Andrei Klunnyi
49d4f55c87 KT-32368 Rework Inline hints settings // special case for lambda hints
Lambda hints are placed at the end of a line in such a way that user
can't move the caret behind it. Unfortunately, hint provision
infrastructure doesn't take this detail into account.
As a workaround, KotlinLambdasHintsProvider now returns an empty result
(sink) to the outer infrastructure and accesses editor's inlay model
itself.
2020-07-14 10:03:48 +00:00
Andrei Klunnyi
d1722e3975 KT-32368 Rework Inline hints settings // migrate tests for types
KotlinReferencesTypeHintsProvider which in now responsible for
type hints is not compatible with the existing
InlayTypeHintsTest. Because of that tests were migrated to the new
infrastructure.
2020-07-14 10:03:47 +00:00
Andrei Klunnyi
36f3431559 KT-32368 Rework Inline hints settings // migrate tests for suspending calls
KotlinSuspendingCallHintsProvider which in now responsible for
suspending call hints is not compatible with the existing
SuspendingCallHintsTest. Because of that tests were migrated to the new
infrastructure.
2020-07-14 10:03:47 +00:00
Andrei Klunnyi
b0dece756a KT-32368 Rework Inline hints settings // migrate tests for lambdas
KotlinLambdasHintsProvider which in now responsible for lambda related
hints is not compatible with the existing LambdaReturnValueHintsTest.
Because of that tests were migrated to the new infrastructure.
2020-07-14 10:03:46 +00:00
Andrei Klunnyi
5fe1eaea17 KT-32368 Rework Inline hints settings // remove outdated KotlinCodeHintsPass
Some time ago platform couldn't place hints at the end of a line.
This is how KotlinCodeHintsPass appeared. Class was responsible for
lambda related hints. Now that platform evolved functionality was moved
to KotlinLambdasHintsProvider.
2020-07-14 10:03:45 +00:00
Andrei Klunnyi
533507de25 KT-32368 Rework Inline hints settings // split KotlinInlayParameterHintsProvider
Platform supports 2 interfaces for inlay hints providers:
- InlayParameterHintsProvider [1]
- InlayHintsProvider [2]

KotlinInlayParameterHintsProvider as an implementation of (1) and a
source of "Inlay Hints" menu has the following limitations:
- Platform treats component as a source of "Parameter hints" submenu
that cannot be split. Once can only add or remove its nested checkboxes.
- Only a single instance of (1) can be defined.

To have a separate menu items for "Inlay Hints" existing
KotlinInlayParameterHintsProvider was split. New providers
implementing (2) were extracted from it:
- KotlinReferencesTypeHintsProvider
- KotlinSuspendingCallHintsProvider
- KotlinLambdasHintsProvider

TODO: HintType move as a separate commit
2020-07-14 10:03:45 +00:00
Sergey Igushkin
5ec93fd74c Fixup for the fix of KT-39809
In the original fix for KT-39809, the Kapt plugin was not given a proper
empty implementation stub: it was added to `Kapt3GradleSubplugin`, while
originally the Kapt subplugin's META-INF/services entry pointed to
`Kapt3KotlinGradleSubplugin`.

This commit makes the correct class implement the legacy interface.

Issue #KT-39809 Fixed
2020-07-14 13:09:26 +04:00
Sergey Igushkin
4c273e1fc5 Fix resolving dependency on self in HMPP (KT-39037)
Apply a workaround for grade/gradle#13680

Issue #KT-39037 Fixed
2020-07-14 13:09:24 +04:00
Sergey Igushkin
aebca19fd7 Fix resolving an MPP dependency in custom configurations (KT-32239)
In the `KotlinPlatformType` disambiguation rule, don't prefer `common`
when there's a `jvm` or an `androidJvm` variant, as this would conflict
with disambiguation rules created by the other plugins, such as Gradle's
`java` which will choose `org.gradle.usage=java-api` and lead to
ambiguity.

Issue #KT-32239 Fixed
2020-07-14 13:09:22 +04:00
Mikhail Zarechenskiy
8158ba2be3 Add tests for obsolete issues
#KT-32183 Obsolete
 #KT-31474 Obsolete
 #KT-31853 Obsolete
2020-07-14 11:23:57 +03:00
Ilya Matveev
19dc3f071c Gradle, native: Enable assertions for in process compiler execution
Issue #KT-39764 fixed
2020-07-14 08:18:00 +00:00
vladislavf7@gmail.com
275ce16faa [FIR] add RedundantReturnUnitTypeChecker 2020-07-14 10:05:28 +03:00
Dmitry Savvinov
5c88b1e80a Allow depending on Native stdlib even if platforms do not match under HMPP
^KT-40102
2020-07-14 12:49:59 +07:00
Dmitry Savvinov
21026001db Add logging into ideaModelDependencies 2020-07-14 12:49:59 +07:00
Ilya Gorbunov
010e530ac4 Make common KClass extend common KClassifier
It already does that in all platforms.
Add KClass common API test.
2020-07-13 23:20:52 +03:00
Florian Kistner
1878ae8222 Don't apply copyright notice to Kotlin Ultimate
* Previous attempt apparently no longer effective
* Cover a few additional strangling files
2020-07-13 19:42:04 +02:00
Florian Kistner
ce39b75cc8 Don't apply copyright notice to Kotlin Ultimate
* Previous attempt apparently no longer effective
2020-07-13 19:37:38 +02:00
Ilya Goncharov
bbb3032e1c [Gradle, JS] Rename package-candidate.json to pre-package.json
^KT-39515 fixed
2020-07-13 19:32:29 +03:00
Ilya Goncharov
6a0315fe7a [Gradle, JS] force write package json in all cases
^KT-39515 fixed
2020-07-13 19:32:29 +03:00
Ilya Goncharov
b4a774e821 [Gradle, JS] Use package.json candidate
^KT-39515 fixed
2020-07-13 19:32:29 +03:00
Ilya Goncharov
8586d5e206 [Gradle, JS] Small refactoring of yarn imported
^KT-39515 fixed
2020-07-13 19:32:28 +03:00
Konstantin Tskhovrebov
cfd91023be Add native targets check to "isAllowCommonizer" method.
#KT-40164 Fixed.
2020-07-13 19:31:08 +03:00
Ilya Goncharov
797449f7e4 [Gradle, JS] Add TC client on TC output handler for browser run task
^KT-40178 fixed
2020-07-13 19:25:04 +03:00
Nikolay Krasko
943d012875 Fix comparison for SdkAndMockLibraryProjectDescriptor
There's no known problems connected with this change, but wrong
comparison might cause tests flakiness.

`allowKotlinPackage` and `classpath` fields were not included.
2020-07-13 17:58:04 +03:00
Nikolay Krasko
0db7806dec Use test classpath for annotations.jar search
Got unstable behaviour in 202 test because of setting
idea.home.path during the compiler execution.
2020-07-13 17:58:03 +03:00
Yaroslav Chernyshev
07e3dd9ec7 [Gradle, Cocoapods] Fixed bug in scheme name for pods 2020-07-13 16:37:37 +03:00
Nick
67e58ff152 [FIR] Fix redundant calls to firEffectiveVisibility() 2020-07-13 16:30:47 +03:00
Alexander Udalov
5340cf5567 Add property kotlin.build.useIR to enable JVM IR in Kotlin build
Right now this is only supposed to be turned on locally (`./gradlew
-Pkotlin.build.useIR=true ...`), to be able to quickly try how JVM
IR-compiled Kotlin compiler works.
2020-07-13 14:38:22 +02:00
Alexander Udalov
9c36c74357 Build: do not pass JVM compiler arguments to common KotlinCompile 2020-07-13 14:38:22 +02:00
Kristoffer Andersen
8d79a6ae03 [JVM IR] Copy inline class constructor annotations 2020-07-13 11:50:34 +03:00
Mikhail Zarechenskiy
678b76cab1 Fix presence of Deprecated hidden annotation for reference arguments
#KT-40234 Fixed
2020-07-13 11:23:28 +03:00
Ilya Matveev
c2e0cd60d7 Gradle tests: Temporary disable NativePlatformLibsIT for Windows
This test causes a build timeouts on CI which cannot be reproduced
locally. So we disable them to not block the testing process until
a proper fix is found.
2020-07-13 07:48:35 +00:00
Dmitry Savvinov
3ef760604b Force expansion to have the same nullability as abbreviation
Note that classifier.underlyingType is always non-nullable, but
abbreviation might be nullable, so we should keep them consistent

^KT-40199 Fixed
2020-07-13 11:50:10 +07:00
Dmitry Savvinov
8890ae10d4 Add test on signatures with nullable abbreviated types
Currently test fails, see KT-40199
2020-07-13 11:50:10 +07:00
Natalia Selezneva
e0bc54cd82 gradle.kts: update notification messages after proofreading 2020-07-12 22:37:45 +03:00
Mikhail Glukhikh
8005df42fb [FIR] Make redundant visibility modifier a warning 2020-07-11 10:45:33 +03:00
Mikhail Glukhikh
5276903bea Fix code style: DeclarationCheckersDiagnosticComponent 2020-07-11 10:45:33 +03:00
Mikhail Glukhikh
aee49c3fde [FIR TEST] Add forgotten txt-file for redundant visibility checker test 2020-07-11 10:45:32 +03:00
vladislavf7@gmail.com
be684c784f [FIR] Introduce extended checkers for inspection-like diagnostics 2020-07-11 10:45:32 +03:00
vladislavf7@gmail.com
4643d483a0 [FIR] Introduce RedundantVisibilityModifierChecker 2020-07-11 10:45:10 +03:00
Ilya Muradyan
510ac66ce1 Fix tests generation after upgrading Gradle to 6.5 2020-07-10 22:07:10 +03:00
Ilya Gorbunov
dd47962ad0 Extract current Kotlin version value into a separate class
In order to selectively ignore it during classpath normalization,
and do not recompile all the dependencies when just the version value
changes.
2020-07-10 19:12:07 +03:00
Nikolay Krasko
cb513b9a70 202: Fix KotlinUastReferencesTest 2020-07-10 19:09:27 +03:00
Ilya Gorbunov
20683d62a6 Postpone introducing common StringBuilder.capacity() function
Its support complicates JS StringBuilder implementation with no actual
performance improvements. Benefits of having capacity() function
in common code are also not completely clear.

Relates to KT-33069
#KT-40168
2020-07-10 18:49:39 +03:00
Steven Schäfer
097e0fb46c JVM IR: Mangle delegated properties with inline class type (KT-40125) 2020-07-10 17:06:44 +02:00
Sergey Rostov
e48d2b9b83 ScriptTemplatesClassRootsIndex: inc version and minor fixes
Content was changed, so we should force reindex.

Minor changes:
- There is no need to save a string, we can just save nothing
 by using the Unit value (see UnitKey.save and UnitKey.read)
- Unit can be shared between all indexes, so we can extract UnitKey object
- It would be good to extract abstract class FileListIndex:
  - for better readability: separate the logic of the specific index from the common FileListIndex implementation
  - someone can use it also
- mapOf (Unit to null) will create singletonMap itself and more readable
- ScriptTemplatesClassRootsIndex.KEY perhaps better to call NAME
2020-07-10 18:01:38 +03:00
Sergey Rostov
1f52c0e0d4 gradle.kts: improve service initializtion
- prevent analyzing .gradle.kts files until all services are loaded
- remove services caches where it is not required
- replace cached services with cache only during vfs events batch processing
- prevent services loading in actions updating
2020-07-10 17:47:10 +03:00
Georgy Bronnikov
a97d718de8 IR: remove a KotlinType use from Ir.kt 2020-07-10 17:35:30 +03:00
Georgy Bronnikov
aab95f93f2 JVM_IR: invoke method descriptor for default lambdas 2020-07-10 17:35:29 +03:00
Alexander Udalov
e8c3c70369 IR: make IrDeclarationWithVisibility.visibility mutable
It was mutable anyway in many subclasses. This is needed in order to
avoid depending on concrete IR implementations in the JVM IR backend
where it's necessary to be able to change visibility.
2020-07-10 16:17:06 +02:00
Alexander Udalov
96f0a8e8e5 IR: minor, inline OverridableMember 2020-07-10 16:17:06 +02:00
Alexander Udalov
e674226a3b IR: do not use Ir*Impl elements where it's not necessary 2020-07-10 16:17:06 +02:00
Alexander Udalov
dbad81473e IR: make IrMetadataSourceOwner.metadata mutable
To avoid casting to specific Ir*Impl elements at call sites.

Also inherit from IrMetadataSourceOwner only where it's needed: class,
file, function, property. Previously this field was always null and took
some space for things like value parameters, type parameters, etc.
2020-07-10 16:17:05 +02:00
simon.ogorodnik
689887c94d [FIR] Fail test if no modules analyzed successfully 2020-07-10 16:25:22 +03:00
Victor Petukhov
cdb122c698 Add skipped ignore directive in test for b08c7eff38 2020-07-10 14:52:51 +03:00
Mikhail Zarechenskiy
0c8b847ae6 Introduce compiler key to disable compatibility resolution mechanism
Enable it if one was using new inferene before 1.4

 #KT-40128 Fixed
 #KT-40112 Fixed
 #KT-40113 Fixed
2020-07-10 14:23:45 +03:00
Mikhail Glukhikh
c1fd891916 [FIR IDE] Fix compilation in asKtSymbolOrigin 2020-07-10 13:02:31 +03:00
Ilya Goncharov
644c5a941b [Gradle, JS] Add task on webpack-compile sync
^KT-40087 fixed

[Gradle, JS] Use runCompileSync only for run

^KT-40087 fixed

[Gradle, JS] Rename type on mode

^KT-40087 fixed

[Gradle, JS] Use explicit names in lambda

^KT-40087 fixed
2020-07-10 12:32:07 +03:00
Anton Bannykh
939f0d0344 [IR] minor: make StageController an open class
This should make creating a new "do nothing" controller more straightforward.
2020-07-10 11:30:42 +03:00
Anton Bannykh
abc6ecaa1c [JS IR BE] support SAM conversions in DCE-driven mode 2020-07-10 11:30:42 +03:00
Anton Bannykh
8fcd73e3cb [JS IR BE] move exceptionState initialization from constructor to coroutine entryState
This fixes the DCE-driven mode. Before this fix the suspend lambda constructor was modified
by the `invoke` body lowering. Which is wrong, becuase the corresponding class was created
by the CallableReferenceLoiwering much earlier.
2020-07-10 11:30:41 +03:00
Anton Bannykh
916a5f367c [IR] simplify Carriers (remove type parameters) 2020-07-10 11:30:41 +03:00
Anton Bannykh
adf5ee394e [JS IR BE] remove unnecesary code from DCE 2020-07-10 11:30:41 +03:00
Victor Petukhov
514ac7dc8f NI: introduce simple calls storage (which aren't gone through type inference) in coroutine inference session to further substitute postponed variable
^KT-40151 Fixed
2020-07-10 11:11:48 +03:00
Kirill Shmakov
3acb4e54d5 Update AS version 2020-07-10 11:06:33 +03:00
Vladimir Ilmov
3e69250f72 (CoroutineDebugger) Restored frame variables isn't shown for 2020.1.
#KT-40172 fixed
2020-07-10 09:57:38 +02:00
Mikhail Glukhikh
fbbf4e06ba [FIR] Support imported callable from object properly #KT-35730 Fixed 2020-07-10 10:25:39 +03:00
Mikhail Glukhikh
6b964cb61d [FIR2IR] Drop explicit receiver double-conversion for objects 2020-07-10 08:56:58 +03:00
Ilya Gorbunov
2f3e1dcbc6 Add EXACTLY_ONCE contract to suspendCoroutine* functions
Update line numbers in the affected test.
2020-07-10 01:05:16 +03:00
Ilya Gorbunov
1a32fdf6d7 Add EXACTLY_ONCE contract to functions that call their lambda parameter once
KT-35972
2020-07-10 01:05:16 +03:00
Ilya Gorbunov
c85432b2f9 Fix typo in kotlinx.dom docs 2020-07-10 01:05:16 +03:00
Ivan Kylchik
c44fd235ce [FIR] Remove isEnumEntry field from FirJavaField
This field isn't used anymore because java enum entry is represented by
FirEnumEntry
2020-07-09 23:49:55 +03:00
Ivan Kylchik
dcae6f1415 [FIR] Support when exhaustiveness for java enum
The problem appear because for java enum its entries was represented by
FirJavaField. To fix this FirEnumEntry was used

#KT-39621 Fixed
2020-07-09 23:49:54 +03:00
Ivan Kylchik
307871a050 [FIR] Unmute fir spec tests
#KT-38397 Fixed
#KT-38334 Fixed
2020-07-09 23:49:39 +03:00
Alexander Udalov
0baa1c8723 IR: remove deprecated constructor of IrClassImpl 2020-07-09 18:51:04 +02:00
Alexander Udalov
e6993e1b88 IR: remove deprecated constructor of IrConstructorImpl 2020-07-09 18:51:04 +02:00
Alexander Udalov
ef94716af5 IR: remove deprecated constructor of IrFieldImpl 2020-07-09 18:51:04 +02:00
Alexander Udalov
7f9ef5e11d IR: remove deprecated constructors of IrFunctionImpl 2020-07-09 18:51:04 +02:00
Alexander Udalov
551f1f85a9 IR: remove secondary constructor of IrModuleFragmentImpl 2020-07-09 18:51:03 +02:00
Alexander Udalov
19ec8646b8 IR: remove convenience factory for IrTypeAliasImpl 2020-07-09 18:51:03 +02:00
Alexander Udalov
fd83596c91 IR: remove deprecated constructor of IrTypeParameterImpl 2020-07-09 18:51:03 +02:00
Alexander Udalov
0691595ed2 IR: remove deprecated constructor of IrValueParameterImpl 2020-07-09 18:51:03 +02:00
Alexander Udalov
bba597cdff IR: remove deprecated constructors of IrVariableImpl 2020-07-09 18:51:02 +02:00
Alexander Udalov
d8a2b92098 IR: remove deprecated constructors of IrPropertyImpl 2020-07-09 18:51:02 +02:00
Vyacheslav Gerasimov
501fea1202 Fix TCServiceMessagesClient compilation against Gradle 6.5
Method `isRoot` doesn't exist anymore in TestDescriptorInternal
2020-07-09 19:31:21 +03:00
Vyacheslav Gerasimov
697bb04d46 Build: Setup jvmTarget 1.6 for several common modules
Some modules depending on them target jvm 1.6 and can't depend on
jvm 1.8 module in Gradle 6.5.
2020-07-09 19:31:20 +03:00
Vyacheslav Gerasimov
b5ee0e8222 Build: Remove jvmTarget 1.6 for several modules depending on 1.8 modules
Module targeting jvm 1.6 can't depend on jvm 8 one. In Gradle 6.5 this
behaviour is enforced by configuration error.
2020-07-09 19:31:20 +03:00
Vyacheslav Gerasimov
1fea01754d Build: Remove jvmTarget = "1.6" for kotlinx-metadata-klib
kotlinx-metadata-klib can't have jvmTarget 1.6 because it embeds module
:compiler:serialization which is compiled with jvmTarget 1.8. It is
enforced by configuration error in Gradle 6.5
2020-07-09 19:31:20 +03:00
Vyacheslav Gerasimov
508036742c Build: Upgrade Gradle to 6.5.1 2020-07-09 19:31:20 +03:00
Ilya Kirillov
39601f99ab Wizard: update ktor version
#KT-40037 fixed
2020-07-09 18:27:43 +03:00
Ilya Kirillov
44334fca11 Wizard: consider RC version as a EAP one
#KT-39871 fixed
2020-07-09 18:27:41 +03:00
Ilya Kirillov
9fde2ac269 Wizard: add kotlinx repo for projects using kotlinx-html
#KT-40004 fixed
2020-07-09 18:27:39 +03:00
Florian Kistner
346df07adc 203: Fix compilation for 203 2020-07-09 15:27:45 +02:00
Florian Kistner
4c4af9971e 203: Bump intellijSdk version for 203 2020-07-09 15:27:45 +02:00
Florian Kistner
202a55cb39 Bump intellijSdk version for 203 2020-07-09 15:27:45 +02:00
Dmitry Gridin
1c4d7c5772 Regenerate test data 2020-07-09 18:37:37 +07:00
Yan Zhulanow
81869b282b Mute failing QuickFixTestGenerated/KotlinSteppingTestGenerated 2020-07-09 19:23:16 +09:00
Ilya Muradyan
2487f9369c Fix REPL completion for import directives 2020-07-09 13:19:04 +03:00
Dmitriy Dolovov
16aee6c8d6 [Commonizer] Lookup descriptors that doesn't participate in commonization
^KT-40119
2020-07-09 16:44:33 +07:00
Dmitriy Dolovov
3af937ea9a [Commonizer] Remove isDefinitelyNotNullType from CirSimpleType 2020-07-09 16:44:32 +07:00
Nikolay Krasko
4d21455e72 Mute testImportAliasMultiDeclarations because of wrong behaviour in headless
Caused by: java.lang.AssertionError: Editor must be showing on the screen
	at com.intellij.ui.popup.AbstractPopup.showInBestPositionFor(AbstractPopup.java:546)
	at com.intellij.codeInsight.navigation.actions.GotoDeclarationOnlyHandler2.gotoDeclaration$intellij_platform_lang_impl(GotoDeclarationOnlyHandler2.kt:74)
	at com.intellij.codeInsight.navigation.actions.GotoDeclarationOrUsageHandler2.invoke(GotoDeclarationOrUsageHandler2.kt:63)
	at com.intellij.codeInsight.actions.CodeInsightAction.lambda$actionPerformedImpl$0(CodeInsightAction.java:57)
	at com.intellij.codeInsight.actions.CodeInsightAction.lambda$actionPerformedImpl$1(CodeInsightAction.java:63)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:220)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:177)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:158)
	at com.intellij.codeInsight.actions.CodeInsightAction.actionPerformedImpl(CodeInsightAction.java:54)
	at org.jetbrains.kotlin.idea.navigation.AbstractGotoActionTest.doTest(AbstractGotoActionTest.kt:27)
	at org.jetbrains.kotlin.test.KotlinTestUtils.lambda$testWithCustomIgnoreDirective$6(KotlinTestUtils.java:804)
	at org.jetbrains.kotlin.test.MuteWithFileKt$testWithMuteInFile$1.invoke(muteWithFile.kt:41)
	at org.jetbrains.kotlin.test.KotlinTestUtils.runTestImpl(KotlinTestUtils.java:774)
	at org.jetbrains.kotlin.test.KotlinTestUtils.runTest(KotlinTestUtils.java:716)
	at org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.runTest(GotoDeclarationTestGenerated.java:24)
	at org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.testImportAliasMultiDeclarations(GotoDeclarationTestGenerated.java:38)
2020-07-09 12:43:11 +03:00
Nikolay Krasko
593fd646b1 Add mute-platform.csv.202 2020-07-09 12:43:10 +03:00
Roman Artemev
ca44242f37 [IR] Fix synthetic declarations generator to make it produce correct type
- Fix KT-40126
 - Add test
2020-07-09 11:47:07 +03:00
Igor Chevdar
d8f5b50cd8 [native-gradle-plugin] Respected changed cache format 2020-07-09 12:33:59 +05:00
Igor Chevdar
79af726872 [native-gradle-plugin] Fixed problem with rebuilding caches 2020-07-09 12:33:59 +05:00
Anton Yalyshev
bc979a33f7 Enable FUS for Code Completion in 1.4.0 2020-07-09 10:20:18 +03:00
Dmitriy Dolovov
d3e858645f [Commonizer] Remove CirTypeSignature from CirType 2020-07-09 10:08:13 +07:00
Dmitriy Dolovov
4ab5bfef22 [Commonizer] Preserve order of supertypes in commonized class 2020-07-09 10:08:06 +07:00
Dmitriy Dolovov
5e383e9d71 [Commonizer] Narrow CirClassifierId subtype cast in AnnotationsCommonizer 2020-07-09 10:07:59 +07:00
Dmitriy Dolovov
7a283c64cb [Commonizer] Minor. Reorder type params for CirNode 2020-07-09 10:07:52 +07:00
Andrey Uskov
c37f339d8c Send use-ir and jvmDefaults compiler arguments from IDE
Relates to KT-39924 and KT-39977
2020-07-08 20:39:44 +03:00
Andrey Uskov
550c53c2ac Report jvm-default compiler arguments from Gradle
#KT-39977 Fixed
2020-07-08 20:39:33 +03:00
Andrey Uskov
e3a5df1aaa Report use-ir flag from Gradle
#KT-39924 Fixed
2020-07-08 20:39:14 +03:00
Leonid Startsev
340deb01dd Add 'Incorrect Transient' diagnostic
when users write @Transient, they get @kotlin.jvm.Transient, because it's always in auto-import.
This annotation does not work with @Serializable classes; @kotlinx.serialization.Transient should be used instead.

Add quickfix for 'incorrect transient' diagnostic:
'Import kotlinx.serialization.Transient'
2020-07-08 20:17:11 +03:00
Leonid Startsev
6ef597a4ee Split ContextualSerialization annotation in two 2020-07-08 20:15:56 +03:00
Natalia Selezneva
3d91c410e7 *.gradle.kts: include project sources in script dependencies sources scope
^KT-39523 Fixed
2020-07-08 18:30:02 +03:00
Natalia Selezneva
93d7015139 Remove old roots from KotlinScriptDependenciesCLassFinder
Otherwise it may produce an exception that some invalid roots are returned by ScriptClassRootsCache
2020-07-08 18:30:01 +03:00
Natalia Selezneva
8bb3c0796d Add original errors into the IllegalStateException from import of build script models
This exception is needed to finish gradle import and avoid importing other models into IDE
In most cases this exception is repoted together with Gradle exception from import,
but as soon as it it visible in UI we add some clarification which errors are happened
2020-07-08 18:28:08 +03:00
Jinseong Jeon
3afc37438e FIR: handle getClassCall with integer literals 2020-07-08 18:23:27 +03:00
Vladimir Ilmov
7f472ba24e Switch to isApplicableAsync instead of isApplicable in ToStringRenderer
#KT-39717 fixed
2020-07-08 16:15:46 +02:00
Ilya Goncharov
3d9353f7f5 [Gradle, JS] Add test on dependencies clash
^KT-40093 fixed
2020-07-08 16:10:46 +03:00
Ilya Goncharov
2e2a5a0156 [Gradle, JS] Update version in package.json with file dependency
^KT-40093 fixed
2020-07-08 16:10:39 +03:00
Mikhail Zarechenskiy
2bb9838a80 Add test for obsolete issue
The problem was fixed in d51bb2c053

 #KT-37692 Obsolete
2020-07-08 15:30:20 +03:00
Yunir Salimzyanov
78a4563baf Update versions of database files to correctly sync muted tests
Cause: bunch files were updated to 201
2020-07-08 14:57:07 +03:00
Lilia
53b2fe9fd8 Add changelog for 1.4-M3 & 1.3.72 plugins update 2020-07-08 13:26:51 +02:00
Toshiaki Kameyama
d2deff4864 Add "Replace with 'equals(..., ignoreCase = true)'" inspection
#KT-40016 Fixed
2020-07-08 12:38:30 +02:00
Dmitriy Novozhilov
a5bfa3ae63 [FIR-TEST] Update broken testdata 2020-07-08 12:13:33 +03:00
Dmitriy Novozhilov
86791f1fef [FIR] Fix parsing fun modifier for interfaces in light-tree2fir 2020-07-08 12:13:32 +03:00
Dmitriy Novozhilov
58af8d68a1 [FIR] Check for isFun flag in SAM resolution 2020-07-08 12:13:32 +03:00
Dmitriy Novozhilov
d1cb776e29 [FIR] Assume all java interfaces are fun interfaces 2020-07-08 12:13:32 +03:00
Dmitriy Novozhilov
a3a79e4295 [FIR] Update testdata due to incorrect SAM detection 2020-07-08 12:13:32 +03:00
Dmitriy Novozhilov
29849b1330 [FIR] Resolve rhs of += in dependent context 2020-07-08 12:13:31 +03:00
Vladimir Dolzhenko
943b59b5d8 Do not provide idea.platform.prefix in run configurations for IJ Ultimate 201+ 2020-07-08 10:26:18 +02:00
Alexander Dudinsky
38535c4fe1 New type of task - TestAggregation task
You can configure smoke test suites and get critical test results faster
This doesn't replace rr/* builds, but complements them for a faster round trip.

Also test tasks and patterns were added for KMM team.
 #KMM-265
2020-07-08 11:23:03 +03:00
Sergey Rostov
ebc4910834 ScriptTemplatesClassRootsIndex: inc version and minor fixes
Content was changed, so we should force reindex.
2020-07-08 11:03:25 +03:00
Mikhail Glukhikh
4a988f467a [FIR2IR] Code cleanup: DelegatedMemberGenerator 2020-07-08 10:05:07 +03:00
Juan Chen
d163853c97 [FIR] add support for implementation by delgation
This commit handles "subclass: super-interface by delegate-expression".

During Psi2Fir, for each delegate, we add to the subclass a synthetic
field (which has type super-interface), and an assignment of the
delegate-expression to the synthetic field in the primary constructor,
so that the delegate-expression can be resolved and transformed along
the way.

During Fir2Ir, we look up delegatable members from the super-interface
and generate corresponding functions/properties for the subclass.

TODO: support for generic delegatable members and generic
super-interface.
2020-07-08 09:42:24 +03:00
Natalia Selezneva
1d45dc8d81 Optimize ScriptTemplatesFromDependenciesProvider
No needs to convert file.url to VirtualFile
because index already has getContainingFiles method
Do not iterate through all children of VirtualFile
to avoid VFS events initialisation for those files
there is no guarantee that file is under source root
so is can be not present is vfs at this moment
2020-07-07 23:26:58 +03:00
Vladimir Dolzhenko
45600830d3 Fixed locking granularity in ScriptDefinitionsManager
#KT-34552 Fixed
#KT-39547 Fixed
2020-07-07 19:15:32 +00:00
simon.ogorodnik
77ccb3767c [FIR] Add system property selector for lightTree2fir / psi2fir 2020-07-07 21:47:24 +03:00
simon.ogorodnik
a460b8f2f4 [FIR] Support source directories for lightTree2fir 2020-07-07 21:47:24 +03:00
simon.ogorodnik
6c7a40627f [FIR] Forbid constructors in processFunctionsByName 2020-07-07 21:47:24 +03:00
simon.ogorodnik
6bc654ee49 [FIR] Add full compiler pipeline modularized test
Fixup: allow kotlin package
2020-07-07 21:47:24 +03:00
simon.ogorodnik
b48dfe9b3d Allow dirs as content root in modularized tests 2020-07-07 21:47:24 +03:00
simon.ogorodnik
bf1c3777ab Add IR specific timing measurements to performance manager 2020-07-07 21:47:24 +03:00
simon.ogorodnik
0de70d295a Fix argument names 2020-07-07 21:47:23 +03:00
simon.ogorodnik
b401443dbd Compute GC metrics only during compilation 2020-07-07 21:47:23 +03:00
simon.ogorodnik
6095ec66ed Allow to pass external performance manager to compiler 2020-07-07 21:47:23 +03:00
Alexander Udalov
8c71d8f126 Undeprecate VariableDescriptorWithAccessors.isDelegated
Apparently there's quite a few valid usages of this method outside of
the compiler frontend, where manual suppression is annoying.
2020-07-07 18:09:40 +02:00
Jinseong Jeon
50b2ea7053 FIR: avoid cast exception in Candidate.prepareExpectedType 2020-07-07 16:55:53 +03:00
Nick
a5f34a880c [FIR] Fix computeTypeArguments() & add diagnostic for type args 2020-07-07 15:52:17 +03:00
Stanislav Erokhin
8772fabc4f Fix since-build version for AS 3.6 and AS 4.0 2020-07-07 15:40:02 +03:00
Nikita Bobko
50d2b963cc Revert "202: Fix GradleFacetImportTest#testJDKImport test" for 193 bunch
This fixes test in 193 and 192 bunch
2020-07-07 12:29:19 +00:00
Nikita Bobko
496b8d5bd4 Create 193 bunch for GradleFacetImportTest.kt 2020-07-07 12:29:18 +00:00
Anton Bannykh
0885d608d8 JS IR: normalize the generate file path in the box tests 2020-07-07 13:00:42 +03:00
Ilya Goncharov
bb35509c38 [Gradle, JS] Warning on missed types and typings on genext npm dep
#KT-38331 fixed
2020-07-07 12:10:13 +03:00
Ilya Goncharov
1b3b2e539c [Gradle, JS] Not run separate dukat if there is no d ts files
^KT-38331 fixed
2020-07-07 12:09:58 +03:00
Jinseong Jeon
a18bd1bb75 FIR deserializer: use annotation info from enclosing class for companion object 2020-07-07 11:43:51 +03:00
Jinseong Jeon
81345bcc26 FIR deserializer: load annotations on inner classes 2020-07-07 11:43:51 +03:00
Victor Petukhov
c588bc604d NI: do substitution stub types during updating trace for lambda (these stub types can appear from the builder inference as postponed variables)
^KT-40060 Fixed
2020-07-07 11:17:06 +03:00
Victor Petukhov
eec3a4720c NI: don't collect members if a receiver type is StubType to avoid creating error candidates instead of not crating them at all
^KT-37717 Fixed
2020-07-07 11:17:06 +03:00
Ivan Kylchik
989e4293a3 [FIR] Fix exhaustiveness check in case of sealed subclass
The problem appear because check was performed only on direct children
of sealed class. To fix this, heritage tree is built and used in check

#KT-38989 Fixed
2020-07-07 10:58:06 +03:00
Nick
40cd30f7f6 [FIR] Partial performance fix for the effective visibility checker 2020-07-07 10:24:04 +03:00
Leonid Startsev
80561ec125 Update kx.serialization dependency
so tests won't fail due to
'library was compiled with pre-release flag' error.

Update test data
2020-07-07 01:14:32 +03:00
Natalia Selezneva
74aa3ac79a Minor: replace deprecated method usage 2020-07-06 23:23:46 +03:00
Natalia Selezneva
b3a84ba081 Fix warning in ScriptConfigurationHighlightingTest
In case of exception from dependencies resolver
we do not threat the configurations as up-to-date,
so the reloading process will be started during test
despite updateScriptDependenciesSynchronously called at startup.
This will lead to the warning from checkHighlighting
because if script reports are different we rehighlight the script.
Note that test won't fail.
2020-07-06 23:23:46 +03:00
Natalia Selezneva
6ec13ab38a Scripts: do not throw roots change event in case when roots are empty 2020-07-06 23:23:46 +03:00
Natalia Selezneva
16c5ba0988 Tests: do not throw roots change event in the current thread
This may cause exception during resolve,
because all caches are invalidated after this
and resolve should be restarted
Exception: module descriptor isn't find in its own dependencies
Unmute IdeReplCompletionTestGenerated.testDefinedExtension

^KT-34825 Fixed
2020-07-06 23:23:46 +03:00
Igor Yakovlev
5871628f2b Possibly fix flacky test of light classes for decompiled declarations
Tests:
JavaAgainstKotlinBinariesCheckerTestGenerated.testInferenceReturnType_1_8JavaAgainstKotlinBinariesCheckerTestGenerated.testReturnInnerClasses
2020-07-06 22:28:45 +03:00
Roman Golyshev
637d3430ff KT-39869 Remove redundant performDelayedRefactoringRequests call
- In `ObsoleteExperimentalCoroutinesInspection` it is redundant because
it is performed immediately after the single `bindToFqName` call,
so there is no reason to postpone the refactoring and then immediately
invoke it
- In `ObsoleteKotlinJsPackagesInspection` there are no reason to call
it at all (no refactorings are postponed)
2020-07-06 18:04:02 +00:00
Roman Golyshev
5cf6b860a6 KT-39869 Add inspection for FQN usages of kotlin.browser package
- `kotlin.dom` does not need this because it contains only extensions
- Add test for launching whole project fix; mute it because currently it
does not pass
  - The test fails because in tests `RefJavaManager` tries to create
  `RefJavaFileImpl` for .kt files. It will try to use UAST, but it
  does not work for JS files. In production this is disabled, so no
  problems occur
2020-07-06 18:04:01 +00:00
Roman Golyshev
91fa5d38b3 KT-39869 Fix review suggestions
- Review: https://jetbrains.team/p/kt/review/1349
2020-07-06 18:04:00 +00:00
Roman Golyshev
75de352ce2 KT-39869 Add ObsoleteKotlinJsPackagesInspection inspection
- This inspection allows to migrate from `kotlin.dom|kotlin.browser`
to `kotlinx.dom|kotlinx.browser` packages respectively
- This inspection is available from the import statements, and also
from the `Run migrations` action
- ^KT-39869 Fixed
2020-07-06 18:04:00 +00:00
Roman Golyshev
ec087e8f3d KT-39869 Move base classes to separate file 2020-07-06 18:03:59 +00:00
Roman Golyshev
871bb30dbe KT-39869 Refactor ObsoleteExperimentalCoroutinesInspection.kt
- We need this to reuse the logic for migration inspections
2020-07-06 18:03:58 +00:00
Toshiaki Kameyama
6b5c31e2fc Move statement up: do not apply to @file annotation
#KT-10790 Fixed
2020-07-06 17:50:39 +02:00
Yaroslav Chernyshev
aeed7fe52d KT-36801 Added forgotten changes for 192 platform
#KT-39989 Fixed
2020-07-06 18:07:11 +03:00
Ivan Kylchik
574aa0affe [FIR] Fix synthetic property is not var due to Nullable on parameter
Synthetic property is var when it have setter. The latter is set up
in property when its parameter type is equal to getter return type. In
case of using @Nullable, parameter type of setter is not equal to
return type of getter, because the latter is flexible type. So to fix
this verification should occur using not null types

#KT-39076 Fixed
2020-07-06 17:52:37 +03:00
Pavel Punegov
48c5f48af0 Ignore test in Native, see #KT-38859 2020-07-06 17:33:12 +03:00
Ilya Goncharov
cb3d7349a3 [Gradle, JS] Deprecation of frontend plugin
^KT-40048 fixed
2020-07-06 17:30:31 +03:00
Natalia Selezneva
56afd763dc Minor: add debug log messages 2020-07-06 15:53:28 +03:00
Natalia Selezneva
6c0d91837c Load file attributes for last modified files under try-catch
This should avoid exceptions from initialization of GradleBuildRootsManager.EP

EA-232521 Fixed
2020-07-06 15:52:43 +03:00
Ilya Goncharov
03bc61c80a [Gradle, JS] Add test on public package json inside archives (jar and klib) 2020-07-06 15:23:33 +03:00
Ilya Goncharov
f76a1f0e86 [Gradle, JS] jsJar dependsOn PublicPackageJsonTask
But package.json included into jar only if public npm dependencies exists
2020-07-06 15:23:33 +03:00
Ilya Goncharov
5c968acb13 [Gradle, JS] Simplify creation of public package json task 2020-07-06 15:23:33 +03:00
Ilya Goncharov
a2d5cda716 [Gradle, JS] Output file of public package json as var for changing it 2020-07-06 15:23:33 +03:00
Ilya Goncharov
a4ad3d88c6 [Gradle, JS] Remove duplicate of reporting js compiler statistic 2020-07-06 15:10:16 +03:00
Vladimir Dolzhenko
974dfbc9ab Advance bootstrap to 1.4.20-dev-1680 2020-07-06 12:04:11 +02:00
Vladimir Ilmov
a2040f01bf Body elements resolution in KotlinDebuggerCache added / analyzeWithContentAndGetResult
While we trying to find an inlined SourcePosition, the body should be
resolved KotlinPositionManager.getLambdaOrFunIfInside / InlineUtil.isInlinedArgument
to make shure the lambda is an argument for a call.

 #KT-39309 fixed
 #KT-39435 fixed
2020-07-06 11:33:50 +02:00
Dmitriy Novozhilov
a0f8ada285 [FIR-TEST] Unmute failing diagnostic tests 2020-07-06 12:11:57 +03:00
Igor Yakovlev
4707f4fc3f Change signature does not make doubled refactoring for java usages
Fixed #KT-22170
2020-07-06 11:54:36 +03:00
Dmitry Gridin
7b9fad00a1 Rename KotlinLikeLangLineIndentProvider to KotlinLangLineIndentProvider
Relates to #KT-22211
2020-07-06 14:51:29 +07:00
Dmitry Petrov
b75de60afb Minor: mute failing test 2020-07-06 10:47:10 +03:00
Mikhail Zarechenskiy
d8f701ee61 Add test for obsolete issue
#KT-39588 Obsolete
2020-07-05 18:17:44 +03:00
Vladimir Dolzhenko
03d5fe8d6c Add dispatchAllInvocationEvents to editor actions in perf tests 2020-07-04 23:33:02 +02:00
Vladimir Dolzhenko
a830c69a30 Regenerate TypingIndentationTestBaseGenerated 2020-07-04 22:25:09 +02:00
Vladimir Krivosheev
75b1cf8a23 Explicitly specify id of KotlinNonJvmSourceRootConverterProvider
IDEA 2020.3 uses `id` from extension definition to avoid creating instance of converter without need.
2020-07-04 15:38:15 +02:00
Vyacheslav Karpukhin
6ecd2e57fb Created bunch 203 2020-07-04 02:11:18 +02:00
Vladimir Dolzhenko
357746e344 Do not force FULL analysis for PARTIAL_FOR_COMPLETION for the current open file
Relates to #KT-38687
2020-07-03 22:57:22 +02:00
Vladimir Dolzhenko
51375ed278 PluginStartupListener clean up
Relates to #KT-39968
2020-07-03 22:30:15 +02:00
Vladimir Dolzhenko
0b2e15d20c PluginStartupListener clean up
Relates to #KT-39968
2020-07-03 22:05:43 +02:00
Mikhail Zarechenskiy
01f2b0e26b Fix test data about JsExport
It allows only for top-level declarations, plus JsName is needed to
 avoid error about method redeclaration
2020-07-03 21:23:29 +03:00
Mikhail Zarechenskiy
9a08085146 Fix redundant semicolon inspection before soft keywords
Fixes few tests:
 - RedundantSemicolon.testBetweenSoftModifierKeywordAndDeclaration
 - RedundantSemicolon.testBetweenSoftModifierKeywordAndDeclaration2
 - RedundantSemicolon.testBetweenSoftModifierKeywordAndDeclaration3

 This bug was introduced in 741ebeb7b8
2020-07-03 21:23:29 +03:00
Mikhail Zarechenskiy
a0ecfce7b7 Update test data: add correct error 2020-07-03 21:23:29 +03:00
Nikolay Krasko
87a520fc30 202: Overcome failure in PathManager.getHomePath() because of the wrong dir
Stacktrace:

java.lang.RuntimeException: Could not find installation home path. Please reinstall the software.
  at com.intellij.openapi.application.PathManager.getHomePath(PathManager.java:106)
  at com.intellij.openapi.application.PathManager.getHomePath(PathManager.java:76)
  at com.intellij.openapi.application.PathManager.getPreInstalledPluginsPath(PathManager.java:248)
  at com.intellij.ide.plugins.DescriptorListLoadingContext.<init>(DescriptorListLoadingContext.java:57)
  at com.intellij.ide.plugins.DescriptorListLoadingContext.createSingleDescriptorContext(DescriptorListLoadingContext.java:61)
  at com.intellij.ide.plugins.PluginManagerCore.registerExtensionPointAndExtensions(PluginManagerCore.java:1397)
  at com.intellij.core.CoreApplicationEnvironment.registerExtensionPointAndExtensions(CoreApplicationEnvironment.java:266)
  at org.jetbrains.kotlin.cli.jvm.compiler.CoreApplicationEnvironmentCompatKt.registerExtensionPointAndExtensionsEx(coreApplicationEnvironmentCompat.kt:17)
  at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.registerApplicationExtensionPointsAndExtensionsFrom(KotlinCoreEnvironment.kt:534)
  at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createApplicationEnvironment(KotlinCoreEnvironment.kt:505)
  at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.getOrCreateApplicationEnvironmentForProduction(KotlinCoreEnvironment.kt:465)
  at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:92)
  at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:52)
  at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:88)
  at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
  at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
  at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:76)
  at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:45)
  at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMainNoExit(CLITool.kt:227)
  at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMainNoExit$default(CLITool.kt:225)
  at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMain(CLITool.kt:214)
  at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler$Companion.main(K2JVMCompiler.kt:262)
  at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.main(K2JVMCompiler.kt)
  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 com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:63)
2020-07-03 21:21:23 +03:00
Dmitriy Dolovov
d63728afe5 [Commonizer] Use 'index:Int' instead of Name for addressing type parameters 2020-07-03 22:27:58 +07:00
Mikhail Zarechenskiy
0ee7306d9c Fix coercion to Unit when variable already have other constraints
Don't add `Unit` if variable has an upper constraint T <: A.

 It's impossible to coerce variable T to Unit as constraint system will
 be always contradictory: T := Unit => Unit should be subtype of A

 #KT-39900 Fixed
2020-07-03 17:54:14 +03:00
Dmitry Petrov
026f54f3d8 Fix Kapt3 tests
Nullability annotations are no longer generated on private fields,
so line numbers in generated java sources changed.
2020-07-03 17:51:30 +03:00
Dmitry Petrov
761e47264a JVM_IR: fix property reference generation for inline class primary val 2020-07-03 17:51:30 +03:00
Vladimir Dolzhenko
1450cf5f63 Fix KOTLIN_BUNDLED registration
#KT-39968 Fixed
2020-07-03 14:46:40 +00:00
Dmitry Gridin
d1455d0d22 KotlinOptimizeImportsRefactoringHelper: should remove unused directives by pointer
#KT-39899 Fixed
#EA-209827 Fixed
2020-07-03 14:29:46 +00:00
Dmitry Gridin
62e252ec26 Inline refactoring: should support set/get operator
#KT-17378 Fixed
2020-07-03 21:11:58 +07:00
Toshiaki Kameyama
e31ea0c243 ReplaceWith: suggest to replace for 'get/set' operator functions
#KT-15944 Fixed
2020-07-03 21:10:24 +07:00
Dmitriy Novozhilov
82b6ecfa64 [FIR-TEST] Add test for KT-39075 2020-07-03 17:09:29 +03:00
Dmitriy Novozhilov
59bedaaa55 [FIR] Rename FirElvisCall to FirElvisExpression
FirElvisCall is not a FirCall, so FirElvisExpression is more
  convenient name
2020-07-03 17:09:29 +03:00
Dmitriy Novozhilov
1db2ba51d2 [FIR] Don't pass flow from inplace lambdas throw when and elvis expressions
#KT-39080 Fixed
2020-07-03 17:09:29 +03:00
Dmitriy Novozhilov
1429cba2d4 [FIR] Fix CCE in postponed lambda resolution 2020-07-03 17:09:28 +03:00
Dmitriy Novozhilov
8311c1f0e2 [FIR] Fix projection of Comparable supertype for ILT
#KT-39048 Fixed
2020-07-03 17:09:28 +03:00
Dmitriy Novozhilov
a882a9dff5 [FIR] Create scope for type parameter as scope for intersection of bounds
Before change we've created composite scope for all bounds, which
  is incorrect, because intersection of all bounds may be less than
  all bounds (see test in commit)

#KT-39032 Fixed
2020-07-03 17:09:28 +03:00
Jinseong Jeon
44d0af8597 FIR2IR: handle 'this' as reference to outer object 2020-07-03 12:53:57 +03:00
Ilya Muradyan
1798542db7 Fix and enable embedded tests in scripting-ide-services 2020-07-03 12:21:45 +03:00
Ilya Muradyan
e88bef4275 Fix jar-dependent test in scripting-ide-services 2020-07-03 12:21:45 +03:00
Mikhail Zarechenskiy
d51bb2c053 Add compatibility resolve when variable has "bad" intersection type
#KT-39468 Fixed
2020-07-03 12:18:28 +03:00
Ivan Kylchik
92a51b9794 [FIR] Add illegal underscore check in BaseFirBuilder 2020-07-03 12:06:49 +03:00
Ivan Kylchik
cc4b50fdc1 [FIR] Add illegal underscore diagnostic 2020-07-03 12:06:47 +03:00
Ivan Kylchik
54945b7fbc Extract illegal underscore check function to ParseUtils 2020-07-03 12:06:45 +03:00
Ivan Kylchik
d0f6997e6d [FIR] Fix some of fir spec tests for real-literals
#KT-38336 Fixed
2020-07-03 12:06:44 +03:00
Dmitry Petrov
17c15cfe0a JVM, JVM_IR: update bytecode listing testData for inline classes 2020-07-02 22:39:06 +03:00
Dmitry Petrov
6e0bb0b468 JVM: no nullability annotations for inline class '-impl' methods
Specialized generated methods for inline classes (toString-impl,
hashCode-impl, equals-impl, etc) are inaccessible from Java, and thus
don't require nullability annotations.
2020-07-02 22:39:06 +03:00
Dmitry Petrov
ea042eb6c4 JVM_IR: no nullability annotations for inline class '-impl' methods
Specialized generated methods for inline classes (toString-impl,
hashCode-impl, equals-impl, etc) are inaccessible from Java, and thus
don't require nullability annotations.
2020-07-02 22:39:06 +03:00
Dmitry Petrov
a238d6a890 JVM_IR: no annotations on parameters of 'property$annotations' methods 2020-07-02 22:39:06 +03:00
Dmitry Petrov
8da988b18e JVM_IR: Mangle primary val getter of inline class if required
TODO fix reflection
2020-07-02 22:39:06 +03:00
Dmitry Petrov
62d2581faf JVM_IR: Don't generate annotations on generated inline class members 2020-07-02 22:39:05 +03:00
Dmitry Petrov
dc4b9d3887 JVM_IR: Don't mangle internal constructor-impl for inline classes 2020-07-02 22:39:05 +03:00
Ilya Kirillov
5cfac8fa3f FIR IDE: introduce symbol pointers for restoring symbols in another read action
fix pointer
2020-07-02 22:25:06 +03:00
Ilya Kirillov
f88ebed1a3 FIR IDE: move types to its own package 2020-07-02 22:25:06 +03:00
Ilya Kirillov
5f548fc459 FIR IDE: add creating stdlib symbols by fqName tests 2020-07-02 22:25:06 +03:00
Ilya Kirillov
799a49649c FIR IDE: introduce symbol modality 2020-07-02 22:25:06 +03:00
Ilya Kirillov
75a96f0153 FIR IDE: add info about varargs to parmater symbol 2020-07-02 22:25:05 +03:00
Ilya Kirillov
f10f6c6360 FIR IDE: introduce package symbol 2020-07-02 22:25:05 +03:00
Ilya Kirillov
18d46a86ae FIR IDE: add identity weak map based cache for KtSymbolByFirBuilder 2020-07-02 22:25:05 +03:00
Ilya Kirillov
a26063b3f8 FIR IDE: rename Invalidatable -> ValidityOwner 2020-07-02 22:25:05 +03:00
Ilya Kirillov
226d514788 FIR IDE: rename reference classes to KtFir*Reference for consistency 2020-07-02 22:25:05 +03:00
Ilya Kirillov
66933ea2fe FIR IDE: use withValidityAssertion instead of explicit check in FirAnalysisSession 2020-07-02 22:25:04 +03:00
Ilya Kirillov
8368284817 FIR IDE: introduce KtType 2020-07-02 22:25:04 +03:00
Ilya Kirillov
c44756bbfd FIR IDE: add tests for building kt symbols by PSI 2020-07-02 22:25:04 +03:00
Ilya Kirillov
8a52954bf8 FIR IDE: introduce symbol provider 2020-07-02 22:25:03 +03:00
Ilya Kirillov
20b93507ab FIR IDE: use symbols for reference resolve 2020-07-02 22:25:03 +03:00
Ilya Kirillov
749afbd141 FIR IDE: use symbols for call resolve 2020-07-02 22:25:03 +03:00
Ilya Kirillov
82866176fb FIR IDE: introduce symbol API 2020-07-02 22:25:03 +03:00
Alexander Udalov
ba948cda38 Report warning on characters which can cause problems on Windows
As soon as we fix KT-17438, this warning will be turned into an error.
2020-07-02 21:19:28 +02:00
Alexander Udalov
181965f6e8 IR: inline namedIrModulePhase and namedIrFilePhase phase builders
Construct NamedCompilerPhase directly instead. Only use phase builders
where the code becomes easier to read.
2020-07-02 21:19:28 +02:00
Alexander Udalov
15a969b3ba IR: refactor performByIrFile a little
Take a list of phases instead of the CompositePhase, to make stacktraces
nicer and avoid quadratic time of phase construction.
2020-07-02 21:19:28 +02:00
Alexander Udalov
4475325ffa IR: refactor PhaseBuilders a little
- use named classes to improve stacktraces
- reorder parameters to make the code shorter
- use explicit types to improve IDE resolve in usages
2020-07-02 21:19:27 +02:00
Alexander Udalov
7997d4afd3 IR: do not use AnyNamedPhase where there is Context parameter 2020-07-02 21:19:27 +02:00
Alexander Udalov
ef58f1e72e IR: simplify phaser code a little
- merge NamedCompilerPhase, SameTypeNamedPhaseWrapper,
  AbstractNamedPhaseWrapper and inherit it from SameTypeCompilerPhase
- inline some functions to simplify stacktraces
- reformat and fix inspections
2020-07-02 21:19:27 +02:00
Stanislav Erokhin
74ce26cdc2 Fix 1.4-M2 ChangeLog.md 2020-07-02 22:16:59 +03:00
Vyacheslav Gerasimov
18d71c7907 Build: Encode build number in teamcity build url 2020-07-02 22:05:35 +03:00
Vyacheslav Gerasimov
8e1269cc32 Build: Add hacky workaround for retrying PublishToMavenRepository tasks
It's supposed to help with `Caused by: org.apache.http.NoHttpResponseException: api.bintray.com:443 failed to respond`
2020-07-02 22:05:35 +03:00
Dmitriy Dolovov
3bb234b17c [Commonizer] Clean-up CirTypeSignature usages 2020-07-03 00:22:44 +07:00
Dmitriy Dolovov
ffd0c69698 [Commonizer] Use ClassId instead of FqName for addressing classes and TAs 2020-07-03 00:22:38 +07:00
Ilya Kirillov
57aefbcd57 FIR IDE: migrate to 201 2020-07-02 19:34:37 +03:00
Mads Ager
1124887aa0 [JVM_IR] Fix stepping behavior for assignments to local variables. 2020-07-02 17:29:07 +02:00
Vladimir Dolzhenko
543efffa5c Turn off stability check for PerformanceTypingIndentationTest 2020-07-02 17:13:10 +02:00
Igor Yakovlev
89d5c030dc Improve incremental analisys for nested blocks 2020-07-02 17:52:40 +03:00
Toshiaki Kameyama
efdeb7b449 Introduce "Add '== true'" quick fix for TYPE_MISMATCH
#KT-39930 Fixed
2020-07-02 19:31:43 +07:00
Dmitriy Novozhilov
5bf18c09bb Advance bootstrap to 1.4.20-dev-1530 2020-07-02 15:19:24 +03:00
Natalia Selezneva
a73dac75d4 Optimize KotlinScriptDependenciesClassFinder
Do not call processDirectories for all package prefixes checking inner classes

^KT-39796 Fixed
2020-07-02 15:14:02 +03:00
Mikhail Glukhikh
f46970219f [FIR2IR] Simplify elvis conversion 2020-07-02 15:10:52 +03:00
Mikhail Glukhikh
68b84722c4 [FIR2IR] Simplify generateWhen 2020-07-02 15:10:52 +03:00
Mikhail Glukhikh
24c8eb43a2 [FIR2IR] Don't build stub FirWhen for converting elvis expression 2020-07-02 15:10:52 +03:00
Mikhail Glukhikh
6229d2e215 [FIR2IR] Extract generateWhen & toIrWhenBranch 2020-07-02 15:10:52 +03:00
Mikhail Glukhikh
31765a4abc [FIR2IR] Move visitElvis & visitWhen close to one another 2020-07-02 15:10:52 +03:00
Dmitriy Novozhilov
f4d5070a7b [FIR-TEST] Mute BB test due to KT-39659 2020-07-02 15:10:52 +03:00
Dmitriy Novozhilov
a7ed9c7dc5 [FIR] Add conversion of FirElvisCall to backend IR 2020-07-02 15:10:52 +03:00
Dmitriy Novozhilov
102c9c08d0 [FIR] Resolve elvis call as special synthetic call
Before that commit we desugared `a ?: b` as

when (val elvis = a) {
    null -> b
    else -> elvis
}

It was incorrect, because `a` should be resolved in dependent mode,
  but when it was `elvis` initializer it was resolved in independent
  mode, so we can't infer type for `a` in some complex cases
2020-07-02 15:10:51 +03:00
Dmitriy Novozhilov
b49b3245af [FIR] Add special node for elvis call
#KT-39074
2020-07-02 15:10:51 +03:00
Dmitriy Novozhilov
648953085f [FIR] Replace kotlin/Throwable with java/lang/Throwable in JvmMappedScope
#KT-39044 Fixed
2020-07-02 15:10:51 +03:00
Dmitriy Novozhilov
624b9306f0 [FIR] Resolve LHS of type operator call in independent context
#KT-39046 Fixed
2020-07-02 15:10:51 +03:00
Jinseong Jeon
c9e423bf64 FIR deserializer: fix parameter shift for constructor of inner classes and enums
#KT-39837 Fixed
2020-07-02 13:34:39 +03:00
Georgy Bronnikov
8e24256f95 JVM_IR: avoid descriptors when tracking inline properties
Preparing to use wrapped properties in InlineCodegen.
2020-07-02 12:46:58 +03:00
Georgy Bronnikov
385d522d27 JVM_IR: do not use descriptor in isCompiledToJvmDefault 2020-07-02 12:45:26 +03:00
Vsevolod Tolstopyatov
3270c7e016 Introduce CancellationException
#KT-39126 Fixed
2020-07-02 11:01:28 +03:00
Natalia Selezneva
5ec110c33f *.gradle.kts: catch exceptions during GradleBuildRootManager initialization
^KT-39317 Fixed
2020-07-02 08:48:05 +03:00
Natalia Selezneva
c7c7ffb0e0 *.gradle.kts: get java home from build environment instead of execution settings
Note that getting GradleExecutionSettings may lead to write action
because it link javaHome with existing sdks

^KT-39317
2020-07-02 08:48:05 +03:00
Steven Schäfer
5cdf053c8e Coroutines: Fix RedundantLocalsEliminationMethodTransformer
- Take control flow into account when collecting usage information
- Don't remove stores to local variables
2020-07-02 00:49:28 +02:00
Alexander Gorshenev
3113281e2d Adapted fake override checker to inheritance from friend module internal interfaces 2020-07-01 20:29:48 +03:00
Mikhail Glukhikh
07feb2185b Fix exception in FirExposedVisibilityChecker 2020-07-01 19:30:50 +03:00
Ilmir Usmanov
697c8637ee For all int-like typed variables, use int as field type and coerce
it during spill-unspill.
Coerce int to boolean, otherwise, VerifyError is thrown on android
Completely rewrite SpilledVariableFieldTypesAnalysis... again,
but this time use BasicInterpreter
This way, the analysis both does not use SourceInterpreter and
is in line with the rest on analyses.
2020-07-01 17:26:47 +02:00
Alexander Udalov
e7f33ac051 IR: do not inherit IrFunctionReference from IrFunctionAccessExpression
To avoid the diamond hierarchy and to allow refactoring the IR element
hierarchy from interfaces to classes, improving performance of visitors
and transformers.
2020-07-01 13:03:56 +02:00
Alexander Udalov
d4605f5816 IR: add type parameter to IrMemberAccessExpression and some subclasses
This is needed to get rid of the diamond hierarchy:

                 IrMemberAccessExpression
                 /                       \
                /                         \
IrFunctionAccessExpression     IrCallableReference
                \                      /
                 \                    /
                   IrFunctionReference

In the subsequent commit, IrFunctionReference no longer inherits from
IrFunctionAccessExpression; the more precise type of `val symbol:
IrFunctionSymbol` is now carried via the generic type argument.

This will help to refactor IR element hierarchy from interfaces to
classes, improving performance of visitors and transformers.
2020-07-01 13:03:56 +02:00
Alexander Udalov
d794c9dc4d IR: remove non-supertype usages of abstract impl classes
Work with the corresponding base interfaces instead. This change will
help in moving the IR element hierarchy from interfaces to classes,
should the need arise.

There's a possible change in behavior in
`CallAndReferenceGenerator.applyCallArguments`, which however doesn't
seem to break anything: IrPropertyReferenceImpl can now also be handled
by this method.
2020-07-01 13:03:56 +02:00
Alexander Udalov
ccac23f5b2 IR: make mapOptimized non-inline, rename to transformIfNeeded
This seems to have no effect on performance, however it clearly shows
that this method is a hotspot now with regard to own CPU samples.
Furthermore, it somewhat decreases the bytecode size at call sites and
might actually allow the HotSpot to inline those methods earlier and
hopefully deoptimize less frequently.
2020-07-01 13:03:56 +02:00
Alexander Udalov
6a699c9384 IR: minor, remove accept from some interfaces 2020-07-01 13:03:56 +02:00
Jinseong Jeon
1e3019798a FIR2IR: discard fake overrides for property accessors according to base visibility 2020-07-01 13:59:42 +03:00
Nikita Bobko
6985c5fd2a 202: Fix KotlinJpsBuildTest tests
Test failure was caused by "replace custom source root types to a special
'unknown' type and back on plugin unload/load (IDEA-235292)" in intellij.

We override `getModuleSourceRootPropertiesSerializers` in `KotlinModelSerializerService`
by inheriting from `KotlinCommonJpsModelSerializerExtension`
2020-07-01 11:31:23 +03:00
Nikita Bobko
4e65b2fb9e Refactoring: mark const strings with const keyword 2020-07-01 11:31:23 +03:00
Nikita Bobko
31e45d4f4c 202: Fix some ParameterInfoTestGenerated
Speaking strictly:
* `ParameterInfoTestGenerated$WithLib1.testUseJavaFromLib`
* `ParameterInfoTestGenerated$WithLib2.testUseJavaSAMFromLib`
* `ParameterInfoTestGenerated$WithLib3.testUseJavaSAMFromLib`
2020-07-01 11:31:23 +03:00
Nikita Bobko
cbc57351f5 202: Fix SlicerLeafGroupingTestGenerated tests 2020-07-01 11:31:22 +03:00
Nikolay Krasko
0d71b7ac2c 202: Add fastutil jar to tests dependencies 2020-07-01 11:31:22 +03:00
Nikolay Krasko
ca7169b84f 202: Disable ignored plugins check in compiler environment
Stacktrace:

java.lang.NullPointerException
  	at java.io.Reader.<init>(Reader.java:78)
  	at java.io.InputStreamReader.<init>(InputStreamReader.java:113)
  	at com.intellij.ide.plugins.PluginManagerCore.getBrokenPluginVersions(PluginManagerCore.java:207)
  	at com.intellij.ide.plugins.PluginManagerCore.createLoadingResult(PluginManagerCore.java:825)
  	at com.intellij.ide.plugins.DescriptorListLoadingContext.createSingleDescriptorContext(DescriptorListLoadingContext.java:61)
  	at com.intellij.ide.plugins.PluginManagerCore.registerExtensionPointAndExtensions(PluginManagerCore.java:1397)
  	at com.intellij.core.CoreApplicationEnvironment.registerExtensionPointAndExtensions(CoreApplicationEnvironment.java:266)
  	at org.jetbrains.kotlin.cli.jvm.compiler.CoreApplicationEnvironmentCompatKt.registerExtensionPointAndExtensionsEx(coreApplicationEnvironmentCompat.kt:17)
  	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.registerApplicationExtensionPointsAndExtensionsFrom(KotlinCoreEnvironment.kt:534)
  	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createApplicationEnvironment(KotlinCoreEnvironment.kt:505)
  	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.getOrCreateApplicationEnvironmentForProduction(KotlinCoreEnvironment.kt:465)
  	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:92)
  	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:52)
  	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:88)
  	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
  	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
  	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:76)
  	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:45)
  	at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMainNoExit(CLITool.kt:227)
  	at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMainNoExit$default(CLITool.kt:225)
  	at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMain(CLITool.kt:214)
  	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler$Companion.main(K2JVMCompiler.kt:262)
  	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.main(K2JVMCompiler.kt)
2020-07-01 11:31:22 +03:00
Nikita Bobko
ef562598ea 202: Fix MultiFileJvmBasicCompletionTestGenerated
It was broken by 4bef803e1b5994e9ea9731acfb5095a94b1b1383 in intellij
2020-07-01 11:31:21 +03:00
Nikita Bobko
3187bb2aa4 202: Fix KotlinMavenImporterTest#testJDKImport test
Test failure was caused by 8e1ab882641db695e3b70085d14a59e1e8e9f579 +
b79ca6e3a855b9d74dba129583d7ed25ecd2f552 in intellij
2020-07-01 11:31:21 +03:00
Nikita Bobko
5c95c48c90 202: Fix GradleFacetImportTest#testJDKImport test
Test failure was caused by 8e1ab882641db695e3b70085d14a59e1e8e9f579 +
b79ca6e3a855b9d74dba129583d7ed25ecd2f552 in intellij
2020-07-01 11:31:21 +03:00
Nikita Bobko
536c4bbab1 202: Fix KotlinEvaluateExpressionTestGenerated.SingleBreakpoint
Now `getTreeEvaluation` returns `CompletableFuture<PsiElement>` not `PsiElement` as it was in 201
2020-07-01 11:31:20 +03:00
Nikita Bobko
046030e301 202: Fix "Module 'foo': No SDK defined" in tests
Fixes several tests in 202:
* NewMultiplatformProjectImportingTest
* KaptImportingTest
* ...

This failure was caused by b79ca6e3a855b9d74dba129583d7ed25ecd2f552 in intellij
2020-07-01 11:31:20 +03:00
Nikita Bobko
8fb82c2cb7 202: Fix missing formatting in nJ2K tests
Formatting in nJ2K tests (actually it still works in IDE) was broken by
dee00ac38946b8a8a5165dffd083e67c85935723 in intellij
2020-07-01 11:31:20 +03:00
Nikita Bobko
264094861d 202: Fix null passed to @NotNull in PomModelImpl
Fixes `AdditionalResolveDescriptorRendererTestGenerated#testAnonymousObjectInClassParameterInitializer`
and others
2020-07-01 11:31:19 +03:00
Vladimir Dolzhenko
853503d75f Force perform FULL analysis to avoid redundant analysis for the current open file
#KT-38687 Fixed
2020-07-01 08:22:58 +00:00
Sergey Rostov
1a82c94979 revert accidentally committed project.xml 2020-07-01 10:36:40 +03:00
Mikhail Zarechenskiy
d9fc71b8c0 Advance bootstrap to 1.4.20-dev-1515 2020-07-01 10:11:13 +03:00
Denis Zharkov
3ce980fd88 Fix incremental compilation for calls to inner classes from supertypes
The problem became actual after 8c2baf0704
2020-07-01 06:55:52 +03:00
Mikhail Zarechenskiy
6b81cc8b77 Update test data as stdlib now isn't pre-release 2020-06-30 22:59:23 +03:00
Mikhail Zarechenskiy
94dcff5bab Advance bootstrap to 1.4.20-dev-1508 2020-06-30 21:48:30 +03:00
Mikhail Zarechenskiy
f37f89a151 Set KotlinCompilerVersion.IS_PRE_RELEASE = false
Since master is 1.4.20 now and branch 1.4.0 is 1.4-RC

 #KT-39860 Fixed
2020-06-30 21:01:45 +03:00
Mikhail Bogdanov
b5b5c8aebc Check target for -Xjvm-default modes
#KT-39925 Fixed
2020-06-30 19:47:06 +02:00
Dmitriy Dolovov
3e42b9d527 [Commonizer] Remove unused property from CirFunction 2020-07-01 00:12:03 +07:00
Nikolay Krasko
21fa2bf98c Switch to 201 platform 2020-06-30 19:53:18 +03:00
Nikolay Krasko
50863b6985 Fix using swing ComboBox and wrong bunching 2020-06-30 19:53:17 +03:00
Nikolay Krasko
2c1b01fcf6 Setup standalone environment in BuiltInsSerializer
Main change is in calling setupIdeaStandaloneExecution()
2020-06-30 19:53:17 +03:00
Nikolay Krasko
3b2e1cfa39 Show TeamCity user for agent builds 2020-06-30 19:53:17 +03:00
Dmitry Gridin
86fe10ba44 AddDefaultConstructorFix: fix testData
#KT-20718
2020-06-30 23:22:08 +07:00
Toshiaki Kameyama
7be5410877 Add a quick fix for NO_CONSTRUCTOR error on 'expect' annotation entry
#KT-20718 Fixed
2020-06-30 23:22:08 +07:00
Mikhail Glukhikh
d846a22e33 [FIR] Introduce & use FirTypeRef.coneType 2020-06-30 18:49:06 +03:00
Toshiaki Kameyama
0392fe75fc Convert to block body: specify non-nullable type when body expression is platform type and overriden method is non-nullable type
#KT-12222 Fixed
2020-06-30 22:47:13 +07:00
Dmitry Petrov
d37b616e1f JVM_IR: Fix enum classes ABI
1. Enum entry fields don't have nullability annotations.

2. Enum class special methods (values, valueOf) are not 'final'
(although they probably should be, javac generates corresponding
methods without ACC_FINAL flag).

3. Enum class special methods don't have nullability annotations.

4. Don't generate synthetic accessor for enum entry class constructor.

KT-37019 KT-37020 KT-37021
2020-06-30 18:24:25 +03:00
Stanislav Erokhin
f753824429 Advance bootstrap version to 1.4.20-dev-1401 2020-06-30 17:56:11 +03:00
Ilmir Usmanov
7536da788c Minor. Update test 2020-06-30 16:54:36 +02:00
Jinseong Jeon
34174d6e7d FIR deserializer: load annotations for property and fields, along with use-site targets 2020-06-30 17:28:22 +03:00
Mikhail Bogdanov
3580c7c28c Write proto flag about compatibility mode
There is no any special aim for this flag now.
  But it could be useful in future in case of compatibility mode deprecation
2020-06-30 14:59:01 +02:00
Vladimir Dolzhenko
f372a0fe6c Force full analysis even if incremental analysis is available but existed is erroneous 2020-06-30 12:53:34 +00:00
Konstantin Tskhovrebov
343e645282 Rename and refactor kmm plugin packages, task names, ids and etc. 2020-06-30 15:28:39 +03:00
Vladimir Dolzhenko
48a9226e1c Fix copy-paste from KTS files
#KT-37517 Fixed
2020-06-30 12:24:31 +00:00
Toshiaki Kameyama
0a230905ae Remove redundant spread operator: don't report if overloaded functions cannot be resolved
#KT-38282 Fixed
2020-06-30 19:16:22 +07:00
Ilya Kirillov
f179b39c70 Wizard: fix project template list size 2020-06-30 15:10:55 +03:00
Aleksei Cherepanov
b9b068ff63 Fix FirMultiModuleResolveTestGenerated tests 2020-06-30 14:16:52 +03:00
Sergey Igushkin
8ba131290a Fixup for 1f5fa5eb7 – adjust error message 2020-06-30 13:14:03 +03:00
Sergey Igushkin
1f5fa5eb7c Add back empty stub implementations of KotlinGradleSubplugin (KT-39809)
* If a KotlinGradleSubplugin implements
 KotlinCompilerPluginSupportPlugin, don't apply it as a legacy plugin

* Add the legacy KotlinGradleSubplugin implementations back so that
 when there's JAR hell with META-INF/services in the old artifacts
 pointing to the classes, loading the plugins with ServiceLoader (legacy
 implementation) from the new artifacts would not fail.

* There's a corner case for plugins not in kotlin-gradle-plugin
 If a newer and older version of such a subplugin is used with an older
 version of the Kotlin Gradle plugin, the latter will find the META-INF
 entries and will try to load the subplugins from the new version. With
 the original fix for KT-39809, this would result in silently ignored
 empty stub implementations.

 Given that the Kotlin Gradle plugin can now check if a subplugin
 supports the new API, it's OK to keep the old entries and make the
 stub implementations throw a build error when called, so that improper
 plugin versions are not ignored and are clearly reported.

 Note that this is only necessary for the subplugins not bundled in the
 kotlin-gradle-plugin module, as those will always be in sync with the
 Kotlin version.

Issue #KT-39809 Fixed
2020-06-30 12:51:51 +03:00
Sergey Igushkin
cb936dd82e Fix internals with symlinked friend paths (KT-35341)
The friend paths converted to canonical paths didn't match absolute
paths in the compiler code in case of symlinked directories.

This fixes a regression.

Issue #KT-35341 Fixed
2020-06-30 12:51:50 +03:00
kvirolainen
5b1d019bb0 Added Incomplete destructuring inspection
#KT-21223 Fixed
2020-06-30 11:47:27 +02:00
Sergey Igushkin
e6bca819d4 Remove kotlin.native.linkFromSources, expose tasks' sources
* Drop the deprecated mode in the Kotlin/Native link
tasks using sources rather than the intermediate
compiled klib.

* Remove the `allSources` and `commonSources`
properties from the KotlinNativeCompilation, use the
tasks' properties instead.
2020-06-30 12:27:14 +03:00
Mads Ager
c3b5b21845 [JVM] Extend stepping tests with <clinit> stepping.
In addition, made the stepping information for constructor calls
consistent across JVM_IR and JVM. For JVM_IR that stepping behavior
is consistent for enum constructor calls in <clinit> for JVM it
is not.
2020-06-30 11:18:29 +02:00
Ilya Kirillov
2693664aa7 FIR IDE: unmute tests after introducing fake element kinds 2020-06-30 11:55:59 +03:00
Ilya Kirillov
9baced20c4 FIR IDE: find FIR element by PSI one only if FIR have a real source
Also, add a check that there is only one element with the same real source
2020-06-30 11:55:58 +03:00
Ilya Kirillov
5acdad29ec FIR: change source of existing type refs in DataClassMembersGenerator to avoid sources clash 2020-06-30 11:55:57 +03:00
Ilya Kirillov
650f2dd713 FIR: consider source of FirSingleExpressionBlock as a fake one 2020-06-30 11:55:56 +03:00
Ilya Kirillov
1c564e1bd6 FIR: add ImplicitTypeRef to the control flow fir element sources 2020-06-30 11:55:56 +03:00
Ilya Kirillov
94967bcd00 FIR: introduce element kind for source elements
It is needed for FIR IDE to determine if FIR element was built by PSI
or it is generated one
2020-06-30 11:55:53 +03:00
Dmitriy Novozhilov
f6e653b242 [FIR] Fix compilation broken in 309050d9 2020-06-30 11:43:46 +03:00
Dmitriy Novozhilov
309050d956 [FIR] Add ExtensionFunctionType attribute
#KT-39034 Fixed
2020-06-30 11:30:19 +03:00
Dmitriy Novozhilov
1d3c0f56a9 [FIR] Save type attributes in substitution 2020-06-30 11:30:19 +03:00
Dmitriy Novozhilov
25fd5cd4ac [FIR] Save type attributes in ConeKotlinType.withNullability 2020-06-30 11:30:19 +03:00
Dmitriy Novozhilov
840d3975cc [FIR] Add computing type attributes for deserialized types 2020-06-30 11:30:19 +03:00
Dmitriy Novozhilov
cfa250957a [FIR] Fix creating type attributes for intersection types 2020-06-30 11:30:18 +03:00
Jinseong Jeon
fab9ee47f9 FIR deserializer: proper annotation loading for value parameter of property setter 2020-06-30 11:01:03 +03:00
Toshiaki Kameyama
9308525d93 Add receiver of kotlin.text.toPattern to standard Kotlin injections
#KT-39231 Fixed
2020-06-30 14:26:37 +07:00
Vyacheslav Karpukhin
787d22c93e Created bunch 203 2020-06-30 03:41:51 +02:00
Egor Zhdan
09a111239e Stabilize ProjectTaskRunner registration order 2020-06-29 23:11:54 +02:00
Vyacheslav Karpukhin
866e5397d9 New ultimate modules 2020-06-29 23:11:54 +02:00
Ilmir Usmanov
ed80b431f0 Restore refined int-type analysis 2020-06-29 21:42:30 +02:00
Alexander Gorshenev
8920e68584 Muted .IncrementalJsKlibCompilerRunnerTestGenerated.ClassHierarchyAffected.testMethodRemoved
until we have full fledged fake override support in klib
2020-06-29 21:58:32 +03:00
Alexander Gorshenev
41a472693a Updated extraHelp test data for the new flags 2020-06-29 21:58:32 +03:00
Alexander Gorshenev
bf419bc243 Compute correct signature for fake override properties with type parameters 2020-06-29 21:58:32 +03:00
Alexander Gorshenev
d90c383287 Fine tuned fake override validator for internals 2020-06-29 21:58:32 +03:00
Alexander Gorshenev
e08b800eb9 Treat internals as publics for fake override construction 2020-06-29 21:58:31 +03:00
Alexander Gorshenev
e61960f333 Fake override construction fallback mode 2020-06-29 21:58:31 +03:00
Alexander Gorshenev
de79e3bec3 Added -Xdisable-fake-override-validator 2020-06-29 21:58:31 +03:00
Ilmir Usmanov
f127a0f593 Add flag to disable new spilled variable type analysis 2020-06-29 20:50:43 +02:00
Mikhail Zarechenskiy
d7df6e1e0c Avoid references to DeprecatedSinceKotlin to fix JPS build 2020-06-29 21:49:01 +03:00
Ilmir Usmanov
28e6028af4 Minor. Add test 2020-06-29 20:13:40 +02:00
Ilmir Usmanov
da12532669 Ignore fake inliner variables in merge operation
since they are not read and just markers.
 #KT-39863 Fixed
2020-06-29 20:13:37 +02:00
Mikhail Zarechenskiy
b0b8d40b71 Update ApiTest.testIrStdlib for JS, an addition to 9be8c5b5 2020-06-29 21:09:19 +03:00
Dmitry Petrov
e4198466b8 JVM_IR: No nullability annotations on static lambda instances 2020-06-29 19:32:03 +03:00
Dmitry Petrov
eefa621c56 JVM_IR KT-37006: InlineOnly property accessors are private in bytecode 2020-06-29 19:08:58 +03:00
Alexander Udalov
b94a4d9fc3 Render more information on inner classes in bytecode listing tests 2020-06-29 17:33:39 +02:00
Vyacheslav Gerasimov
4bb670e667 Build: Use project kotlin-reflect in fir tree generator
To avoid unstable dependency substitution depending on local version
2020-06-29 18:17:09 +03:00
Vyacheslav Gerasimov
1ef68dfffd Build: Fix kotlin-test-js-ir:commonMainSources to copy only sources
Copying previous build result with sources leads to unstable task inputs
2020-06-29 18:17:08 +03:00
Vyacheslav Gerasimov
5198020c29 Build: Fix kotlin-stdlib related errors during jps build import 2020-06-29 18:17:08 +03:00
Vyacheslav Gerasimov
63b7350046 Build: Use sources from kotlin mpp source set in sourcesJar helper 2020-06-29 18:17:08 +03:00
Vyacheslav Gerasimov
77a8cf4e66 Build: Use attributes to resolve test dependencies in jps build mode 2020-06-29 18:17:08 +03:00
Igor Yakovlev
a32f901ab9 Make property initializer modification is OutOfBlock change
Fixed #KT-38762
2020-06-29 18:05:05 +03:00
Mikhail Zarechenskiy
507a718632 Update tests for completion after adding DeprecatedSinceKotlin 2020-06-29 17:41:05 +03:00
Mikhail Zarechenskiy
87014f816c Update ApiTest.testStdlib for JS, an addition to 9be8c5b5 2020-06-29 17:04:42 +03:00
Mikhail Glukhikh
d798071e06 IrConstTransformer: drop unnecessary argument existence check 2020-06-29 16:31:24 +03:00
Jinseong Jeon
c3fc524c0d FIR: handle named arguments in annotations properly 2020-06-29 16:23:03 +03:00
Mikhail Glukhikh
4f36697737 [FIR2IR] Mute 2 BB tests failing due to signature clashing 2020-06-29 16:08:26 +03:00
Mikhail Glukhikh
6cb3687d5d [FIR2IR] Replace 'throw AssertionError()' with error() / assert() {...} 2020-06-29 16:08:15 +03:00
Mikhail Glukhikh
69ec8f2d89 [FIR2IR] Allow to get cached symbols in fake override generator 2020-06-29 16:08:14 +03:00
Mikhail Glukhikh
c4d41f48a3 [IR] Allow Fir2Ir symbols in function factory 2020-06-29 16:08:12 +03:00
Mikhail Glukhikh
a6234eb261 [FIR2IR] Don't compose signatures for private declarations 2020-06-29 16:08:11 +03:00
Mikhail Glukhikh
19d115778b [IR] Allow fast reference path in SymbolTable for wrapped descriptors 2020-06-29 16:08:10 +03:00
Mikhail Glukhikh
90f9b9c1c9 [FIR2IR] Unmute 6 fixed BB tests 2020-06-29 16:08:09 +03:00
Mikhail Glukhikh
2d5e6bb90b [FIR2IR] Introduce lazy properties 2020-06-29 16:08:08 +03:00
Mikhail Glukhikh
efd614194b [FIR2IR] Make Fir2IrBindableSymbol public API 2020-06-29 16:08:06 +03:00
Mikhail Glukhikh
ca5e560f1f [FIR2IR] Introduce lazy constructors 2020-06-29 16:08:05 +03:00
Mikhail Glukhikh
fcabd02fe8 [FIR] Take class expect flag into account in its substitution scope 2020-06-29 16:08:00 +03:00
Mikhail Glukhikh
c1609ed490 [FIR] Make expect class members also expect 2020-06-29 16:07:50 +03:00
Mikhail Glukhikh
2fefa682b7 [FIR2IR] Do not compose signature for local class members 2020-06-29 16:07:49 +03:00
Mikhail Glukhikh
9a0e763761 [FIR2IR] Require classId from parent class for fake overrides 2020-06-29 16:07:48 +03:00
Mikhail Glukhikh
34a2196295 FirClassSubstitutionScope: extract SubstitutedData & reorder functions 2020-06-29 16:07:43 +03:00
Mikhail Glukhikh
bf009a4949 [FIR2IR] Handle delegating constructor call type arguments properly 2020-06-29 16:07:30 +03:00
Mikhail Glukhikh
2cffbadbd5 [FIR2IR] Use overridden symbol when handling delegating constructor call 2020-06-29 16:07:29 +03:00
Mikhail Glukhikh
456508a332 IR SymbolTable: don't allow unbound symbols in declare by signature only 2020-06-29 16:07:27 +03:00
Mikhail Glukhikh
7243d04f58 [FIR2IR] Simplification of property building in lazy class 2020-06-29 16:07:26 +03:00
Mikhail Glukhikh
a8db7b3ba6 [FIR2IR] Simplification of function building in lazy class 2020-06-29 16:07:25 +03:00
Mikhail Glukhikh
f7be373711 Add extra parent checks in Fir2IrLazyClass 2020-06-29 16:07:24 +03:00
Ivan Kylchik
13f7b6a22e Create separate constructor for ir interpreter with only ir builtins
By introducing this constructor, ir interpreter will no longer find ir
exceptions in module and so interpreter is creating faster for fir2ir
goals
2020-06-29 15:27:26 +03:00
Ivan Kylchik
de2b20482a Allow IrConstTransformer to visit and evaluate vararg elements 2020-06-29 15:27:25 +03:00
Ivan Kylchik
6fa03297f9 Allow IrConstTransformer to visit annotations of all declarations 2020-06-29 15:27:25 +03:00
Ivan Kylchik
c87b12ec2f Speed up fir2ir constant evaluation
This fix extract IrConstTransformer object to a common variable and all
files then use it
2020-06-29 15:27:24 +03:00
Mikhail Zarechenskiy
032fdd63d9 Ignore codegen test for Android
There is no such method as java.util.List.stream
2020-06-29 15:26:20 +03:00
Leonid Startsev
6ea0c37e52 Update test data with new package name after 901d8f3e7a 2020-06-29 15:09:30 +03:00
Mikhail Zarechenskiy
6efa7a51c6 Fix priority for "add import" action wrt DeprecatedSinceKotlin 2020-06-29 14:25:09 +03:00
Mikhail Zarechenskiy
beca7fca30 Fix completion order & presentation wrt to DeprecatedSinceKotlin 2020-06-29 14:25:09 +03:00
Mikhail Zarechenskiy
bcaa635a4e Fix parameter info presentation with regard to DeprecatedSinceKotlin 2020-06-29 14:25:09 +03:00
Mikhail Zarechenskiy
9be8c5b527 Update test data about built-ins 2020-06-29 14:25:09 +03:00
Mikhail Zarechenskiy
b7df9ec05a Implement equals/hashCode as this class previously was a data one
Fixes duplicated diagnostics in tests
2020-06-29 14:25:08 +03:00
Mikhail Zarechenskiy
a2da00eb49 Prohibit using DeprecatedSinceKotlin outside kotlin subpackage 2020-06-29 14:25:08 +03:00
Mikhail Zarechenskiy
790433984b Prohibit using DeprecatedSinceKotlin annotation without arguments 2020-06-29 14:25:08 +03:00
Mikhail Zarechenskiy
67100d5ebe Reject values of DeprecatedSince.. that are not parseable as a version 2020-06-29 14:25:07 +03:00
Mikhail Zarechenskiy
5d88058928 Place DeprecatedSinceKotlin annotation under 1.4 version 2020-06-29 14:25:06 +03:00
Mikhail Zarechenskiy
2f55a3fa0d Add various test for DeprecatedSinceKotlin annotation 2020-06-29 14:23:26 +03:00
Mikhail Zarechenskiy
0f2c96c64d Don't perform additional lookups for DeprecatedSinceKotlin annotation
There is no need to check it as `DeprecatedSinceKotlin` can be used
 only along with `Deprecated` annotation
2020-06-29 14:23:22 +03:00
Mikhail Zarechenskiy
158013ef3a Remove message and replaceWith parameters from DeprecatedSinceKotlin 2020-06-29 14:22:33 +03:00
Mikhail Zarechenskiy
60c51476f2 Introduce declaration checker for DeprecatedSinceKotlin annotation
- DeprecatedSinceKotlin annotation should only be applicable when
   there's `@Deprecated` annotation on the same declaration
 - Deprecation level shouldn't be specified in the relevant
   `@Deprecated` annotation
 - Check that warningSince <= errorSince <= hiddenSince
2020-06-29 14:22:32 +03:00
Alexander Udalov
0aaf29c045 Introduce DeprecatedSinceKotlin annotation
This annotation will be used in the standard library to prevent the new
compiler from reporting deprecation diagnostics in case an older API
version is used (where the declaration was not deprecated yet).

 #KT-23575 Fixed
2020-06-29 14:22:29 +03:00
Dmitriy Dolovov
b2022144e6 [Commonizer] Fast-pass for library fragments absent for some targets
^KT-39897
2020-06-29 16:40:59 +07:00
Dmitriy Novozhilov
ee22488ab2 [FIR] Cleanup FIR modules. Part 8 (types package) 2020-06-29 12:19:06 +03:00
Dmitriy Novozhilov
2c3fe8b8ec [FIR] Cleanup FIR modules. Part 7 (scopes package) 2020-06-29 12:19:06 +03:00
Dmitriy Novozhilov
c6124f6d56 [FIR] Cleanup FIR modules. Part 6 (transformers package) 2020-06-29 12:19:05 +03:00
Dmitriy Novozhilov
e817f919c2 [FIR] Cleanup FIR modules. Part 5 (body.resolve package) 2020-06-29 12:19:05 +03:00
Dmitriy Novozhilov
285b6d28af [FIR] Cleanup FIR modules. Part 4 (providers and resolve packages) 2020-06-29 12:19:05 +03:00
Dmitriy Novozhilov
1d90302848 [FIR] Cleanup FIR modules. Part 3 (inference package) 2020-06-29 12:19:05 +03:00
Dmitriy Novozhilov
1766c22f6f [FIR] Cleanup FIR modules. Part 2 (dfa package) 2020-06-29 12:19:04 +03:00
Dmitriy Novozhilov
604c68b3a0 [FIR] Cleanup FIR modules. Part 1 (calls package) 2020-06-29 12:19:04 +03:00
Dmitriy Novozhilov
1ac0e8449b [FIR] Move FirJavaTypeRef to fir.jvm module 2020-06-29 12:19:04 +03:00
Dmitriy Novozhilov
fd1de9b298 [FIR] Fix typo in FirCloneableSymbolProvider 2020-06-29 12:19:03 +03:00
Dmitriy Novozhilov
57b9baac53 [FIR] Get rid of FirSession.inferenceContext
Leave only FirSession.typeContext
2020-06-29 12:19:03 +03:00
Dmitriy Novozhilov
43bb60addb [FIR] Remove workaround for KT-39659 2020-06-29 12:19:03 +03:00
Dmitriy Novozhilov
7834284bec [FIR] Support deserialization of value parameter annotations
There are still some problems, see KT-39837
2020-06-29 12:19:03 +03:00
Dmitriy Novozhilov
2b2f9b3386 [FIR] Remove delegate specific methods from abstract inference session 2020-06-29 12:19:02 +03:00
Dmitriy Novozhilov
9c6ed2ea02 [FIR] Complete delegate calls in default inference session 2020-06-29 12:19:02 +03:00
Dmitriy Novozhilov
dbbb999952 [FIR] Support builder (coroutine) inference
#KT-37431 Fixed
2020-06-29 12:19:02 +03:00
Dmitriy Novozhilov
6a9504f26a [FIR-TEST] Add coroutines diagnostic tests from old FE to FIR test suite 2020-06-29 12:19:02 +03:00
Dmitriy Novozhilov
d0affc6c6a [FIR] Rename ResolverParts.kt to ResolutionStages.kt 2020-06-29 12:19:01 +03:00
Dmitriy Novozhilov
de1b5cd056 [FIR] Add extracting @Exact and @NoInfer attributes from annotations
(cherry picked from commit e4c8c14e3e)
2020-06-29 12:19:01 +03:00
Dmitriy Novozhilov
7ab3dd04a0 [FIR] Add attributes for @Exact and @NoInfer
(cherry picked from commit e43932f147)
2020-06-29 12:19:01 +03:00
Dmitriy Novozhilov
ac51e5dbd1 [FIR] Add workaround for KT-19306 2020-06-29 12:19:00 +03:00
Dmitriy Novozhilov
3f5db6b86e [FIR] Add ConeAttributes to ConeKotlinType
(cherry picked from commit f76befa84e)
2020-06-29 12:19:00 +03:00
Dmitriy Novozhilov
e76f3f93f6 [FIR] Move ArrayMap to cones module
(cherry picked from commit 407d1365bd)
2020-06-29 12:19:00 +03:00
Abduqodiri Qurbonzoda
d3fb9cc5f3 Deprecate with error mixed Int/FP contains operator for ranges KT-22423 2020-06-29 12:18:19 +03:00
Vladimir Dolzhenko
ab20b3e083 Add InterruptedException handler to CancellableSimpleLock
#EA-220650 Fixed
2020-06-29 08:47:53 +00:00
Vladimir Dolzhenko
a9444c386d Use actual import list on PlainTextPaste
#EA-225256 Fixed
2020-06-29 08:47:52 +00:00
Dmitry Gridin
30f98e6730 Inline refactoring: shouldn't lose return type information
#KT-26705 Fixed
2020-06-29 07:55:21 +00:00
Dmitry Gridin
c3b726f10a Inline refactoring: should add explicit type argument for parameters
#KT-17402 Fixed
2020-06-29 07:55:20 +00:00
Dmitry Gridin
45234c9784 Inline refactoring: fix case with introduction of variable to return
#KT-39818 Fixed
2020-06-29 07:55:20 +00:00
Andrey Uskov
f4e9acb233 Escape arguments when Gradle plugin launches out of process compilation
#KT-39755 Fixed
2020-06-28 11:38:04 +03:00
Yunir Salimzyanov
90dae320c3 Specify full name of parametrized flaky test to synchronize it on TeamCity
KTI-239
2020-06-27 13:29:18 +03:00
Yunir Salimzyanov
b795e50e61 Add logic to synchronize muted tests on teamcity with database flaky tests
KTI-239
2020-06-27 13:29:18 +03:00
Yunir Salimzyanov
a382bef144 Extract classes and related functions of muteWithDatabase to separate module 2020-06-27 13:29:18 +03:00
Yunir Salimzyanov
4474077963 Create separate module for muting tests logic 2020-06-27 13:29:17 +03:00
Georgy Bronnikov
5e115c48b3 Unmute FIR test 2020-06-27 00:25:34 +03:00
Shagen Ogandzhanian
8a393ec041 Update dukat dependency to 0.5.4 2020-06-26 21:05:21 +02:00
Leonid Startsev
901d8f3e7a Rename several core entities as a part of kx.serialization abi change 2020-06-26 20:31:23 +03:00
Leonid Startsev
5208bbcd21 Support new ContextSerializer signature 2020-06-26 20:31:22 +03:00
Toshiaki Kameyama
7ea1700b78 Convert lambda to reference: support generic function call
#KT-14578 Fixed
#KT-14395 Fixed
2020-06-26 20:30:39 +03:00
Dmitry Petrov
2137a4b1e5 JVM, JVM_IR: no nullability annotations on private and synthetic methods
NB it looks like it doesn't cover all cases, e.g., some synthetic
methods generated for suspend functions.
2020-06-26 18:51:35 +03:00
Georgy Bronnikov
5684e694b5 JVM_IR: handle diamond inheritance for Java fields 2020-06-26 18:46:41 +03:00
Anton Bannykh
da79f93c61 JS IR: per-module .js generation support 2020-06-26 17:55:33 +03:00
Anton Bannykh
deb5dc1057 Don't merge files into a single module 2020-06-26 17:55:33 +03:00
Anton Bannykh
5239ab477c Lowerings apply to a list of modules 2020-06-26 17:55:33 +03:00
Anton Bannykh
9a1d9814de Simpify phase building 2020-06-26 17:55:33 +03:00
Anton Bannykh
2e68526b44 Merge ES6 pipeline 2020-06-26 17:55:32 +03:00
Anton Bannykh
a1c9ee1013 Mute failing ES6 phases 2020-06-26 17:55:32 +03:00
Alexey Trilis
955087868a KT-39843 Update project wizard templates after replacing kotlin.browser with kotlinx.browser
#KT-39843 Fixed
2020-06-26 17:54:02 +03:00
Denis Zharkov
66e53305bf FIR: Leave only one composite-like scope implementation 2020-06-26 16:52:10 +03:00
Denis Zharkov
09bb755088 FIR: Pass scope to FirSpecificTypeResolverTransformer as data 2020-06-26 16:52:10 +03:00
Denis Zharkov
cea38771f1 FIR: Unbound TypeResolver from IterableScope 2020-06-26 16:52:10 +03:00
Denis Zharkov
b607cecc2b FIR: Clear JavaTypeParameterStack
- Remove unused method
- Rename method to make it findable through "Find usages"
2020-06-26 16:52:10 +03:00
Denis Zharkov
f3e4e9b162 FIR: Make qualifier have only one static scope
It's more correct as that's how it works in FE 1.0
2020-06-26 16:52:10 +03:00
Denis Zharkov
a017109d7d FIR: Use static scope for importing from non-object classes 2020-06-26 16:52:10 +03:00
Denis Zharkov
396c6377f8 FIR: Do not check statics in MemberScopeTowerLevel
Type scopes should not contain them anymore
2020-06-26 16:52:10 +03:00
Denis Zharkov
9668a60151 FIR: Explicitlty separate static and member scopes
For Java, they have rather different semantics considering "overrides"
and obtaining functions/properties from supertypes

See the Java statics implementation
2020-06-26 16:52:10 +03:00
Denis Zharkov
e058c578a8 FIR: Minor. Make method private 2020-06-26 16:52:10 +03:00
Denis Zharkov
24d7d208a0 FIR: Extract Java class rendering in tests 2020-06-26 16:52:10 +03:00
Denis Zharkov
9b5b882dcb Add "*.jar binary" to .gitattributes 2020-06-26 16:52:10 +03:00
Ilya Goncharov
be2d6b99f6 [Gradle, JS] Add test on changing of default value for generating externals 2020-06-26 16:26:13 +03:00
Ilya Goncharov
4bfcb4b041 [Gradle, JS] Use common projectName fun 2020-06-26 16:26:13 +03:00
Ilya Goncharov
89c1af4feb [Gradle, JS] Add tests on changing generating externals for npm deps 2020-06-26 16:26:13 +03:00
Ilya Goncharov
891071e074 [Gradle, JS] Add assertSingleFileExists 2020-06-26 16:26:13 +03:00
Ilya Goncharov
405412f6c1 [Gradle, JS] Use generateExternalsIntegrated instead of full build 2020-06-26 16:26:13 +03:00
Ilya Goncharov
f584fb1576 [Gradle, JS] Add test on integrated dukat task 2020-06-26 16:26:13 +03:00
Ilya Goncharov
1a9f236a60 [Gradle, JS] Add tests on Separate Dukat integration 2020-06-26 16:26:12 +03:00
Ilya Goncharov
007970ded8 [Gradle, JS] Add independent peer npm dependency to test
^KT-39842 fixed
2020-06-26 16:20:45 +03:00
Ilya Goncharov
bd05b447c0 [Gradle, JS] Ignore peer dependencies in yarn resolution
^KT-39842 fixed
2020-06-26 16:20:35 +03:00
Dmitry Petrov
9468670980 Minor: update testData with nullability annotations 2020-06-26 15:17:23 +03:00
Dmitry Petrov
64e47265e1 JVM, JVM_IR: no nullability annotations on lateinit backing fields 2020-06-26 15:08:23 +03:00
Toshiaki Kameyama
e822e871f5 KT-39532 Support intention to convert reference to lambda and vice versa for adapted references (#3495)
* Convert lambda to reference: support a function which has default parameters/unit return type/suspendability

#KT-39532 Fixed
2020-06-26 14:21:17 +03:00
Mikhail Zarechenskiy
a87b25d10e Don't silently ignore argument mismatch for provide delegate
#KT-39816 Fixed
2020-06-26 14:03:49 +03:00
Mikhail Zarechenskiy
ea5fef76d1 Fix ambiguity on reference inside blocks of special functions
#KT-37058 Fixed
2020-06-26 14:03:49 +03:00
Mikhail Zarechenskiy
c2c139ef4f Fix adaptation for references with default values after varargs
After vararg argument it's possible to pass values only by name, so
 here we modulate this behavior

 #KT-37721 Fixed
2020-06-26 14:03:48 +03:00
Mikhail Zarechenskiy
c5a2ab2512 Callable reference adaptation should have dependency on API version 1.4
#KT-38069 Fixed
2020-06-26 14:03:47 +03:00
Mikhail Zarechenskiy
bc40669598 Prohibit functional interface constructor references
#KT-36706 Fixed
2020-06-26 14:03:47 +03:00
Ilya Gorbunov
e3050cd997 Minor tweaks in js api dump run configuration
- parallel build
- clean test results before running tests again
2020-06-26 13:53:49 +03:00
Ilya Gorbunov
94ab50a21a Fixup stdlib-js api dump
Some strange effect related to loading types from kotlin.reflect.
2020-06-26 13:52:05 +03:00
Ilya Kirillov
366a75e222 Wizard: update versions of used libraries for 1.4-M3
#KT-39503 fixed
#KT-39503 fixed
2020-06-26 12:19:35 +03:00
Ilya Kirillov
35d5936829 Wizard: add info about used Kotlin version to project test importing failure 2020-06-26 12:19:34 +03:00
Dmitriy Novozhilov
7ea17f0d31 Revert "[FIR] Move ArrayMap to cones module"
This reverts commit 407d1365
2020-06-26 11:47:20 +03:00
Dmitriy Novozhilov
0b29a3e5c1 Revert "[FIR] Add ConeAttributes to ConeKotlinType"
This reverts commit f76befa8
2020-06-26 11:47:08 +03:00
Dmitriy Novozhilov
76550d3c5d Revert "[FIR] Add attributes for @Exact and @NoInfer"
This reverts commit e43932f1
2020-06-26 11:46:59 +03:00
Dmitriy Novozhilov
c0634217e1 Revert "[FIR] Add extracting @Exact and @NoInfer attributes from annotations"
This reverts commit e4c8c14e
2020-06-26 11:46:50 +03:00
Pavel Kirpichenkov
59e63f549b Add completion highlighting tests for heavy Kotlin files
#KT-37219 In Progress
2020-06-26 11:13:07 +03:00
Pavel Kirpichenkov
5c70f973a5 Force resolution of file annotations before element analysis
^KT-37219 In Progress
2020-06-26 11:13:07 +03:00
Dmitriy Novozhilov
e4c8c14e3e [FIR] Add extracting @Exact and @NoInfer attributes from annotations 2020-06-26 10:54:51 +03:00
Dmitriy Novozhilov
e43932f147 [FIR] Add attributes for @Exact and @NoInfer 2020-06-26 10:54:51 +03:00
Dmitriy Novozhilov
f76befa84e [FIR] Add ConeAttributes to ConeKotlinType 2020-06-26 10:54:51 +03:00
Dmitriy Novozhilov
407d1365bd [FIR] Move ArrayMap to cones module 2020-06-26 10:54:50 +03:00
Matts966
36102504a1 Update ReadMe.md 2020-06-26 09:41:57 +02:00
Matts966
20ed42dd38 Update deprecated doc about mac build environment requirements 2020-06-26 09:41:57 +02:00
Toshiaki Kameyama
2fd3af73eb Convert reference to lambda: fix it works correctly when referenced function has default argument
#KT-17222 Fixed
#KT-24138 Fixed
#KT-39532
2020-06-26 10:20:29 +03:00
Mikhail Zarechenskiy
bc34f7f7f5 Add test for obsolete issue
#KT-26345 Obsolete
2020-06-26 07:45:25 +03:00
Abduqodiri Qurbonzoda
a04f70fb36 Fix min/maxByOrNull function samples 2020-06-26 07:16:01 +03:00
Mikhail Zarechenskiy
684ca5029f Add tests for obsolete issues
#KT-37734 Obsolete
 #KT-39824 Obsolete
2020-06-26 06:24:59 +03:00
shiraji
9844607d0f Make string literals clickable
#KT-35732 Fixed
#KT-32403 Fixed
2020-06-25 22:40:39 +02:00
Igor Yakovlev
f06e116bf7 Improved equals for light decompiled declarations 2020-06-25 23:19:54 +03:00
Igor Yakovlev
27c139926c LightClass improved isInheritor check for cases when resolve is failed
Fixed #KT-37210
2020-06-25 23:17:09 +03:00
Guillaume Darmont
e72a06bdf4 Add specific highlight for Enum class
#KT-39844 Fixed
2020-06-25 21:53:19 +02:00
Dmitry Petrov
3f266aafb4 JVM: no nullability annotations on private and synthetic fields 2020-06-25 22:31:12 +03:00
Victor Petukhov
cbd8b58d5c Commit trace for callable reference's LHS with reserved syntax like foo?::bar?::bar to avoid the lack of diagnostics reporting
^KT-35075 Fixed
2020-06-25 20:44:58 +03:00
Ilmir Usmanov
1ee8e615fc Reuse value is ISTORE if expected type is the same, otherwise, create
new value
2020-06-25 18:51:15 +02:00
Ilmir Usmanov
c21820c615 Revert "Revert "Fix merging two reference values""
This reverts commit 1cccceabb9.
2020-06-25 18:51:13 +02:00
Ilmir Usmanov
a6f14c206b Revert "Revert "Revert "Revert "Completely rewrite reifiedIntTypeAnalysis, making it more streamline""""
This reverts commit 447308dcfc.
2020-06-25 18:51:11 +02:00
Kristoffer Andersen
b95d3e711e [JVM IR] KT-36985: $default respects @Deprecated
$default dispatch methods gains @Deprecated if the original function
with default arguments has it.
2020-06-25 18:43:45 +03:00
Ilya Gorbunov
034623f82a Fix top level import quick fix test for JS
There's no longer any JS-only top level function that is not imported
by default, so I used a common non-imported top level function.
2020-06-25 18:36:04 +03:00
Ilya Gorbunov
448e0ceae1 Drop quickfix tests that relied on removed native annotation 2020-06-25 18:36:04 +03:00
Ilya Gorbunov
8dfcebf542 Expose KTypeProjection.STAR constant in a field
#KT-30083
2020-06-25 18:25:24 +03:00
Ilya Gorbunov
53cbcfac5a Validate arguments of KTypeProjection constructor
#KT-34596 Fixed
2020-06-25 18:25:24 +03:00
Ilya Gorbunov
d41e8ed4ad Annotate KTypeProjection factory methods with JvmStatic
#KT-30084 Fixed
2020-06-25 18:25:24 +03:00
Ilya Chernikov
e8659d4b37 Fix initializer error arizing on scripting annotation creation
also fixes tests in main-kts
2020-06-25 17:21:38 +02:00
Vladimir Dolzhenko
3585f80c67 Fix 201 compilation
Relates to #KT-17926
2020-06-25 17:15:13 +02:00
Toshiaki Kameyama
12cd3785b0 Move statement: move parameters/arguments with a comment correctly
#KT-34705 Fixed
#KT-34707 Fixed
#KT-34587 Fixed
2020-06-25 15:45:25 +02:00
Raluca Sauciuc
9c8904f165 Restore KotlinExplicitMovementProvider in as40 2020-06-25 15:06:27 +02:00
Norbert Nogacki
990903e4e2 Show documentation for a class if the constructor has no docs
#KT-17926 Fixed
2020-06-25 14:42:03 +02:00
Mikhail Glukhikh
699829ccb3 Make FIR multi-module tests from IDE regular FIR compiler resolve tests 2020-06-25 12:35:25 +03:00
Ivan Kylchik
79691feb8f Fix fir load compiled kotlin tests after introducing const deserializer 2020-06-25 12:30:24 +03:00
Ivan Kylchik
027d177c15 Remove IGNORE_FIR from tests that are using unsigned constants 2020-06-25 12:30:23 +03:00
Ivan Kylchik
c80cf0f34c Remove IGNORE_FIR from ranges tests 2020-06-25 12:30:21 +03:00
Ivan Kylchik
70f0f357fa Remove IGNORE_FIR from stepped ranges tests 2020-06-25 12:30:19 +03:00
Ivan Kylchik
6c6b7c8b84 Implement constant deserializer for fir
This deserializer is uniform loader, that is responsible for loading
all constants. For example, Math.E, UInt.MAX_VALUE or Float.MIN_VALUE.
2020-06-25 12:30:19 +03:00
Kirill Shmakov
b62e22cb01 Fix Android app in template project 2020-06-25 11:54:23 +03:00
Ivan Kylchik
895c32e21c Create separate source set for interpreter map generator
A separate source set is needed so that the generator no longer depends
on the generated code
2020-06-25 10:45:19 +03:00
Ilya Gorbunov
643d339496 Advance bootstrap to 1.4.20-dev-1080 2020-06-25 02:37:39 +03:00
Vladimir Ilmov
d6483ace94 (UltraLightClasses) fix for processing stubs for Deprecation.HIDDEN annotation fast-path 2020-06-25 00:39:34 +02:00
Mikhail Zarechenskiy
a5ae1b38b0 Don't skip constraints from equations with the kind equal
The problem was that we didn't incorporate T == Foo into K <: Inv<out T>.
 It happened because of optimisation that isn't applicable here as we
 already have projection in the initial type

 #KT-39777 Fixed
2020-06-24 23:36:59 +03:00
Toshiaki Kameyama
ab34f8c738 Add indent before accessor for extension property (KT-33131)
#KT-33131 Fixed
2020-06-24 21:42:02 +02:00
Alexander Udalov
c6a481190a JVM: optimize type mapping for primitive types 2020-06-24 19:26:59 +02:00
Alexander Udalov
64f7c3f498 IR: do not use descriptors in IrTypeSystemContext.getPrimitiveType
Also optimize getPrimitiveType and getPrimitiveArrayType. Convert
PrimitiveType to Kotlin to leverage the switch over string optimization,
which is not possible in Java 6 (which is used to compile
'descriptors').
2020-06-24 19:26:59 +02:00
Alexander Udalov
7013becda5 IR: remove IrBuiltInOperator, use IrFunctionImpl instead
It seems that this is no longer needed. This change in particular helps
to avoid megamorphic interface call on IrValueParameter.accept, which
happens a lot because there are usually many value parameters.
2020-06-24 19:26:55 +02:00
Alexander Udalov
988226a90e IR: optimize FqNameEqualityChecker.checkViaDeclarations 2020-06-24 19:16:12 +02:00
Alexander Udalov
014d855449 IR: minor, make all overrides in IrElementTransformerVoid final 2020-06-24 19:16:11 +02:00
Alexander Udalov
3c90e25cb4 IR: optimize IrType.isNullable, do not use DFS
DFS is not justified for type usages. In contrast to type hierarchies,
traversing the type usage naively with recursion has linear, not
exponential, complexity.
2020-06-24 19:16:11 +02:00
pavlospt
597bc061e2 Add Kotlin Data Class, Sealed Class and Annotation file templates
#KT-20775 Fixed
2020-06-24 16:25:51 +02:00
Toshiaki Kameyama
2162c39ab3 Quick doc: show default parameter value
#KT-19069 Fixed
2020-06-24 16:20:21 +02:00
Ilya Gorbunov
33150a0809 KT-38817 capitalize uses title case for the first char where available
This unifies its behavior with new capitalize overload with Locale.

Co-authored-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2020-06-24 16:45:09 +03:00
Ilya Gorbunov
9e2f95233c Promote capitalize/decapitalize with Locale to stable
Relates to KT-28933
2020-06-24 16:45:08 +03:00
Ivan Kylchik
e34246faec Fix fir2ir text tests after introducing const evaluator 2020-06-24 16:13:02 +03:00
Ivan Kylchik
8044b47984 Create internalName extension method that returns fqName as jvm internal 2020-06-24 16:13:02 +03:00
Ivan Kylchik
ddd03373cc Allow to interpret toString method from Any class for ONLY_BUILTINS mode
This change aims to support string concatenation operation with const
properties
2020-06-24 16:13:02 +03:00
Ivan Kylchik
6f4f7dd090 Remove coroutines from ir interpreter 2020-06-24 16:13:01 +03:00
Ivan Kylchik
f028d6c898 Move interpreter files to separate module 2020-06-24 16:13:01 +03:00
Ivan Kylchik
64aa0ec5c8 Add new module for ir interpreter 2020-06-24 16:13:01 +03:00
Ivan Kylchik
49124709b8 Remove all usages of descriptors from interpreter 2020-06-24 16:13:01 +03:00
Ivan Kylchik
e4f88e83fe Get rid of compile time check in generator for ir builtins map
These checks are unnecessary because we use all methods from given
classes
2020-06-24 16:13:01 +03:00
Ivan Kylchik
2534b15553 Remove descriptors.jvm dependency from common backend module
Common backend should not depend on JVM parts
2020-06-24 16:13:00 +03:00
Ivan Kylchik
8f6a1b418d Add method to evaluate constant expressions in ir module for fir2ir 2020-06-24 16:13:00 +03:00
Ivan Kylchik
fa221af1b1 Move IrConstTransformer.kt to evaluate package 2020-06-24 16:13:00 +03:00
Ivan Kylchik
932ce71093 Rename method checkForError to replaceIfError
This name better reflects the point of this method.
a.replaceIfError(b) will return b instead of a in case a is an error
expression
2020-06-24 16:13:00 +03:00
Ivan Kylchik
b71c74c6ef Remove descriptor usages in Primitive.kt 2020-06-24 16:13:00 +03:00
Ivan Kylchik
0c6d485c9c Rename ReturnLabel.NEXT to ReturnLabel.REGULAR
This name better describe that this label mean: execution was finished
regular and there is no need to make special processing
2020-06-24 16:13:00 +03:00
Ivan Kylchik
9377d274a8 Drop ExecutionResult class implementations and make it regular class
There was 2 implementations that I managed to combine
2020-06-24 16:12:59 +03:00
Ivan Kylchik
c386cbeb54 Move checkNullability function in State.kt file 2020-06-24 16:12:59 +03:00
Ivan Kylchik
e57de9a08f Mark most of classes and functions from interpreter package as internal
Main goal is to avoid ambiguity because some names, that are used by
interpreter, can be found in other modules
2020-06-24 16:12:59 +03:00
Ivan Kylchik
27c52f54ca Remove IGNORE_FIR from tests that are passing after constant folding 2020-06-24 16:12:59 +03:00
Ivan Kylchik
f20e878d35 Add constant folding after FIR2IR processing 2020-06-24 16:12:59 +03:00
Ivan Kylchik
f2045b857b Add fix for interpretation const val
After FIR2IR processing getter doesn't has body, but has initializer.
On the other hand common IR has body for const val getter
2020-06-24 16:12:59 +03:00
Ivan Kylchik
af6ed5ca43 Change toIrConst extension function logic
For now this function check not value, but type. By ir type it create
right ir const
2020-06-24 16:12:59 +03:00
Ivan Kylchik
3155f56d8a Change the way of receiving fields
Before that, interpreted values for fields were taken by backing
field's symbol. For now, they will be taken by property's symbol.
It was done because not all properties contain backing field. For
example, Throwable class in FIR2IR.
2020-06-24 16:12:58 +03:00
Ivan Kylchik
8644c48b28 Prevent interpretation of call expression with continue/break statement
Example: foo("" + continue)
2020-06-24 16:12:58 +03:00
Ivan Kylchik
d90aba60cc Implement correct type checks and casts taking into account erased types 2020-06-24 16:12:58 +03:00
Ivan Kylchik
7a19906705 Change all usages of descriptors in interpreter to usages of ir symbols 2020-06-24 16:12:58 +03:00
Ivan Kylchik
db5046af85 Add support in interpreter for jvm static fields in primitive classes 2020-06-24 16:12:58 +03:00
Ivan Kylchik
a3c77eca08 Make interpreter maps of enum and object declarations non static
Instead of this just create interpreter once per module handling
2020-06-24 16:12:58 +03:00
Ivan Kylchik
ff830cc744 Make state property mutable in Variable class
This change allow to remove copy method from State interface
2020-06-24 16:12:57 +03:00
Ivan Kylchik
848ca70de1 Change keys in static maps of enums and objects from String to IrSymbol 2020-06-24 16:12:57 +03:00
Ivan Kylchik
224d56ec15 Allow compile time calculations inside object declaration 2020-06-24 16:12:57 +03:00
Ivan Kylchik
1c498660dc Create ir compile time checker
This checker is suppose to return true if ir node can be computed
in compile time
2020-06-24 16:12:57 +03:00
Ivan Kylchik
19495e40f7 Remove unnecessary getAllTypeArguments method from Stack class 2020-06-24 16:12:57 +03:00
Ivan Kylchik
99d823da8a Remove unnecessary getThisAsReceiver function from Utils.kt file 2020-06-24 16:12:57 +03:00
Ivan Kylchik
c6240face0 Add test for generation builtins map for interpreter 2020-06-24 16:12:57 +03:00
Ivan Kylchik
1103de4bd5 Prepare ir interpreter for receiving ir bodies in separate map
This change will be useful when starts work with jvm klib
2020-06-24 16:12:56 +03:00
Ivan Kylchik
9542eb36ec Support interpretation of String's plus method and its extension version 2020-06-24 16:12:56 +03:00
Ivan Kylchik
94e36411fa Support interpretation for inner class 2020-06-24 16:12:56 +03:00
Ivan Kylchik
0c1f2edbf2 Get rid of abstract and fake override checks in ir call interpretation
For now interpreter will find necessary method for interpretation in
one step instead of checking is this method abstract or fake override
2020-06-24 16:12:56 +03:00
Ivan Kylchik
80d83f8703 Change check for Wrapper method
For now method is wrapper if its receiver is Wrapper and
method itself isn't inline only
2020-06-24 16:12:56 +03:00
Ivan Kylchik
38822c3bf8 Implement correct interpretation of toList function 2020-06-24 16:12:56 +03:00
Ivan Kylchik
ba8147cd47 Allow lambda to be used in built in calculation
Primary use case to allow lambda null check
2020-06-24 16:12:55 +03:00
Ivan Kylchik
5f61f6f3a5 Simplify interpretation for java methods with names other in kotlin 2020-06-24 16:12:55 +03:00
Ivan Kylchik
2e0d4c9af1 Add correct interpretation for unsigned arrays in vararg method handler 2020-06-24 16:12:55 +03:00
Ivan Kylchik
30f2affb93 Add support for local function that are declared and called immediately 2020-06-24 16:12:55 +03:00
Ivan Kylchik
296f343cab Change conditions for saving type arguments into stack
For now all type arguments are saved. This is necessary for several
reason:
1. ir type operator call need to get right type argument class
2. if class is local then information about type argument cannot be lost
2020-06-24 16:12:55 +03:00
Ivan Kylchik
a095309e10 Allow local declaration interpretation
By local declaration is meant local functions and local objects
2020-06-24 16:12:55 +03:00
Ivan Kylchik
2c93c46b84 Implement do while loop 2020-06-24 16:12:55 +03:00
Ivan Kylchik
1e82975a7c Replace explicit returnLabel call to check call inside try interpreter 2020-06-24 16:12:54 +03:00
Ivan Kylchik
a14e8e4c28 Implement cache for enum entries and objects 2020-06-24 16:12:54 +03:00
Ivan Kylchik
0b0550f562 Remove useless Intrinsic interface
Moved all its methods inside sealed class
2020-06-24 16:12:54 +03:00
Ivan Kylchik
eb3ac74c3f Move out intrinsic evaluation from interpreter class 2020-06-24 16:12:54 +03:00
Ivan Kylchik
6eae77572a Move stack trace inside Stack class 2020-06-24 16:12:54 +03:00
Ivan Kylchik
e00dc76645 Simplify constructor interpretation
Unified case with secondary and primary constructors
2020-06-24 16:12:53 +03:00
Ivan Kylchik
cf63a5f52b Replace some casts to Primitive with corresponding extension calls 2020-06-24 16:12:53 +03:00
Ivan Kylchik
5791ecd4f7 Remove redundant suspend modifiers 2020-06-24 16:12:53 +03:00
Ivan Kylchik
cb0eb008f8 Implement correct access to stack
Rewrote work with data and implement Stack class that work over Frame
2020-06-24 16:12:53 +03:00
Ivan Kylchik
06e6c7cdf5 Implement interpretation for object with overridden methods 2020-06-24 16:12:53 +03:00
Ivan Kylchik
fe7abb7132 Remove unnecessary code about handling KotlinNullPointerException
This part of code was necessary because jvm threw
KotlinNullPointerException, but js expected NullPointerException.
2020-06-24 16:12:53 +03:00
Ivan Kylchik
2f41eef797 Replace throw of interpreter errors by throw of InterpreterException 2020-06-24 16:12:53 +03:00
Ivan Kylchik
aed78f3c9b Bound commands limit and throw interpreter exception upon exceeding 2020-06-24 16:12:52 +03:00
Ivan Kylchik
be42ae470d Simplify extraction logic of receiver in ir call interpreter 2020-06-24 16:12:52 +03:00
Ivan Kylchik
2189fe5796 Add suspend modifier to getNextLabel method in Label interface 2020-06-24 16:12:52 +03:00
Ivan Kylchik
fd51a9a085 Change signature in getArgsForMethodInvocation method 2020-06-24 16:12:52 +03:00
Ivan Kylchik
30e352ea27 Move Variable data class to separate file 2020-06-24 16:12:52 +03:00
Ivan Kylchik
ef4e4881b7 Implement spread operator interpretation 2020-06-24 16:12:52 +03:00
Ivan Kylchik
c9e5b6a234 Unify value arguments interpretation 2020-06-24 16:12:52 +03:00
Ivan Kylchik
520f2455b3 Create and implement ExecutionResult interface to use as return status
This is replacement for Code enum class that was returned from
methods of interpreter earlier
2020-06-24 16:12:51 +03:00
Ivan Kylchik
77978637a8 Move all classes from State.kt into separate files 2020-06-24 16:12:51 +03:00
Ivan Kylchik
530252eea8 Move State.kt in separate package 2020-06-24 16:12:51 +03:00
Ivan Kylchik
7e7a5fe736 Add reference to sub class in Complex class
This is replacement for instance field
2020-06-24 16:12:51 +03:00
Ivan Kylchik
ad7055b8a0 Move additional stack filling in ExceptionState class 2020-06-24 16:12:51 +03:00
Ivan Kylchik
900e78b39b Add hashCode, equals and toString methods from String in builtin map 2020-06-24 16:12:51 +03:00
Ivan Kylchik
82acf7deb6 Change getting function receiver for method with multiple overridden 2020-06-24 16:12:50 +03:00
Ivan Kylchik
0400a62014 Improve receivers search in data pool 2020-06-24 16:12:50 +03:00
Ivan Kylchik
b6cf17af1b Save context of inline and local functions 2020-06-24 16:12:50 +03:00
Ivan Kylchik
28d6752315 Change usages of IrFunctionImpl to more common IrSimpleFunction 2020-06-24 16:12:50 +03:00
Ivan Kylchik
c45993b2b1 Implement interpretation for return statements with labels 2020-06-24 16:12:50 +03:00
Ivan Kylchik
5c845da18a Implement interpretation for unsigned numbers 2020-06-24 16:12:50 +03:00
Ivan Kylchik
b175f46315 Implement interpretation of Char and Long classes from js stdlib 2020-06-24 16:12:50 +03:00
Ivan Kylchik
2310a04e4e Add toString, hashCode and equals primitives methods in ir builtin map 2020-06-24 16:12:49 +03:00
Ivan Kylchik
00366197f8 Implement interpretation of Enum class hashCode method 2020-06-24 16:12:49 +03:00
Ivan Kylchik
6a9f4cf8b7 Change interpretCall to be able to interpret data class copy method 2020-06-24 16:12:49 +03:00
Ivan Kylchik
bab4407c0a Implement interpretation for destructing declaration 2020-06-24 16:12:49 +03:00
Ivan Kylchik
ff6e06aa14 Implement regular expression interpretation 2020-06-24 16:12:49 +03:00
Ivan Kylchik
4d80d17b23 Implement interpretation for expect enum class 2020-06-24 16:12:49 +03:00
Ivan Kylchik
731fb9bc70 Make ir interpreter to work with minimal dependence on ir lowerings 2020-06-24 16:12:48 +03:00
Ivan Kylchik
4c1727b82e Move intrinsic handling inside IrInterpreter class 2020-06-24 16:12:48 +03:00
Ivan Kylchik
27e2faa778 Implement enum interpretation 2020-06-24 16:12:48 +03:00
Ivan Kylchik
d6a45dfe75 Implement instance of check in compile time 2020-06-24 16:12:48 +03:00
Ivan Kylchik
0a70277240 Make stack trace from exceptions more precise
Additional information is retrieved from original stack trace when
exception happened during wrapper invocation.
2020-06-24 16:12:48 +03:00
Ivan Kylchik
18d29f7d98 Make possible to create arrays with their constructors 2020-06-24 16:12:47 +03:00
Ivan Kylchik
aca889a95b Add inc, dec methods in ir builtins map and remove toString and equals 2020-06-24 16:12:47 +03:00
Ivan Kylchik
169a2f361c Add support for cause field in exceptions 2020-06-24 16:12:47 +03:00
Ivan Kylchik
6af47ad7b3 Implement basic stack trace reporting if unhandled exception appear 2020-06-24 16:12:47 +03:00
Ivan Kylchik
66dbd1af34 Mark all IrInterpreter methods as suspend
This change is used to get rid of unhandled StackOverflowError and
to be able to manually throw it.
2020-06-24 16:12:47 +03:00
Ivan Kylchik
2985e8bcd3 Clean up code of ir builtins map generator 2020-06-24 16:12:47 +03:00
Ivan Kylchik
cbc9c19faf Add methods for message and clause from Throwable in ir builtins map 2020-06-24 16:12:46 +03:00
Ivan Kylchik
d9279bff73 Introduce ExceptionState class responsible for all kind of exceptions 2020-06-24 16:12:46 +03:00
Ivan Kylchik
be3eb98fbd Introduce new Common state that represent common object
This is a replacement for Complex, that are now an abstract class.
2020-06-24 16:12:46 +03:00
Ivan Kylchik
4345294ac1 Add all methods from Any class in ir builtins map 2020-06-24 16:12:46 +03:00
Ivan Kylchik
d03937cdb6 Pop return value after implicit coercion to unit 2020-06-24 16:12:46 +03:00
Ivan Kylchik
792ae8d272 Get rid of dynamic cast interpretation 2020-06-24 16:12:46 +03:00
Ivan Kylchik
3ccf542b38 Rework object and companion object interpretation
For now object value or fun can be interpreter only if they are
marked explicitly. Annotation for all object is restricted and if
whole class is marked with CompileTimeAnnotation this doesn't
mean that companion object is computable.
2020-06-24 16:12:46 +03:00
Ivan Kylchik
0ef34dcf53 Implement class cast interpretation 2020-06-24 16:12:45 +03:00
Ivan Kylchik
a25896bf6a Implement string concatenation interpretation 2020-06-24 16:12:45 +03:00
Ivan Kylchik
0839e7afdc Describe default behaviour for Any class methods
We are talking about such methods as equals, hashCode and toString.
2020-06-24 16:12:45 +03:00
Ivan Kylchik
a6cc7cdc23 Rewrite exception handler to catch null pointer exception in js ir
For now null check works as !! operator called in jvm.
So it throw KotlinNullPointerException, but js ir require
NullPointerException
2020-06-24 16:12:45 +03:00
Ivan Kylchik
5209f4a9c0 Add not null (!!) operator in ir builtins map 2020-06-24 16:12:45 +03:00
Ivan Kylchik
bb119280be Interpret basic interpretation for try catch block 2020-06-24 16:12:45 +03:00
Ivan Kylchik
b5778e6de5 Implement interpretation for lambdas and anonymous functions 2020-06-24 16:12:45 +03:00
Ivan Kylchik
4fdfdb9b4c Implement StringBuilder interpretation 2020-06-24 16:12:44 +03:00
Ivan Kylchik
06ee4ac21f Implement List and MutableList interpretation 2020-06-24 16:12:44 +03:00
Ivan Kylchik
9555497d5d Implement arrayOf symbols interpretation 2020-06-24 16:12:44 +03:00
Ivan Kylchik
4dc1e587b4 Implement vararg interpretation 2020-06-24 16:12:44 +03:00
Ivan Kylchik
45555d681d Add methods from arrays classes in ir builtins map 2020-06-24 16:12:44 +03:00
Ivan Kylchik
3ab7c263d0 Implement continue statement interpretation 2020-06-24 16:12:44 +03:00
Ivan Kylchik
c4cc858b84 Extract ir function interpretation in separate method
This modification will be used to get exception stack trace
2020-06-24 16:12:44 +03:00
Ivan Kylchik
f99829ce5e Implement trim function interpretation in compile time 2020-06-24 16:12:43 +03:00
Ivan Kylchik
178b2a07ae Move all interpreter methods inside IrInterpreter class 2020-06-24 16:12:43 +03:00
Ivan Kylchik
f8cb637712 Change IrInterpreter to modify tree structure into the flat one
This modification is necessary to implement right control flow
2020-06-24 16:12:43 +03:00
Ivan Kylchik
0a76da99cf Implement equalTo function for descriptors 2020-06-24 16:12:43 +03:00
Ivan Kylchik
dd93deddd7 Add while loop support in interpreter 2020-06-24 16:12:43 +03:00
Ivan Kylchik
c2a70b4e57 Add rangeTo entry in builtins map 2020-06-24 16:12:43 +03:00
Ivan Kylchik
34a59f5b85 Add abstract classes and interfaces support in interpreter 2020-06-24 16:12:42 +03:00
Ivan Kylchik
b1dc403182 Add branches support in interpreter 2020-06-24 16:12:42 +03:00
Ivan Kylchik
dcd8a4a4c7 Add variables support in interpreter 2020-06-24 16:12:42 +03:00
Ivan Kylchik
aca7a49214 Add some sort of correct calculation with const modifier 2020-06-24 16:12:42 +03:00
Ivan Kylchik
a20269bcdd Extract some methods to utils 2020-06-24 16:12:42 +03:00
Ivan Kylchik
11e808715b Rethink main goal of stack frame 2020-06-24 16:12:42 +03:00
Ivan Kylchik
c3600ba114 Implement interpreter that can evaluate simple fun
For now working cases are: create simple object using primary
constructor, invoke its method, invoke superclass method,
load/save fields. Return values from compile time function can be
only primitives for now.
2020-06-24 16:12:42 +03:00
Ivan Kylchik
a582d88cf4 Create simple stack model for interpreter 2020-06-24 16:12:41 +03:00
Ivan Kylchik
f6373a647e Create simple interpreter that evaluate constant values 2020-06-24 16:12:41 +03:00
Ivan Kylchik
a27a07ce81 Create generator for map with builtin operations 2020-06-24 16:12:41 +03:00
Dmitry Petrov
e9570d6efd Minor: update testData 2020-06-24 16:04:38 +03:00
Toshiaki Kameyama
6b2c87020b Replace explicit parameter with 'it': do not suggest when lambda is directly under "when" or "if"
Relates to #KT-35320
2020-06-24 14:55:30 +02:00
Georgy Bronnikov
daab07ea38 JVM_IR: use MetadataSource for local delegated properties 2020-06-24 14:41:01 +03:00
Alexey Trilis
593684ecb6 Fix testdata after changing API of kotlin.browser and kotlin.dom 2020-06-24 13:38:29 +03:00
Toshiaki Kameyama
e6edab1c82 Quick doc: do not show nullability annotations
#KT-37132 Fixed
2020-06-24 10:45:57 +02:00
Toshiaki Kameyama
e8aa14a283 Method sepatators: show separator between companion object and function
#KT-24352 Fixed
2020-06-24 10:05:27 +02:00
Ilya Chernikov
5942446274 [minor] clean up main-kts-dependencies 2020-06-23 21:56:04 +02:00
Ilya Chernikov
4c34e9dd03 Move main-kts cache test to out-of-process compilation
to avoid clashes with coroutine debugger when running
tests from IntelliJ
2020-06-23 21:56:04 +02:00
Ilya Chernikov
879e22f274 Fix coroutines core shading in main-kts 2020-06-23 21:56:04 +02:00
Gia Thuan Lam
83b52bb109 Enable Input Redirection for KotlinRunConfiguration
#KT-28854 Fixed

(cherry picked from commit 6e55010767b1c1a7c8d23d337bdbd5824dfa2906)
2020-06-23 21:04:09 +02:00
Ilya Goncharov
69e8abfe3c Fix test data for new project wizard in Project Templates 2020-06-23 21:07:35 +03:00
Dmitry Petrov
4e92c79bc4 JVM_IR: don't generate nullability annotations on synthetic declarations
Fixes KT-36993 and some other related issues.
2020-06-23 20:51:48 +03:00
Dmitry Petrov
d477d9eb43 JVM_IR KT-37005: no delegates for @InlineOnly funs in multifile facades 2020-06-23 20:22:41 +03:00
Dmitry Petrov
5bfec7f6bc JVM: don't generate nullability annotations on property delegate fields
Such fields are private, so these annotations are redundant.

They were incorrect, anyway (property type was used instead of delegate
type).
2020-06-23 20:18:42 +03:00
Mikhail Bogdanov
af3bda51ec Fix compilation on mixed hierarchies in compatibility mode 2020-06-23 18:59:04 +02:00
Mikhail Bogdanov
41511898a1 Deprecate DefaultImpl methods in compatibility mode 2020-06-23 18:59:04 +02:00
Mikhail Glukhikh
39740ce440 [FIR2IR] Drop decl. parent set in lazy class (it should be set before) 2020-06-23 19:06:08 +03:00
Mikhail Glukhikh
d08f91bf35 [FIR2IR] Introduce & use lazy function for external class functions 2020-06-23 19:06:08 +03:00
Mikhail Glukhikh
6d07af63cf [FIR2IR] Count IrErrorTypes as not equal for purpose of overriding
This prevents possible type checking exceptions
2020-06-23 19:06:08 +03:00
Mikhail Glukhikh
d02d423d45 [FIR2IR] Introduce additional built-in symbols prepared in advance
This commit allow to avoid possible conflicts between descriptor-based
and signature-based symbols,
because BE sometimes (e.g. in DeclarationStubGenerator)
creates descriptor-based symbol without checking signature-based
2020-06-23 19:06:07 +03:00
Mikhail Glukhikh
a791a38538 FIR mangler: support definitely not-null types (for Java) 2020-06-23 19:06:07 +03:00
Mikhail Glukhikh
987cf5ef5f Drop unused Fir2IrVisitor.fakeOverrideMode 2020-06-23 19:06:07 +03:00
Mikhail Glukhikh
0622be14a5 [FIR2IR] Introduce creation of Fir2Ir lazy classes 2020-06-23 19:06:07 +03:00
Ilya Goncharov
5e9291bd8a Fix test data for new project wizard 2020-06-23 18:56:16 +03:00
Ilya Goncharov
e6539eade5 Fix new project wizard css support for karma 2020-06-23 18:26:51 +03:00
Dmitry Gridin
b657d60bd6 Suggest Create Class before Create File
#KT-37528 Fixed
2020-06-23 13:29:09 +00:00
Natalia Selezneva
bcd3921bae Fix freeze during loading script configurations through legacy scripting API
Do not wrap the whole configuration loading process into readAction
^KT-39771 Fixed
2020-06-23 16:04:24 +03:00
Alexander Udalov
05e8546bdb Skip unresolved JvmStatic/JvmField annotations in builtins
This is needed to implement KT-30084 and KT-30083 after bootstrap.
2020-06-23 13:55:08 +02:00
Dmitry Gridin
abfc74c8b2 Add regression test
#KT-30131 Fixed
2020-06-23 18:05:17 +07:00
Dmitriy Dolovov
d8fa617bfd Minor. Fix typo in text printed to users 2020-06-23 17:27:14 +07:00
Dmitry Gridin
99f958c8c4 Inline refactoring: should remove redundant Unit
#KT-19443 Fixed
2020-06-23 10:25:54 +00:00
Dmitry Gridin
af24ce5e03 RedundantUnitExpressionInspection: support lambdas
#KT-39772 Fixed
2020-06-23 10:25:53 +00:00
Dmitry Gridin
4ac7dc0744 RedundantUnitExpressionInspection: make isRedundantUnit public 2020-06-23 10:25:53 +00:00
Dmitry Gridin
360a5bf348 Inline refactoring: improve resolve
#KT-39705 Fixed
#KT-19459 Fixed
2020-06-23 10:25:52 +00:00
Dmitry Gridin
5ad94daaa5 ImportOptimizer: cleanup code
#KT-31331
2020-06-23 09:48:07 +00:00
Dmitry Gridin
2610dedcbd KotlinUnusedImportInspection: support unresolved references
#KT-31331 Fixed
2020-06-23 09:48:07 +00:00
Dmitry Gridin
10c62b8d77 ImportOptimizer: add cases for unresolved references
Part of #KT-31331
2020-06-23 09:48:06 +00:00
Dmitry Gridin
4de582564c ImportOptimizer: basic support for removing unresolved imports
#KT-32409 Fixed
Part of #KT-31331
2020-06-23 09:48:05 +00:00
Dmitry Gridin
8faced9192 KotlinImportOptimizer: replace LinkedHashMap with HashMap and BodyResolveMode.FULL with BodyResolveMode.PARTIAL 2020-06-23 09:48:05 +00:00
Dmitry Gridin
383fa2d111 ImportOptimizer: cleanup code 2020-06-23 09:48:04 +00:00
Mikhail Zarechenskiy
e7cee9c6e1 Fix coercion to Unit with equal Nothing constraint
#KT-39669 Fixed
2020-06-23 11:47:39 +03:00
Mikhail Zarechenskiy
a06c8786df Fix overload ambiguity after smartcast to nullable Nothing
#KT-39544 Fixed
2020-06-23 11:34:19 +03:00
Dmitry Gridin
9313073971 LineIndentProvider: temporarily disable before elvis operator
#KT-39716 Fixed
2020-06-23 15:17:47 +07:00
Ilya Goncharov
793ada08a9 cssSettings -> cssSupport 2020-06-23 11:08:30 +03:00
Ilya Goncharov
538cf8af56 Fix test with css case 2020-06-23 11:08:30 +03:00
Ilya Goncharov
4ad95dbe0c Fix browser settings for webpack tasks 2020-06-23 11:08:30 +03:00
Jinseong Jeon
856ac76c8f FIR2IR: handle type alias inside GetClassCall 2020-06-23 09:46:47 +03:00
Ilya Gorbunov
29d3d07636 Remove stdlib-js-ir and kotlin-test-js-ir from coreLibs projects
They do not produce their own deployable artifacts,
their output is merged into stdlib-js and kotlin-test-js.

Remove coreLibsDist task, because now projects can't be dist'ed
selectively.
2020-06-23 01:52:38 +03:00
Ilya Gorbunov
b2e70f9c21 Fix stdlib-js-ir-for-tests build
Exclude kotlinx.browser and kotlinx.dom packages
2020-06-23 01:52:36 +03:00
Georgy Bronnikov
4ecb228d50 IR: handle enhanced nullability in TypeTranslator 2020-06-22 22:06:01 +03:00
Igor Yakovlev
b21cabe671 Separate decompiled declarations light representations from LightClasses
Fixed #KT-39457
2020-06-22 21:17:12 +03:00
Vladimir Ilmov
40ec794c66 (UltraLightClasses) fast-path for Deprecated.HIDDEN annotation 2020-06-22 15:58:25 +02:00
Ilya Goncharov
852e860743 Update test data
#KT-39770 fixed
2020-06-22 16:45:00 +03:00
Ilya Goncharov
c2e97a7287 Kind and css support to single platform JS
#KT-39770 fixed
2020-06-22 16:45:00 +03:00
Ilya Goncharov
5676d31a1c Add CSS support to new project wizard
#KT-39770 fixed
2020-06-22 16:45:00 +03:00
Ilya Goncharov
b8aff0660c Refactor aligning for css support
#KT-39770 fixed
2020-06-22 16:44:59 +03:00
Ilya Goncharov
c9c20bb34c Add enabling css into wizard
#KT-39770 fixed
2020-06-22 16:44:59 +03:00
Dmitry Petrov
e9231b5624 JVM: Generate object and companion object INSTANCE fields as @NotNull 2020-06-22 16:28:00 +03:00
Andrei Klunnyi
558dfc6d9a KT-36801 IDE: Unsupported language version values 2020-06-22 13:01:42 +00:00
Alexander Gorshenev
2b2fce5949 Fix for KT-37761. Don't use mmap. It causes more troubles than it produce benefits 2020-06-22 14:53:25 +03:00
Dmitriy Novozhilov
be2ac3bb4f [FIR] Fix completing bodies of property setters with delegates 2020-06-22 12:29:26 +03:00
Dmitriy Novozhilov
8ce28cb509 [FIR] Add transformBody to FirFunction 2020-06-22 12:29:26 +03:00
Ilya Gorbunov
23dc75fb87 Remove kotlin.coroutines.experimental package descriptions 2020-06-22 12:29:26 +03:00
Ilya Gorbunov
9d111b9451 Update API dumps 2020-06-22 12:29:25 +03:00
Ilya Gorbunov
6c8ff25e5d Drop deprecated jsClass top level and extension functions
Introduce internal toplevel jsClass in js-ir source set instead.
It is needed for JS-IR backend.
2020-06-22 12:29:25 +03:00
Ilya Gorbunov
696701d377 Drop deprecated MutableMap property delegation operator 2020-06-22 12:29:25 +03:00
Ilya Gorbunov
7632910ffd Drop deprecated CollectionAssertions.kt
Remove incorrect import from callByWithEmptyVarArg test
2020-06-22 12:29:25 +03:00
Ilya Gorbunov
5550dc93a1 Remove hidden Random.Companion
It was never released as stable since 1.3. Was provided for binary
compatibility with 1.3 prereleases.
2020-06-22 12:29:25 +03:00
Ilya Gorbunov
b55729957e Drop previously deprecated API
- common and JS org.junit.Test from kotlin.test
- kotlin.Synchronized/Volatile from K/JS
- JS 'native' annotation
2020-06-22 12:29:25 +03:00
Ilya Gorbunov
e9c4f531eb Increase deprecation level for previously deprecated API
- unsupported common exceptions
- common 'synchronized'
- jquery API
- experimental kotlin.time API
- js Math object
- DefaultAsserter constructor-like fun
2020-06-22 12:29:24 +03:00
Jinseong Jeon
67044f22ed FIR serializer: regard property accessors with modifiers as non-default 2020-06-22 12:25:47 +03:00
Svyatoslav Kuzmich
bbfc1a10ad [JS] Fix stack trace capturing from secondary constructors KT-37563 2020-06-22 12:03:59 +03:00
Svyatoslav Kuzmich
6792779281 [JS IR] Fix stack trace capturing in secondary constructors (KT-37563)
Call captureStack in primary constructors and generated factories
2020-06-22 11:50:14 +03:00
Svyatoslav Kuzmich
dfdc1e9c4f [IR] Add IrRawFunctionReference 2020-06-22 11:50:14 +03:00
Roman Artemev
2c3d8feb26 [KLIB IC] Fix dirty declaration detector
- make kjs-stdlib be compiled correctly in IC mode
2020-06-22 11:30:40 +03:00
Roman Artemev
cc818025df [KLIB IC] Add test about incremental kotlin-js-stdlib-klib recompliation 2020-06-22 11:30:40 +03:00
Dmitry Petrov
a493b21c7c JVM_IR: Deprecation cycle for companion object instance visibility 2020-06-19 20:41:54 +03:00
Vladimir Ilmov
230f2f5ce0 (CoroutineDebugger) fix for debugger agent for 1.3.6 version and up 2020-06-19 18:58:46 +02:00
Yaroslav Chernyshev
c638043aee [Gradle, CocoaPods] Improved CocoaPods Integration features with tests 2020-06-19 18:36:46 +03:00
Ilya Gorbunov
130987fa1e Provide flatMapIndexed operation
- similar to flatMap, but transform function takes index and element

#KT-36894
2020-06-19 17:55:15 +03:00
Abduqodiri Qurbonzoda
db93462bcf Initial template for flatMapIndexed operation
#KT-36894
2020-06-19 17:54:47 +03:00
Sergey Igushkin
d9fea52344 Fix compilation of DukatCompilationResolverPlugin after rebase 2020-06-19 17:48:22 +03:00
Sergey Igushkin
f7b660b573 (minor) Fixes for review KT-MR-1290 2020-06-19 17:31:51 +03:00
Sergey Igushkin
10cae9bc5d Fixes for task configuration avoidance in Gradle Kotlin/JS support 2020-06-19 17:31:45 +03:00
Sergey Igushkin
0b7d8c51cb Move kotlinOptions out of the tasks 2020-06-19 17:30:12 +03:00
Sergey Igushkin
19ac036ec5 Rework ScriptingGradleSubplugin for the new subplugins API 2020-06-19 17:30:11 +03:00
Sergey Igushkin
cb5aa64a95 Rework AndroidSubplugin for the new subplugins API 2020-06-19 17:30:10 +03:00
Sergey Igushkin
48153c53ca Rework SamWithReceiverSubplugin for the new subplugins API 2020-06-19 17:30:10 +03:00
Sergey Igushkin
120f77416b (minor) Suppress a warning about property initialized with ctor param 2020-06-19 17:30:09 +03:00
Sergey Igushkin
66a59df7de Rework ExampleSubplugin for the new subplugins API 2020-06-19 17:30:09 +03:00
Sergey Igushkin
a2e4b52747 Rework SerializationSubplugin for the new subplugins API 2020-06-19 17:30:08 +03:00
Sergey Igushkin
98fc4ab2e1 Rework NoArgSubplugin for the new subplugins API 2020-06-19 17:30:07 +03:00
Sergey Igushkin
f2bc391bdd Rework AllOpenSubplugin for the new subplugins API 2020-06-19 17:30:07 +03:00
Sergey Igushkin
e8a303650c Rework Gradle subplugins application in Kotlin/Native 2020-06-19 17:30:06 +03:00
Sergey Igushkin
06a3376368 Refactor the Kotlin Android plugin to make it compliant with TCA
Also simplify some of the APIs and move some others which are only used
by kapt to the kapt's codebase.
2020-06-19 17:30:06 +03:00
Sergey Igushkin
4dbc6803ba Refactor the kapt Gradle plugin to use the new plugins API and TCA 2020-06-19 17:30:05 +03:00
Sergey Igushkin
96ed30a449 Introduce new API for Kotlin compiler support Gradle plugins
The old API was too specific for the Kotlin internal use cases and
leaked some abstractions due to the missing target-compilation project
model. One of such leaking abstractions was the Gradle tasks being
exposed to the subplugin, which required the tasks to instantiate
in order for the subplugin to apply. This violated task configuration
avoidance, so the old API could never work in compliance with TCA.

Introduce the new KotlinCompilerPluginSupportPlugin API that uses the
compilations instead of the tasks and is TCA-compliant.
2020-06-19 17:30:05 +03:00
Sergey Igushkin
0b2d96c1ef Refactor Kotlin classes registration for java-library plugin 2020-06-19 17:30:04 +03:00
Sergey Igushkin
58dd0fa3d2 Use TCA-compliant Gradle APIs in the JS part of the Kotlin Gradle plugin 2020-06-19 17:29:59 +03:00
Sergey Igushkin
58e9b3ae0e Use TCA-compliant Gradle APIs in the Kotlin Gradle plugin 2020-06-19 17:28:40 +03:00
Sergey Igushkin
84287d77ca Add Java tasks to relevant compilation APIs 2020-06-19 17:28:39 +03:00
Sergey Igushkin
1749cb9129 (minor) Initialize compilations with the precise target type 2020-06-19 17:28:39 +03:00
Sergey Igushkin
f4e4baa253 Add TaskProvider property for Kotlin compile tasks in compilations 2020-06-19 17:28:37 +03:00
Pavel Kirpichenkov
1ebb116056 Revert "Invalidate library caches on OOCBM with enabled resolution anchors"
This reverts commit 91b371789e.
^KT-39734 Open
2020-06-19 17:18:45 +03:00
Denis Zharkov
f1955c84aa FIR: Remove ignoreFrontendIR from GenerateInRangeExpressionTestData
It's unnecessary anymore since all tests are fixed
2020-06-19 17:15:56 +03:00
Sergey Rostov
6e9efefd2a gradle scripts: fix isFirstLoadActual and notification typos 2020-06-19 17:04:01 +03:00
Sergey Rostov
9f4569e5a1 gradle scripts: custom notification wording gradle with default scripting support (gradle older then 6.0) 2020-06-19 16:37:59 +03:00
Sergey Rostov
37fbc75008 gradle scripts: "link project" action implementation 2020-06-19 16:37:21 +03:00
Sergey Rostov
d6fc830c24 gradle scripts: temporary disable irrelevant actions when script configuration was not received during import 2020-06-19 16:37:21 +03:00
Dmitriy Novozhilov
a7675c16d5 [FIR] Fix problems with renaming invocationKind and field in FirAnonymousFunction 2020-06-19 16:28:07 +03:00
Mikhail Zarechenskiy
9c8e979308 Fix compatibility resolve for references with multiple outer candidates
#KT-39533 Fixed
2020-06-19 16:21:24 +03:00
Mikhail Bogdanov
58183b774d Fix test data 2020-06-19 15:07:36 +02:00
Alexey Trilis
99d844dcfb Deprecate kotlin.browser and kotlin.dom packages and provide
replacements in packages kotlinx.dom and kotlinx.browser

KT-39330 Fixed
2020-06-19 16:01:40 +03:00
Ilya Chernikov
16100843b2 Add classpaths from all plugin classloaders to the console scripts 2020-06-19 14:56:00 +02:00
Ilya Chernikov
b5ecab31f5 Load script configuration under read action - avoid possible exception 2020-06-19 14:56:00 +02:00
Dmitriy Novozhilov
bd8eaad885 [FIR-TEST] Update cfg dumps in some tests
One of previous commit changed order for those graphs, but i didn't
  find which one
2020-06-19 15:53:11 +03:00
Dmitriy Novozhilov
d01817ce14 Rename InvocationKind to EventOccurrencesRange 2020-06-19 15:53:11 +03:00
Dmitriy Novozhilov
1dfccf1416 [FIR] Rename edge kinds of control flow graph 2020-06-19 15:53:10 +03:00
Dmitriy Novozhilov
f0cc3a32d9 [FIR-TEST] Update testdata due to KT-39711 2020-06-19 15:53:10 +03:00
Dmitriy Novozhilov
64c9a83862 [FIR-TEST] Update testdata due to KT-39709 2020-06-19 15:53:10 +03:00
Dmitriy Novozhilov
a317c8a803 [FIR-TEST] Update testdata due to unresolved KT-36056 2020-06-19 15:53:09 +03:00
Dmitriy Novozhilov
26458875d5 [FIR] Add checker for uninitialized properties 2020-06-19 15:53:09 +03:00
Dmitriy Novozhilov
25621d699b Add methods for combine InvocationKind's
There is two methods added -- `or` and `and`

`or` is used by CFA for combining two kinds that came from different
edges of control flow graph

`and` is analog of `+` operator for invocation kinds
2020-06-19 15:53:08 +03:00
Dmitriy Novozhilov
4078b4b6f9 [FIR] Prepare ControlFlowAnalysisDiagnosticComponent 2020-06-19 15:53:07 +03:00
Dmitriy Novozhilov
c9bc5884dd [FIR] Add more utils for traversing control flow graph 2020-06-19 15:53:07 +03:00
Dmitriy Novozhilov
faa0f07d09 [FIR] Add utility flags to EdgeKind 2020-06-19 15:53:07 +03:00
Dmitriy Novozhilov
5ecbf8b7cd [FIR] Add CFGNodeWithCfgOwner to detect subgraphs in CFA 2020-06-19 15:53:06 +03:00
Dmitriy Novozhilov
05ee436db0 [FIR] Introduce FirControlFlowGraphOwner node 2020-06-19 15:53:06 +03:00
Dmitriy Novozhilov
8a81a09fd0 [FIR] Assume that when without branches is not exhaustive. KT-39621 2020-06-19 15:53:05 +03:00
Dmitriy Novozhilov
4e2e05e689 [FIR-TEST] Check control flow graph in old frontend diagnostic tests 2020-06-19 15:53:05 +03:00
Dmitriy Novozhilov
12ed8c3bb4 [FIR-TEST] Update CFG dumps according to new nodes order 2020-06-19 15:53:04 +03:00
Dmitriy Novozhilov
4e6542a646 [FIR] Add Stub kind for CFG
Edges of stub graphs shouldn't be completed
2020-06-19 15:53:04 +03:00
Dmitriy Novozhilov
1a0df97961 [FIR] Pop and complete graph only after adding last edge to it 2020-06-19 15:53:03 +03:00
Dmitriy Novozhilov
3765c5119f [FIR] Cache nodes in sorted order in CFG 2020-06-19 15:53:02 +03:00
Dmitriy Novozhilov
b5cceb8995 [FIR-TEST] Add validation of control flow graph nodes order 2020-06-19 15:53:02 +03:00
Dmitriy Novozhilov
2f8e95dace [FIR-TEST] Add validation for completed graph in diagnostic tests 2020-06-19 15:53:01 +03:00
Dmitriy Novozhilov
9f55d4f3cd [FIR-TEST] Mute test failing due to KT-39614 2020-06-19 15:53:01 +03:00
Dmitriy Novozhilov
87859b0faa [FIR] Introduce new algorithm for building CFG for declarations 2020-06-19 15:53:00 +03:00
Dmitriy Novozhilov
950bbfe3a5 [FIR] Add kind for back edges in CFG 2020-06-19 15:53:00 +03:00
Dmitriy Novozhilov
34be9e3569 [FIR] Add controlFlowGraph references to value parameters 2020-06-19 15:52:59 +03:00
Dmitriy Novozhilov
65fae3bb0c [FIR] Fix problem with local classes in anonymous objects 2020-06-19 15:52:58 +03:00
Dmitriy Novozhilov
5b64c0cfe2 [FIR] Add different states for CFG and some assertions for graph modification 2020-06-19 15:52:57 +03:00
Dmitriy Novozhilov
1261f62afb [FIR] Extract CFGNode and it's inheritors to separate file 2020-06-19 15:52:56 +03:00
Dmitriy Novozhilov
3a4f53682f [FIR] Don't convert non-local functions without name as FirAnonymousFunction 2020-06-19 15:52:56 +03:00
Natalia Selezneva
44f6a5adcd Filter only valid roots in KotlinScriptDependenciesClassFinder
ClassFinder should return only valid roots,
but in allScriptsDependenciesClassFiles may contain old roots
because they are persistently saved in the storage.
This may cause exception after IDE restart
2020-06-19 15:43:07 +03:00
Natalia Selezneva
d119298232 Add registry key to hide new Load Script Configurations action 2020-06-19 15:43:07 +03:00
Natalia Selezneva
b43014a097 Do not start gradle import if it is already in progress 2020-06-19 15:43:07 +03:00
Natalia Selezneva
66e23c9767 Floating notification shouldn't be shown during import
It depends on up to date check that is correct only after all caches are updated after import
2020-06-19 15:43:06 +03:00
Dmitriy Dolovov
59183a8142 [Commonizer] Replace j.u.HashMap by g.t.THashMap to reduce memory usage 2020-06-19 19:36:06 +07:00
Dmitriy Dolovov
70ea53315d [Commonizer] Intern duplicated CirContainingClassDetails instances 2020-06-19 19:18:13 +07:00
Dmitriy Dolovov
63d549dfa1 [Commonizer] Intern duplicated CirFunctionModifiers instances 2020-06-19 19:18:07 +07:00
Dmitriy Dolovov
68e1acd2cb [Commonizer] More detailed progress logging 2020-06-19 19:18:01 +07:00
Dmitriy Dolovov
6410aed1b4 Minor. Replace computeIfAbsent() by getOrPut() 2020-06-19 19:17:55 +07:00
Dmitriy Dolovov
6393667dda [Commonizer] Rework preparation of CIR cache in TypeCommonizerTest 2020-06-19 19:17:49 +07:00
Dmitriy Dolovov
5cad8a793c [Commonizer] Rework CommonizedGroup API to make it more usable 2020-06-19 19:17:43 +07:00
Dmitriy Dolovov
63575582c4 [Commonizer] Reduce memory consumption during approximation phase
^KT-39320
2020-06-19 19:17:33 +07:00
Ilya Chernikov
d5ffc7416d Clean-up and improve sam-with-receiver test with scripts 2020-06-19 14:08:19 +02:00
Ilya Chernikov
0ade8140f7 Add serialization plugin test with main-kts 2020-06-19 14:08:19 +02:00
Ilya Chernikov
dbb47cf48e Implement non-transitive dependencies resolving in main-kts 2020-06-19 14:08:19 +02:00
Ilya Chernikov
cd1bf563cd Add error reporting on the options parsing errors in scripting
also report standard parsing warnings
also fix language version test, since it is not possible anymore
  to use version 1.0
2020-06-19 13:20:58 +02:00
Mathias Quintero
f0bc52222d Fix annotation construction with array literals
Turns out the issue happens to be that ArrayValue uses a list of values which needs to be translated to an array of the percise type before it is used by callBy

This also addresses handling of arguments after a vararg in an annotation
2020-06-19 13:20:57 +02:00
Efeturi Money
8cb4f59114 Explicitly handle array annotation args in scripting pre-processing
#KT-35411 fixed
2020-06-19 13:20:57 +02:00
Ilya Muradyan
743abea690 Don't create default importing scopes for REPL snippets
Default scopes should be created only once, for the first snippet.
All following snippets should not create new default importing scopes.
#KT-35651 fixed
2020-06-19 13:03:25 +02:00
Ilya Muradyan
c3cbfe34c4 Allow not to create default importing scopes 2020-06-19 13:03:24 +02:00
Ilya Muradyan
53b31a20ca Refactor REPL IDE services testing configuration and add new tests 2020-06-19 13:03:24 +02:00
Ilya Muradyan
94de114894 Support selective filtering of implicits for extensions resolution in REPL 2020-06-19 13:03:23 +02:00
Ilya Muradyan
017f640f26 Allow skipping extensions resolution for implicit receivers 2020-06-19 13:03:23 +02:00
Mikhail Bogdanov
e93bcc55ae Revert "Deprecate DefaultImpl methods in compatibility mode"
This reverts commit 6c9c2a28
2020-06-19 12:58:46 +02:00
Mikhail Bogdanov
8bc4407be0 Fix compilation 2020-06-19 12:54:19 +02:00
Mikhail Bogdanov
6c9c2a287d Deprecate DefaultImpl methods in compatibility mode 2020-06-19 12:23:05 +02:00
Mikhail Bogdanov
9c0b96af71 Report error on missed specialization in compatibility mode
#KT-39603 Fixed
2020-06-19 11:57:36 +02:00
Mikhail Bogdanov
a150e7b6e5 Don't forget about extension parameter in methodSignatureMapping.kt 2020-06-19 11:57:36 +02:00
Mikhail Bogdanov
929bb0e8d1 Move common logic from CodegenTestCase to KotlinBaseTest 2020-06-19 11:57:36 +02:00
Mikhail Bogdanov
9d48ecfac3 Make proper check for defaults on delegation to DefaultImpls 2020-06-19 11:57:36 +02:00
Mikhail Bogdanov
b8f0ad2111 Generate nullability annotations on this receiver in DefaultImpls. Don't generate nullability annotations in private methods
#KT-36969 Fixed
2020-06-19 11:57:35 +02:00
Mikhail Bogdanov
5bdf3d5757 Don't generate compatibility stubs for @JvmDefaultWithoutCompatibility 2020-06-19 11:57:35 +02:00
Mikhail Bogdanov
477cca3c99 Add JvmDefaultWithoutCompatibility annotation 2020-06-19 11:57:35 +02:00
Dmitriy Novozhilov
a98ad79d86 [FIR-TEST] Add option to run modularized tests with checkers 2020-06-19 12:40:02 +03:00
Dmitriy Novozhilov
7a8908a75b [FIR-TEST] Change main module of [JPS] Fast FIR tests task
It's needed to correctly run FIR spec tests
2020-06-19 12:40:01 +03:00
Roman Artemev
a0cccdf75c [JS IR] Make backend work with new shared boxes 2020-06-19 12:23:15 +03:00
Roman Artemev
596c3d1af8 [JS IR] Implement shared box intrinsics translator 2020-06-19 12:23:15 +03:00
Roman Artemev
4c878c27a9 [JS IR] Introduce intrinsics to create shared boxes 2020-06-19 12:23:15 +03:00
Dmitry Savvinov
5b48845dfa Check for native-shared source-sets properly during facet import
Otherwise they are detected as common source-sets, thus getting
K2MetadataCompilerArguments (instead of FakeK2NativeCompilerArguments),
and the 'applyCompilerArgumentsToFacets' will fail due to check on
javaClass equality

^KT-39657 Fixed
2020-06-19 12:15:50 +03:00
Ilya Goncharov
ce553f1211 [Gradle, JS] Add webpackConfig for karma
#KT-39654 fixed
2020-06-19 11:38:51 +03:00
Ilya Goncharov
48a4e08d60 [Gradle, JS] Disable css support by default
#KT-39654 fixed
2020-06-19 11:38:31 +03:00
Denis Zharkov
efee0dae94 FIR: Simplify JvmBinaryAnnotationDeserializer
Currently, it's anyway created one per class
2020-06-19 10:21:09 +03:00
Denis Zharkov
0bc2642634 FIR: Add clarification to the workaround for KT-39659 2020-06-19 10:21:09 +03:00
Denis Zharkov
429b2a9705 FIR: Optimize deserialized annotations loading 2020-06-19 10:21:09 +03:00
Denis Zharkov
260e2d0dc3 FIR: Add dependency for :core:descriptors.runtime to modularized tests
Otherwise NoClassDefFoundError happens on JPS
2020-06-19 10:21:09 +03:00
Jinseong Jeon
6a28558d43 FIR deserializer: rename a callable kind that represents all "others" 2020-06-19 10:21:09 +03:00
Jinseong Jeon
12181e55c0 FIR deserializer: signature-aware annotation loading for constructors 2020-06-19 10:21:09 +03:00
Jinseong Jeon
955c7a1e5b FIR2IR: handle deserialized class reference inside GetClassCall 2020-06-19 10:21:09 +03:00
Jinseong Jeon
781bfa20e8 FIR deserializer: fix conversion of class literal inside annotation array value. 2020-06-19 10:21:09 +03:00
Jinseong Jeon
b076bec07f FIR deserializer: signature-aware annotation loading for functions 2020-06-19 10:21:09 +03:00
Ilya Kirillov
11a680d7d8 Wizard: group project templates into the categories on the first step
#KT-39700 fixed
2020-06-19 09:29:41 +03:00
Ilya Kirillov
bfedeed2c1 Wizard: use new icons in UI 2020-06-19 09:29:40 +03:00
Ilya Kirillov
7df0dd5032 Wizard: fix ui constants 2020-06-19 09:29:39 +03:00
Abduqodiri Qurbonzoda
6e5b94f695 Update js public api dump 2020-06-19 08:39:48 +03:00
Abduqodiri Qurbonzoda
c923b2e139 Deprecate contains, indexOf, lastIndexOf functions of Float/DoubleArray #KT-28753 2020-06-19 08:39:47 +03:00
Abduqodiri Qurbonzoda
97c688057d Compare floating point values asList elements in total order #KT-28753 2020-06-19 08:39:47 +03:00
Toshiaki Kameyama
ba5e643cb2 Redundant qualifier name: fix false positive with same name variable
#KT-39200 Fixed
2020-06-19 12:08:36 +07:00
Abduqodiri Qurbonzoda
bf26d87ee9 Update js public api dump 2020-06-19 04:53:54 +03:00
Abduqodiri Qurbonzoda
16b62b8e65 Introduce minWithOrNull and maxWithOrNull extension functions #KT-38854 2020-06-19 04:53:53 +03:00
Abduqodiri Qurbonzoda
194791a168 Introduce minByOrNull and maxByOrNull extension functions #KT-38854 2020-06-19 04:53:51 +03:00
Abduqodiri Qurbonzoda
846a7823ad Introduce minOrNull and maxOrNull extension functions #KT-39064 2020-06-19 04:53:49 +03:00
simon.ogorodnik
a8cd8ad8f8 [FIR] Fix testData after changing anonymous object name 2020-06-19 01:52:02 +03:00
Vladimir Ilmov
b100fd526f (CoroutineDebugger)(Test) local variable removed from generated code 2020-06-19 00:32:19 +02:00
Vyacheslav Gerasimov
5724c47bcf Build: Fix uri parsing on windows in publication repo configuration 2020-06-19 00:35:55 +03:00
Ilmir Usmanov
542f1b8709 Minor. Update tests 2020-06-18 17:53:47 +02:00
Ilya Goncharov
932cf21776 [Gradle, JS] Allow to change destDir only for separate task and name it destinationDir
#KT-38331 fixed
2020-06-18 18:51:30 +03:00
Ilya Goncharov
7386408e94 [Gradle, JS] AbstractDukatTask -> DukatTask
#KT-38331 fixed
2020-06-18 18:51:08 +03:00
Ilya Goncharov
49dd839131 [Gradle, JS] DukatTask -> IntegratedDukatTask
#KT-38331 fixed
2020-06-18 18:50:53 +03:00
Ilya Goncharov
46be588f27 [Gradle, JS] Add task for separate usage of Dukat with project npm dependencies
#KT-38331 fixed
2020-06-18 18:50:36 +03:00
Ilya Gorbunov
606fad64ad Leave StringBuilder.append/insert with non-nullable String parameter
Leave these methods as hidden in order to preserve binary compatibility.

#KT-39504
2020-06-18 18:45:43 +03:00
Pavel Kirpichenkov
91b371789e Invalidate library caches on OOCBM with enabled resolution anchors
Without forced clean stale references to declarations from source-dependent libraries
can be accessed after invalidation, i.e. resolved references can point to incorrect PSI.
TBD: more granular invalidation.

KT-24309
2020-06-18 18:27:28 +03:00
Alexander Udalov
204871a7ab Update bootstrap to 1.4.20-dev-772 2020-06-18 16:18:59 +02:00
Ilya Matveev
754a74ac4a [Gradle, native] Allow parallel in-process compiler execution
This commit allows parallel in-process execution of the K/N compiler
that was prohibited by 254a978a06.

Issue #KT-38991 fixed
2020-06-18 14:18:00 +00:00
Ilya Matveev
03bb9138ad [klib] Create ZipFileSystem from a Path instead of an URI
Calling FileSystems.newFileSystem(URI, ...) throws a
FileSystemAlreadyExistsException if a ZipFileSystem for this
URI is already created. We still can use a single instance
of ZipFileSystem by calling FileSystems.getFileSystem. In
this case we use reference counting to determine when this
instance can be safely closed.

But we cannot count references if the same ZipFileSystem is used
from different class loaders. This patch fixes this issue by
creating a file system from Path instead of an URI. Contract of
FileSystemProvider.newFileSystem(Path, ...) doesn't imply throwing
FileSystemAlreadyExistsException.

Issue #KT-37443 fixed
2020-06-18 14:17:59 +00:00
Natalia Selezneva
bf1ad44af9 Run partial import only for specified build root 2020-06-18 17:14:47 +03:00
Natalia Selezneva
5fe47ffbec Workaround for bug in GradleInstallationManager.resolveGradleVersion()
Wrong gradle version when wrapper is used
fixed in 201
2020-06-18 17:14:47 +03:00
Natalia Selezneva
7a47994498 Get gradle version and gradle home from corresponding BuildModel after import
GradleProjectSettings that were used, are updated after KotlinDslListener is called,
so it isn't correct to check if kotlinDslModels are supported using it.
Also GradleScriptDefinitionsContributor should use gradle home from BuildModel, not from settings for the same reasons.

^KT-39104 Fixed
2020-06-18 17:14:46 +03:00
Victor Petukhov
ece61915de NI: clean calls in coroutine inference before the second analysis of += only for right side
^KT-39660 Fixed
2020-06-18 17:09:59 +03:00
Vyacheslav Gerasimov
1f66049a1e Build: Fix plugin marker publication to a remote repository 2020-06-18 16:57:39 +03:00
Igor Chevdar
2fd657b768 [box-tests] Fixed test for K/N 2020-06-18 18:44:11 +05:00
Yan Zhulanow
8b5f2f9474 Fix duplicate stepping filter adding on plugin start-up (KT-38628)
Review KT-CR-1301.
2020-06-18 22:32:34 +09:00
Yan Zhulanow
235b9b9269 Add kotlin-stdlib-js and kotlin-test-js to IDE artifact dependencies 2020-06-18 22:32:34 +09:00
Pavel Kirpichenkov
470fef94fb Use bound resolution facade in DeprecationResolver usages
Resolution facade should be used consistently with direct usages of frontend components.
Otherwise they can start processing descriptors from foreign resolvers which leads to memory leaks.

Plain resolution API with provided facade is not suitable as-is for compiled declarations in KotlinIndicesHelper though.
Resolution facade for module sources contained in helper can't handle decompiled
sources from PSI indices (leads to "ModuleInfo not contained in resolver" errors).
That's why "hacked" resolve via import references should be used there.

#KT-39642 Fixed
2020-06-18 14:24:17 +03:00
Jinseong Jeon
82ef6bf96c FIR2IR: honor user-contributed members in data class if any 2020-06-18 14:23:52 +03:00
Mikhail Glukhikh
b839a91050 Mute 3 FIR BB tests due to LowPriorityInOverloadResolution in reflect
Recently second javaType function appeared in reflect and
now FIR can't correctly resolve the code :(.
Will be fixed after annotation deserialization full support
2020-06-18 13:39:48 +03:00
Mikhail Glukhikh
d009c90e3a Revert "Mute two FIR BB tests due to LowPriorityInOverloadResolution in reflect"
This reverts commit 3768af4f
2020-06-18 13:24:38 +03:00
Mikhail Glukhikh
3768af4f92 Mute two FIR BB tests due to LowPriorityInOverloadResolution in reflect
Recently second javaType function appeared in reflect and
now FIR can't correctly resolve the code :(.
Will be fixed after annotation deserialization full support
2020-06-18 13:21:35 +03:00
Mikhail Zarechenskiy
d44a7ff8f9 Add test for obsolete issue
The issue was fixed in df1595e

 #KT-39630 Fixed
2020-06-18 13:05:42 +03:00
Yan Zhulanow
559561ca6b Add missing intellij-core dependency for sam-with-receiver tests 2020-06-18 19:01:44 +09:00
Yan Zhulanow
713a305f45 Update change data for IrTextTestCaseGenerated
Reason of changes: 098469eb85
2020-06-18 19:01:06 +09:00
Ilya Gorbunov
ec5a04a6c7 Update public jvm API dump after introduction of javaType
See 9e37b62f62
2020-06-18 12:44:23 +03:00
Mikhail Zarechenskiy
a067d138e9 Enable test for new inference after df1595e4
Follow up KT-37149
2020-06-18 12:41:27 +03:00
Mikhail Zarechenskiy
df1595e4bc Fix SAM conversions for derived classes
#KT-39535 Fixed
 #KT-37149 Fixed
2020-06-18 12:36:30 +03:00
Georgy Bronnikov
ee6d432ced Add forgotten test files 2020-06-18 12:22:53 +03:00
Igor Chevdar
cf6eb138ce [box-tests] Turned on a test for JS_IR 2020-06-18 13:17:38 +05:00
Igor Chevdar
2bf73ccfe5 [IR] Supported extension receivers in SAM conversions 2020-06-18 13:17:38 +05:00
Ilya Muradyan
8c2baf0704 Add missing definitelyDoesNotContainName methods 2020-06-18 09:51:16 +02:00
Ilya Muradyan
573c60ed6b Add missing recordLookup implementations 2020-06-18 09:51:16 +02:00
Ilya Muradyan
7526ff9484 Compare lookups without respect to their order 2020-06-18 09:51:16 +02:00
Igor Chevdar
3634ad2d54 Added a test 2020-06-18 12:44:48 +05:00
Igor Chevdar
ecf9727568 [IR] Supported IrEnumEntry
Fixes https://youtrack.jetbrains.com/issue/KT-38996
2020-06-18 12:44:48 +05:00
8632 changed files with 237516 additions and 114934 deletions

12
.bunch
View File

@@ -1,7 +1,7 @@
193
201
202_201
192
as36_192
as40
as41_201
202
203_202
193
as40_193
as41
as42_as41

1
.gitattributes vendored
View File

@@ -3,5 +3,6 @@
* text=auto
* eol=lf
*.png binary
*.jar binary
compiler/cli/bin/* eol=lf
compiler/cli/bin/*.bat eol=crlf

View File

@@ -13,21 +13,6 @@
</option>
</JavaCodeStyleSettings>
<JetCodeStyleSettings>
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value>
<package name="java.util" alias="false" withSubpackages="false" />
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
</value>
</option>
<option name="PACKAGES_IMPORT_LAYOUT">
<value>
<package name="" alias="false" withSubpackages="true" />
<package name="java" alias="false" withSubpackages="true" />
<package name="javax" alias="false" withSubpackages="true" />
<package name="kotlin" alias="false" withSubpackages="true" />
<package name="" alias="true" withSubpackages="true" />
</value>
</option>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<MarkdownNavigatorCodeStyleSettings>

20
.idea/runConfigurations/Test__KMM.xml generated Normal file
View File

@@ -0,0 +1,20 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test: KMM" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="kmmTest" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<method v="2" />
</configuration>
</component>

View File

@@ -4,12 +4,13 @@
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--tests &quot;org.jetbrains.kotlin.js.test.ApiTest&quot; -Poverwrite.output=true" />
<option name="scriptParameters" value="--tests &quot;org.jetbrains.kotlin.js.test.ApiTest&quot; -Poverwrite.output=true --parallel" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":js:js.tests:cleanTest" />
<option value=":js:js.tests:test" />
</list>
</option>

View File

@@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="Apply copyright" pattern="!file[*]:*//testData//*&amp;&amp;!file[*]:testData//*&amp;&amp;!file[*]:*.gradle.kts&amp;&amp;!file[*]:*.gradle&amp;&amp;!file[kotlin.kotlin-ultimate]:*/&amp;&amp;!file[kotlin.kotlin-ultimate.*]:*/&amp;&amp;!file[kotlin.libraries]:stdlib/api//*" />
<scope name="Apply copyright" pattern="!file[*]:*//testData//*&amp;&amp;!file[*]:testData//*&amp;&amp;!file[*]:*.gradle.kts&amp;&amp;!file[*]:*.gradle&amp;&amp;!file[group:kotlin-ultimate]:*/&amp;&amp;!file[kotlin.libraries]:stdlib/api//*" />
</component>

View File

@@ -1,5 +1,504 @@
# CHANGELOG
## 1.4-M3
### Compiler
#### New Features
- [`KT-23575`](https://youtrack.jetbrains.com/issue/KT-23575) Deprecate with replacement and SinceKotlin
- [`KT-38652`](https://youtrack.jetbrains.com/issue/KT-38652) Do not generate optional annotations to class files on JVM
- [`KT-38777`](https://youtrack.jetbrains.com/issue/KT-38777) Hide Throwable.addSuppressed member and prefer extension instead
#### Performance Improvements
- [`KT-38489`](https://youtrack.jetbrains.com/issue/KT-38489) Compilation of kotlin html DSL increasingly slow
- [`KT-28650`](https://youtrack.jetbrains.com/issue/KT-28650) Type inference for argument type is very slow if several interfaces with a type parameter is used as an upper bound of a type parameter
#### Fixes
- [`KT-15971`](https://youtrack.jetbrains.com/issue/KT-15971) Incorrect bytecode generated when inheriting default arguments not from the first supertype
- [`KT-25290`](https://youtrack.jetbrains.com/issue/KT-25290) NI: "AssertionError: If original type is SAM type, then candidate should have same type constructor" on out projection of Java class
- [`KT-28672`](https://youtrack.jetbrains.com/issue/KT-28672) Contracts on calls with implicit receivers
- [`KT-30279`](https://youtrack.jetbrains.com/issue/KT-30279) Support non-reified type parameters in typeOf
- [`KT-31908`](https://youtrack.jetbrains.com/issue/KT-31908) NI: CCE on passing lambda to function which accepts vararg SAM interface
- [`KT-32156`](https://youtrack.jetbrains.com/issue/KT-32156) New inference issue with generics
- [`KT-32229`](https://youtrack.jetbrains.com/issue/KT-32229) New inference algorithm not taking into account the upper bound class
- [`KT-33455`](https://youtrack.jetbrains.com/issue/KT-33455) Override equals/hashCode in functional interface wrappers
- [`KT-34902`](https://youtrack.jetbrains.com/issue/KT-34902) AnalyzerException: Argument 1: expected I, but found R for unsigned types in generic data class
- [`KT-35075`](https://youtrack.jetbrains.com/issue/KT-35075) AssertionError: "No resolved call for ..." with conditional function references
- [`KT-35468`](https://youtrack.jetbrains.com/issue/KT-35468) Overcome ambiguity between typealias kotlin.Throws and the aliased type kotlin.jvm.Throws
- [`KT-35494`](https://youtrack.jetbrains.com/issue/KT-35494) NI: Multiple duplicate error diagnostics (in IDE popup) with NULL_FOR_NONNULL_TYPE
- [`KT-35681`](https://youtrack.jetbrains.com/issue/KT-35681) Wrong common supertype between raw and integer literal type leads to unsound code
- [`KT-35937`](https://youtrack.jetbrains.com/issue/KT-35937) Error "Declaration has several compatible actuals" on incremental build
- [`KT-36013`](https://youtrack.jetbrains.com/issue/KT-36013) Functional interface conversion not happens on a value of functional type with smart cast to a relevant functional type
- [`KT-36045`](https://youtrack.jetbrains.com/issue/KT-36045) Do not depend on the order of lambda arguments to coerce result to `Unit`
- [`KT-36448`](https://youtrack.jetbrains.com/issue/KT-36448) NI: fix tests after enabling NI in the compiler
- [`KT-36706`](https://youtrack.jetbrains.com/issue/KT-36706) Prohibit functional interface constructor references
- [`KT-36969`](https://youtrack.jetbrains.com/issue/KT-36969) Generate @NotNull on instance parameters of Interface$DefaultImpls methods
- [`KT-37058`](https://youtrack.jetbrains.com/issue/KT-37058) Incorrect overload resolution ambiguity on callable reference in a conditional expression with new inference
- [`KT-37120`](https://youtrack.jetbrains.com/issue/KT-37120) [FIR] False UNRESOLVED_REFERENCE for public and protected member functions and properties which are declared in object inner class
- [`KT-37149`](https://youtrack.jetbrains.com/issue/KT-37149) Conversion when generic specified by type argument of SAM type
- [`KT-37249`](https://youtrack.jetbrains.com/issue/KT-37249) false TYPE_MISMATCH when When-expression branches have try-catch blocks
- [`KT-37341`](https://youtrack.jetbrains.com/issue/KT-37341) NI: Type mismatch with combination of lambda and function reference
- [`KT-37436`](https://youtrack.jetbrains.com/issue/KT-37436) AME: "Receiver class does not define or inherit an implementation of the resolved method" in runtime on usage of non-abstract method of fun interface
- [`KT-37510`](https://youtrack.jetbrains.com/issue/KT-37510) NI infers `java.lang.Void` from the expression in a lazy property delegate and throws ClassCastException at runtime
- [`KT-37541`](https://youtrack.jetbrains.com/issue/KT-37541) SAM conversion with fun interface without a function fails on compiling and IDE analysis in SamAdapterFunctionsScope.getSamConstructor()
- [`KT-37574`](https://youtrack.jetbrains.com/issue/KT-37574) NI: Type mismatch with Kotlin object extending functional type passed as @FunctionalInterface to Java
- [`KT-37630`](https://youtrack.jetbrains.com/issue/KT-37630) NI: ILT suitability in a call is broken if there are CST calculation and calling function's type parameters
- [`KT-37665`](https://youtrack.jetbrains.com/issue/KT-37665) NI: applicability error due to implicitly inferred Nothing for returning T with expected type
- [`KT-37712`](https://youtrack.jetbrains.com/issue/KT-37712) No extension receiver in functional interface created with lambda
- [`KT-37715`](https://youtrack.jetbrains.com/issue/KT-37715) NI: VerifyError: Bad type on operand stack with varargs generic value when type is inferred
- [`KT-37721`](https://youtrack.jetbrains.com/issue/KT-37721) NI: Function reference with vararg parameter treated as array and missing default parameter is rejected
- [`KT-37887`](https://youtrack.jetbrains.com/issue/KT-37887) NI: Smart casting for Map doesn't work if the variable is already "smart casted"
- [`KT-37914`](https://youtrack.jetbrains.com/issue/KT-37914) NI: broken inference for a casting to subtype function within the common constraint system with this subtype
- [`KT-37952`](https://youtrack.jetbrains.com/issue/KT-37952) NI: improve lambdas completion through separation the lambdas analysis into several steps
- [`KT-38069`](https://youtrack.jetbrains.com/issue/KT-38069) Callable reference adaptation should have dependency on API version 1.4
- [`KT-38143`](https://youtrack.jetbrains.com/issue/KT-38143) New type inference fails when calling extension function defined on generic type with type arguments nested too deep
- [`KT-38156`](https://youtrack.jetbrains.com/issue/KT-38156) FIR Metadata generation
- [`KT-38197`](https://youtrack.jetbrains.com/issue/KT-38197) java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects
- [`KT-38259`](https://youtrack.jetbrains.com/issue/KT-38259) NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER for provideDelegate
- [`KT-38337`](https://youtrack.jetbrains.com/issue/KT-38337) Map delegation fails for inline classes
- [`KT-38401`](https://youtrack.jetbrains.com/issue/KT-38401) FIR: protected effective visibility is handled unprecisely
- [`KT-38416`](https://youtrack.jetbrains.com/issue/KT-38416) FIR: infinite loop in BB coroutine test 'overrideDefaultArgument.kt'
- [`KT-38432`](https://youtrack.jetbrains.com/issue/KT-38432) FIR: incorrect effective visibility in anonymous object
- [`KT-38434`](https://youtrack.jetbrains.com/issue/KT-38434) Implement resolution of suspend-conversion on FE only, but give error if suspend conversion is called
- [`KT-38437`](https://youtrack.jetbrains.com/issue/KT-38437) [FIR] String(CharArray) is resolved to java.lang.String constructor instead of kotlin.text.String pseudo-constructor
- [`KT-38439`](https://youtrack.jetbrains.com/issue/KT-38439) NI: anonymous functions without receiver is allowed if there is an expected type with receiver
- [`KT-38473`](https://youtrack.jetbrains.com/issue/KT-38473) FIR: ConeIntegerLiteralType in signature
- [`KT-38537`](https://youtrack.jetbrains.com/issue/KT-38537) IllegalArgumentException: "marginPrefix must be non-blank string" with raw strings and space as margin prefix in trimMargin() call
- [`KT-38604`](https://youtrack.jetbrains.com/issue/KT-38604) Implicit suspend conversion on call arguments doesn't work on vararg elements
- [`KT-38680`](https://youtrack.jetbrains.com/issue/KT-38680) NSME when calling generic interface method with default parameters overriden with inline class type argument
- [`KT-38681`](https://youtrack.jetbrains.com/issue/KT-38681) Wrong bytecode generated when calling generic interface method with default parameters overriden with primitive type argument
- [`KT-38691`](https://youtrack.jetbrains.com/issue/KT-38691) NI: overload resolution ambiguity if take `R` and `() -> R`, and pass literal lambda, which returns `R`
- [`KT-38799`](https://youtrack.jetbrains.com/issue/KT-38799) False positive USELESS_CAST for lambda parameter
- [`KT-38802`](https://youtrack.jetbrains.com/issue/KT-38802) Generated code crashes by ClassCastException when delegating with inline class
- [`KT-38853`](https://youtrack.jetbrains.com/issue/KT-38853) Backend Internal error: Error type encountered: Unresolved type for nested class used in an annotation argument on an interface method
- [`KT-38890`](https://youtrack.jetbrains.com/issue/KT-38890) NI: false negative Type mismatch for values with fun keyword
- [`KT-39010`](https://youtrack.jetbrains.com/issue/KT-39010) NI: Regression with false-positive smartcast on var of generic type
- [`KT-39013`](https://youtrack.jetbrains.com/issue/KT-39013) 202, ASM 8: "AnalyzerException: Execution can fall off the end of the code"
- [`KT-39260`](https://youtrack.jetbrains.com/issue/KT-39260) "AssertionError: Unsigned type expected: Int" in range
- [`KT-39305`](https://youtrack.jetbrains.com/issue/KT-39305) NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER: unable to infer deeply nested type bound when class implements generic interface
- [`KT-39408`](https://youtrack.jetbrains.com/issue/KT-39408) Using unsigned arrays as generics fails in 1.4-M2 with class cast exception
- [`KT-39533`](https://youtrack.jetbrains.com/issue/KT-39533) NI: Wrong overload resolution for methods with SAM converted function reference arguments
- [`KT-39535`](https://youtrack.jetbrains.com/issue/KT-39535) NI: Inference fails for the parameters of SAM converted lambdas with type parameters
- [`KT-39603`](https://youtrack.jetbrains.com/issue/KT-39603) Require explicit override in JVM default compatibility mode on implicit generic specialization of inherited methods in classes
- [`KT-39671`](https://youtrack.jetbrains.com/issue/KT-39671) Couldn't inline method call 'expectBody'
- [`KT-39816`](https://youtrack.jetbrains.com/issue/KT-39816) NI:ClassCastException and no IDE error with provideDelegate when DELEGATE_SPECIAL_FUNCTION_MISSING in OI
- [`KT-32779`](https://youtrack.jetbrains.com/issue/KT-32779) `Rewrite at slice` in array access resolution in coroutine inference
- [`KT-39387`](https://youtrack.jetbrains.com/issue/KT-39387) Can't build Kotlin project due to overload resolution ambiguity on flatMap calls
- [`KT-39229`](https://youtrack.jetbrains.com/issue/KT-39229) NI: resolution to wrong candidate (SAM-type against similar functional type)
### Docs & Examples
- [`KT-36245`](https://youtrack.jetbrains.com/issue/KT-36245) Document that @kotlin.native.ThreadLocal annotation doesn't work anywhere except in Kotlin/Native
- [`KT-37943`](https://youtrack.jetbrains.com/issue/KT-37943) Conflicting overloads in the factory functions sample code in Coding Conventions Page
### IDE
#### New Features
- [`KT-10974`](https://youtrack.jetbrains.com/issue/KT-10974) Add Code Style: Import Layout Configuration Table
- [`KT-39065`](https://youtrack.jetbrains.com/issue/KT-39065) "Join lines" should remove trailing comma on call site
#### Fixes
- [`KT-9065`](https://youtrack.jetbrains.com/issue/KT-9065) Wrong result when move statement through if block with call with lambda
- [`KT-14757`](https://youtrack.jetbrains.com/issue/KT-14757) Move statement up breaks code in function parameter list
- [`KT-14946`](https://youtrack.jetbrains.com/issue/KT-14946) Move statement up/down (with Ctrl+Shift+Up/Down) messes with empty lines
- [`KT-15143`](https://youtrack.jetbrains.com/issue/KT-15143) Kotlin: Colors&Fonts -> "Enum entry" should use Language Default -> Classes - Static field
- [`KT-17887`](https://youtrack.jetbrains.com/issue/KT-17887) Moving statement (Ctrl/Cmd+Shift+Down) messes with use block
- [`KT-34187`](https://youtrack.jetbrains.com/issue/KT-34187) UAST cannot get type of array access
- [`KT-34524`](https://youtrack.jetbrains.com/issue/KT-34524) "PSI and index do not match" and IDE freeze with library import from `square/workflow`
- [`KT-35574`](https://youtrack.jetbrains.com/issue/KT-35574) UAST: UBreakExpression in when expression should be UYieldExpression
- [`KT-36801`](https://youtrack.jetbrains.com/issue/KT-36801) IDE: Unsupported language version value is represented with "latest stable" in GUI
- [`KT-37378`](https://youtrack.jetbrains.com/issue/KT-37378) Remove IDE option "Enable new type inference algorithm..." in 1.4
- [`KT-38003`](https://youtrack.jetbrains.com/issue/KT-38003) "Analyze Data Flow from Here" should work on parameter of abstract method
- [`KT-38173`](https://youtrack.jetbrains.com/issue/KT-38173) Reified types do no have extends information
- [`KT-38217`](https://youtrack.jetbrains.com/issue/KT-38217) Make Kotlin plugin settings searchable
- [`KT-38247`](https://youtrack.jetbrains.com/issue/KT-38247) "IncorrectOperationException: Incorrect expression" through UltraLightUtils.kt: inlined string is not escaped before parsing
- [`KT-38293`](https://youtrack.jetbrains.com/issue/KT-38293) Throwable: "'codestyle.name.kotlin' is not found in java.util.PropertyResourceBundle" at KotlinLanguageCodeStyleSettingsProvider.getConfigurableDisplayName()
- [`KT-38407`](https://youtrack.jetbrains.com/issue/KT-38407) Drop components from plugin.xml
- [`KT-38443`](https://youtrack.jetbrains.com/issue/KT-38443) No error on change in property initializer
- [`KT-38521`](https://youtrack.jetbrains.com/issue/KT-38521) ISE: Loop in parent structure when converting a DOT_QUALIFIED_EXPRESSION with parent ANNOTATED_EXPRESSION
- [`KT-38571`](https://youtrack.jetbrains.com/issue/KT-38571) Rework deprecated EPs
- [`KT-38632`](https://youtrack.jetbrains.com/issue/KT-38632) Change the code style to official in tests
### IDE. Code Style, Formatting
#### Fixes
- [`KT-24750`](https://youtrack.jetbrains.com/issue/KT-24750) Formatter: Minimum blank lines after class header does nothing
- [`KT-31169`](https://youtrack.jetbrains.com/issue/KT-31169) IDEA settings search fails to find "Tabs and Indents" tab in Kotlin code style settings
- [`KT-35359`](https://youtrack.jetbrains.com/issue/KT-35359) Incorrect indent for multiline expression in string template
- [`KT-37420`](https://youtrack.jetbrains.com/issue/KT-37420) Add setting to disable inserting empty line between declaration and declaration with comment
- [`KT-37891`](https://youtrack.jetbrains.com/issue/KT-37891) Formatter inserts empty lines between annotated properties
- [`KT-38036`](https://youtrack.jetbrains.com/issue/KT-38036) Use trailing comma setting does not apply to code example in Settings dialog
- [`KT-38568`](https://youtrack.jetbrains.com/issue/KT-38568) False positive: weak warning "Missing line break" on -> in when expression
- [`KT-39024`](https://youtrack.jetbrains.com/issue/KT-39024) Add option for blank lines before declaration with comment or annotation on separate line
- [`KT-39079`](https://youtrack.jetbrains.com/issue/KT-39079) Trailing comma: add base support for call site
- [`KT-39123`](https://youtrack.jetbrains.com/issue/KT-39123) Option `Align 'when' branches in columns` does nothing
- [`KT-39180`](https://youtrack.jetbrains.com/issue/KT-39180) Move trailing comma settings in Other tab
### IDE. Completion
- [`KT-18538`](https://youtrack.jetbrains.com/issue/KT-18538) Completion of static members of grand-super java class inserts unnecessary qualifier
- [`KT-38445`](https://youtrack.jetbrains.com/issue/KT-38445) Fully qualified class name is used instead after insertion of `delay` method
### IDE. Debugger
#### Fixes
- [`KT-14057`](https://youtrack.jetbrains.com/issue/KT-14057) Debugger couldn't step into Reader.read
- [`KT-14828`](https://youtrack.jetbrains.com/issue/KT-14828) Bad step into/over behavior for functions with default parameters
- [`KT-36403`](https://youtrack.jetbrains.com/issue/KT-36403) Method breakpoints don't work for libraries
- [`KT-36404`](https://youtrack.jetbrains.com/issue/KT-36404) Evaluate: "AssertionError: Argument expression is not saved for a SAM constructor"
- [`KT-37486`](https://youtrack.jetbrains.com/issue/KT-37486) Kotlin plugin keeps reference to stream debugger support classes after stream debugger plugin is disabled
- [`KT-38484`](https://youtrack.jetbrains.com/issue/KT-38484) Coroutines Debugger: IAE “Requested element count -1 is less than zero.” is thrown by calling dumpCoroutines
- [`KT-38606`](https://youtrack.jetbrains.com/issue/KT-38606) Coroutine Debugger: OCE from org.jetbrains.kotlin.idea.debugger.coroutine.proxy.mirror.BaseMirror.isCompatible
- [`KT-39143`](https://youtrack.jetbrains.com/issue/KT-39143) NPE on setCurrentStackFrame to Kotlin inner compiled class content
- [`KT-39412`](https://youtrack.jetbrains.com/issue/KT-39412) Failed to find Premain-Class manifest attribute when debugging main method with ktor
- [`KT-39634`](https://youtrack.jetbrains.com/issue/KT-39634) (CoroutineDebugger) Agent doesn't start if using kotlinx-coroutines-core only dependency
- [`KT-39648`](https://youtrack.jetbrains.com/issue/KT-39648) Coroutines debugger doesn't see stacktraces in case of the project has kotlinx-coroutines-debug dependency
### IDE. Gradle Integration
#### Performance Improvements
- [`KT-39059`](https://youtrack.jetbrains.com/issue/KT-39059) Poor performance of `modifyDependenciesOnMppModules`
#### Fixes
- [`KT-35921`](https://youtrack.jetbrains.com/issue/KT-35921) Gradle Import fails with "Unsupported major.minor version 52.0" on pure Java project in case "Gradle JDK" is lower 1.8 and Kotlin plugin is enabled
- [`KT-36673`](https://youtrack.jetbrains.com/issue/KT-36673) Gradle Project importing: move ModelBuilders and ModelProviders to kotlin-gradle-tooling jar
- [`KT-36792`](https://youtrack.jetbrains.com/issue/KT-36792) IDEA 2020.1: Some module->module dependencies in HMPP project are missed after import from Gradle
- [`KT-37125`](https://youtrack.jetbrains.com/issue/KT-37125) Imported modules structure for MPP project is displayed messy in UI in IDEA 2020.1
- [`KT-37428`](https://youtrack.jetbrains.com/issue/KT-37428) NPE at KotlinFacetSettings.setLanguageLevel() on the first project import
- [`KT-38706`](https://youtrack.jetbrains.com/issue/KT-38706) IDE Gradle import creates 4 JavaScript modules for MPP source sets with BOTH compiler type
- [`KT-38767`](https://youtrack.jetbrains.com/issue/KT-38767) Published hierarchical multiplatform library symbols are unresolved in IDE (master)
- [`KT-38842`](https://youtrack.jetbrains.com/issue/KT-38842) False positive [INVISIBLE_MEMBER] for `internal` declaration of commonMain called from commonTest
- [`KT-39213`](https://youtrack.jetbrains.com/issue/KT-39213) IDE: references from MPP project to JavaScript library are unresolved, when project and library are compiled with "both" mode
- [`KT-39657`](https://youtrack.jetbrains.com/issue/KT-39657) Language settings for intermediate source-sets are lost during import
### IDE. Gradle. Script
#### New Features
- [`KT-34481`](https://youtrack.jetbrains.com/issue/KT-34481) `*.gradle.kts`: use Intellij IDEA Gradle project sync mechanics for updating script configuration
#### Performance Improvements
- [`KT-34138`](https://youtrack.jetbrains.com/issue/KT-34138) Deadlock in `ScriptTemplatesFromDependenciesProvider`
- [`KT-38875`](https://youtrack.jetbrains.com/issue/KT-38875) Deadlock in ScriptClassRootsUpdater.checkInvalidSdks
#### Fixes
- [`KT-34265`](https://youtrack.jetbrains.com/issue/KT-34265) Bogus "build configuration failed, run 'gradle tasks' for more information" message and other issues related to "script dependencies"
- [`KT-34444`](https://youtrack.jetbrains.com/issue/KT-34444) *.gradle.kts: special storage of all scripts configuration on one file
- [`KT-35153`](https://youtrack.jetbrains.com/issue/KT-35153) build.gradle.kts: scripts in removed subproject remain imported, but shouldn't
- [`KT-35573`](https://youtrack.jetbrains.com/issue/KT-35573) Request for gradle build script configuration only after explicit click on notification
- [`KT-36675`](https://youtrack.jetbrains.com/issue/KT-36675) move .gradle.kts ModelBuilders and ModelProviders to kotlin-gradle-tooling jar
- [`KT-37178`](https://youtrack.jetbrains.com/issue/KT-37178) build.gradle.kts: Rework the notification for scripts out of project
- [`KT-37631`](https://youtrack.jetbrains.com/issue/KT-37631) Unnecessary loading dependencies after opening build.gradle.kts after project import with Gradle 6
- [`KT-37863`](https://youtrack.jetbrains.com/issue/KT-37863) Scanning dependencies for script definitions takes too long or indefinitely during Gradle import
- [`KT-38296`](https://youtrack.jetbrains.com/issue/KT-38296) MISSING_DEPENDENCY_SUPERCLASS in the build.gradle.kts editor while Gradle runs Ok
- [`KT-38541`](https://youtrack.jetbrains.com/issue/KT-38541) "Invalid file" exception in ScriptChangeListener.getAnalyzableKtFileForScript()
- [`KT-39104`](https://youtrack.jetbrains.com/issue/KT-39104) “Gradle Kotlin DSL script configuration is missing” after importing project in IJ201, Gradle 6.3
- [`KT-39469`](https://youtrack.jetbrains.com/issue/KT-39469) Gradle version is not updated in script dependencies if the version of gradle was changed in gradle-wrapper.properties
- [`KT-39771`](https://youtrack.jetbrains.com/issue/KT-39771) Freeze 30s from org.jetbrains.kotlin.scripting.resolve.ApiChangeDependencyResolverWrapper.resolve on loading script configuration with Gradle 5.6.4
### IDE. Inspections and Intentions
#### New Features
- [`KT-14884`](https://youtrack.jetbrains.com/issue/KT-14884) Intention to add missing "class" keyword for enum and annotation top-level declarations
- [`KT-17209`](https://youtrack.jetbrains.com/issue/KT-17209) Provide intention to fix platform declaration clash (CONFLICTING_JVM_DECLARATIONS)
- [`KT-24522`](https://youtrack.jetbrains.com/issue/KT-24522) Suggest to move typealias outside the class
- [`KT-30263`](https://youtrack.jetbrains.com/issue/KT-30263) Detect redundant conversions of unsigned types
- [`KT-35893`](https://youtrack.jetbrains.com/issue/KT-35893) Support Inspection for unnecessary asSequence() call
- [`KT-38559`](https://youtrack.jetbrains.com/issue/KT-38559) "Change JVM name" (@JvmName) quickfix: improve name suggester for generic functions
- [`KT-38597`](https://youtrack.jetbrains.com/issue/KT-38597) Expand Boolean intention
- [`KT-38982`](https://youtrack.jetbrains.com/issue/KT-38982) Add "Logger initialized with foreign class" inspection
- [`KT-39131`](https://youtrack.jetbrains.com/issue/KT-39131) TrailingCommaInspection: should suggest fixes for call-site without warnings
#### Fixes
- [`KT-5271`](https://youtrack.jetbrains.com/issue/KT-5271) Missing QuickFix for Multiple supertypes available
- [`KT-11865`](https://youtrack.jetbrains.com/issue/KT-11865) "Create secondary constructor" quick fix always inserts parameter-less call to `this()`
- [`KT-14021`](https://youtrack.jetbrains.com/issue/KT-14021) Quickfix to add parameter to function gives strange name to parameter
- [`KT-17121`](https://youtrack.jetbrains.com/issue/KT-17121) "Implement members" quick fix is not suggested
- [`KT-17368`](https://youtrack.jetbrains.com/issue/KT-17368) Don't highlight members annotated with @JsName as unused
- [`KT-20795`](https://youtrack.jetbrains.com/issue/KT-20795) "replace explicit parameter with it" creates invalid code in case of overload ambiguities
- [`KT-22014`](https://youtrack.jetbrains.com/issue/KT-22014) Intention "convert lambda to reference" should be available for implicit 'this'
- [`KT-22015`](https://youtrack.jetbrains.com/issue/KT-22015) Intention "Convert lambda to reference" should be available in spite of the lambda in or out of parentheses
- [`KT-22142`](https://youtrack.jetbrains.com/issue/KT-22142) Intentions: "Convert to primary constructor" changes semantics for property with custom setter
- [`KT-22878`](https://youtrack.jetbrains.com/issue/KT-22878) Empty argument list at the call site of custom function named "suspend" shouldn't be reported as unnecessary
- [`KT-24281`](https://youtrack.jetbrains.com/issue/KT-24281) Importing of invoke() from the same file is reported as unused even if it isn't
- [`KT-25050`](https://youtrack.jetbrains.com/issue/KT-25050) False-positive inspection "Call replaceable with binary operator" for 'equals'
- [`KT-26361`](https://youtrack.jetbrains.com/issue/KT-26361) @Deprecated "ReplaceWith" quickfix inserts 'this' incorrectly when using function imports
- [`KT-27651`](https://youtrack.jetbrains.com/issue/KT-27651) 'Condition is always true' inspection should not be triggered when the condition has references to a named constant
- [`KT-29934`](https://youtrack.jetbrains.com/issue/KT-29934) False negative `Change type` quickfix on primary constructor override val parameter when it has wrong type
- [`KT-31682`](https://youtrack.jetbrains.com/issue/KT-31682) 'Convert lambda to reference' intention inside class with function which return object produces uncompilable code
- [`KT-31760`](https://youtrack.jetbrains.com/issue/KT-31760) Implement Abstract Function/Property intentions position generated member improperly
- [`KT-32511`](https://youtrack.jetbrains.com/issue/KT-32511) Create class quick fix is not suggested in super type list in case of missing primary constructor
- [`KT-32565`](https://youtrack.jetbrains.com/issue/KT-32565) False positive "Variable is the same as 'credentials' and should be inlined" with object declared and returned from lambda
- [`KT-32801`](https://youtrack.jetbrains.com/issue/KT-32801) False positive "Call on collection type may be reduced" with mapNotNull, generic lambda block and new inference
- [`KT-33951`](https://youtrack.jetbrains.com/issue/KT-33951) ReplaceWith quickfix with unqualified object member call doesn't substitute argument for parameter
- [`KT-34378`](https://youtrack.jetbrains.com/issue/KT-34378) "Convert lambda to reference" refactoring does not work for suspend functions
- [`KT-34677`](https://youtrack.jetbrains.com/issue/KT-34677) False positive "Collection count can be converted to size" with `Iterable`
- [`KT-34696`](https://youtrack.jetbrains.com/issue/KT-34696) Wrong 'Redundant qualifier name' for 'MyEnum.values' usage
- [`KT-34713`](https://youtrack.jetbrains.com/issue/KT-34713) "Condition is always 'false'": quickfix "Delete expression" doesn't remove `else` keyword (may break control flow)
- [`KT-35015`](https://youtrack.jetbrains.com/issue/KT-35015) ReplaceWith doesn't substitute parameters with argument expressions
- [`KT-35329`](https://youtrack.jetbrains.com/issue/KT-35329) Replace 'when' with 'if' intention: do not suggest if 'when' is used as expression and it has no 'else' branch
- [`KT-36194`](https://youtrack.jetbrains.com/issue/KT-36194) "Add braces to 'for' statement" inserts extra line break and moves the following single-line comment
- [`KT-36406`](https://youtrack.jetbrains.com/issue/KT-36406) "To ordinary string literal" intention adds unnecessary escapes to characters in template expression
- [`KT-36461`](https://youtrack.jetbrains.com/issue/KT-36461) "Create enum constant" quick fix adds after semicolon, if the last entry has a comma
- [`KT-36462`](https://youtrack.jetbrains.com/issue/KT-36462) "Create enum constant" quick fix doesn't add trailing comma
- [`KT-36508`](https://youtrack.jetbrains.com/issue/KT-36508) False positive "Replace 'to' with infix form" when 'to' lambda generic type argument is specified explicitly
- [`KT-36930`](https://youtrack.jetbrains.com/issue/KT-36930) Intention "Specify type explicitly" adds NotNull annotation when calling java method with the annotation
- [`KT-37148`](https://youtrack.jetbrains.com/issue/KT-37148) "Remove redundant `.let` call doesn't remove extra calls
- [`KT-37156`](https://youtrack.jetbrains.com/issue/KT-37156) "Unused unary operator" inspection highlighting is hard to see
- [`KT-37173`](https://youtrack.jetbrains.com/issue/KT-37173) "Replace with string templates" intention for String.format produces uncompilable string template
- [`KT-37181`](https://youtrack.jetbrains.com/issue/KT-37181) Don't show "Remove redundant qualifier name" inspection on qualified Companion imported with star import
- [`KT-37214`](https://youtrack.jetbrains.com/issue/KT-37214) "Convert lambda to reference" with a labeled "this" receiver fails
- [`KT-37256`](https://youtrack.jetbrains.com/issue/KT-37256) False positive `PlatformExtensionReceiverOfInline` inspection if a platform type value is passed to a nullable receiver
- [`KT-37744`](https://youtrack.jetbrains.com/issue/KT-37744) "Convert lambda to reference" inspection quick fix create incompilable code when type is inferred from lambda parameter
- [`KT-37746`](https://youtrack.jetbrains.com/issue/KT-37746) "Redundant suspend modifier" should not be reported for functions with actual keyword
- [`KT-37842`](https://youtrack.jetbrains.com/issue/KT-37842) "Convert to anonymous function" creates broken code with suspend functions
- [`KT-37908`](https://youtrack.jetbrains.com/issue/KT-37908) "Convert to anonymous object" quickfix: false negative when interface has concrete functions
- [`KT-37967`](https://youtrack.jetbrains.com/issue/KT-37967) Replace 'invoke' with direct call intention adds unnecessary parenthesis
- [`KT-37977`](https://youtrack.jetbrains.com/issue/KT-37977) "Replace 'invoke' with direct call" intention: false positive when function is not operator
- [`KT-38062`](https://youtrack.jetbrains.com/issue/KT-38062) Reactor Quickfix throws `NotImplementedError` for Kotlin
- [`KT-38240`](https://youtrack.jetbrains.com/issue/KT-38240) False positive redundant semicolon with `as` cast and `not` unary operator on next line
- [`KT-38261`](https://youtrack.jetbrains.com/issue/KT-38261) Redundant 'let' call removal leaves ?. operator and makes code uncompilable
- [`KT-38310`](https://youtrack.jetbrains.com/issue/KT-38310) Remove explicit type annotation intention drops 'suspend'
- [`KT-38492`](https://youtrack.jetbrains.com/issue/KT-38492) False positive "Add import" intention for already imported class
- [`KT-38520`](https://youtrack.jetbrains.com/issue/KT-38520) SetterBackingFieldAssignmentInspection throws exception
- [`KT-38649`](https://youtrack.jetbrains.com/issue/KT-38649) False positive quickfix "Assignment should be lifted out of when" in presence of smartcasts
- [`KT-38677`](https://youtrack.jetbrains.com/issue/KT-38677) Invalid psi tree after `Lift assigment out of...`
- [`KT-38790`](https://youtrack.jetbrains.com/issue/KT-38790) "Convert sealed subclass to object" for data classes doesn't remove 'data' keyword
- [`KT-38829`](https://youtrack.jetbrains.com/issue/KT-38829) 'Remove redundant backticks' can be broken with @ in name
- [`KT-38831`](https://youtrack.jetbrains.com/issue/KT-38831) 'Replace with assignment' can be broken with fast code change
- [`KT-38832`](https://youtrack.jetbrains.com/issue/KT-38832) "Remove curly braces" intention may produce CCE
- [`KT-38948`](https://youtrack.jetbrains.com/issue/KT-38948) False positive quickfix "Make containing function suspend" for anonymous function
- [`KT-38961`](https://youtrack.jetbrains.com/issue/KT-38961) "Useless call on collection type" for filterNotNull on non-null array where list return type is expected
- [`KT-39069`](https://youtrack.jetbrains.com/issue/KT-39069) Improve TrailingCommaInspection
- [`KT-39151`](https://youtrack.jetbrains.com/issue/KT-39151) False positive inspection to replace Java forEach with Kotlin forEach when using ConcurrentHashMap
### IDE. JS
- [`KT-39275`](https://youtrack.jetbrains.com/issue/KT-39275) Kotlin JS Browser template for kotlin dsl doesn't include index.html
### IDE. KDoc
- [`KT-32163`](https://youtrack.jetbrains.com/issue/KT-32163) Open Quick Documentation when cursor inside function / constructor brackets
### IDE. Navigation
- [`KT-32245`](https://youtrack.jetbrains.com/issue/KT-32245) Method in Kotlin class is not listed among implementing methods
- [`KT-33510`](https://youtrack.jetbrains.com/issue/KT-33510) There is no gutter icon to navigate from `actual` to `expect` if `expect` and the corresponding `actual` declarations are in the same file
- [`KT-38260`](https://youtrack.jetbrains.com/issue/KT-38260) Navigation bar doesn't show directories of files with a single top level Kotlin class
- [`KT-38466`](https://youtrack.jetbrains.com/issue/KT-38466) Top level functions/properties aren't shown in navigation panel
### IDE. Project View
- [`KT-36444`](https://youtrack.jetbrains.com/issue/KT-36444) Structure view: add ability to sort by visibility
- [`KT-38276`](https://youtrack.jetbrains.com/issue/KT-38276) Structure view: support visibility filter for class properties
### IDE. REPL
- [`KT-38454`](https://youtrack.jetbrains.com/issue/KT-38454) Kotlin REPL in IntelliJ doesn't take module's JVM target setting into account
### IDE. Refactorings
- [`KT-12878`](https://youtrack.jetbrains.com/issue/KT-12878) "Change signature" forces line breaks after every parameter declaration
- [`KT-30128`](https://youtrack.jetbrains.com/issue/KT-30128) Change Signature should move lambda outside of parentheses if the arguments are reordered so that the lambda goes last
- [`KT-35338`](https://youtrack.jetbrains.com/issue/KT-35338) Move/rename refactorings mess up code formatting by wrapping lines
- [`KT-38449`](https://youtrack.jetbrains.com/issue/KT-38449) Extract variable refactoring is broken by NPE
- [`KT-38543`](https://youtrack.jetbrains.com/issue/KT-38543) Copy can't work to package with escaped package
- [`KT-38627`](https://youtrack.jetbrains.com/issue/KT-38627) Rename package refactorings mess up code formatting by wrapping lines
### IDE. Run Configurations
- [`KT-34516`](https://youtrack.jetbrains.com/issue/KT-34516) Don't suggest incompatible targets in a drop-down list for run test gutter icon in multiplatform projects
- [`KT-38102`](https://youtrack.jetbrains.com/issue/KT-38102) DeprecatedMethodException ConfigurationFactory.getId
### IDE. Scratch
- [`KT-38455`](https://youtrack.jetbrains.com/issue/KT-38455) Kotlin scratch files don't take module's JVM target setting into account
### IDE. Script
- [`KT-39791`](https://youtrack.jetbrains.com/issue/KT-39791) Kotlin plugin loads VFS in the output directories
### IDE. Structural Search
- [`KT-39721`](https://youtrack.jetbrains.com/issue/KT-39721) Optimize Kotlin SSR by using the index
- [`KT-39733`](https://youtrack.jetbrains.com/issue/KT-39733) Augmented assignment matching
- [`KT-39769`](https://youtrack.jetbrains.com/issue/KT-39769) "When expressions" predefined template doesn't match all when expressions
### IDE. Wizards
- [`KT-38673`](https://youtrack.jetbrains.com/issue/KT-38673) New Project Wizard: multiplatform templates are generated having unsupported Gradle version in a wrapper
- [`KT-38810`](https://youtrack.jetbrains.com/issue/KT-38810) Incorrect order of build phases in Xcode project from new wizard
- [`KT-38952`](https://youtrack.jetbrains.com/issue/KT-38952) Remove old new_project_wizards
- [`KT-39503`](https://youtrack.jetbrains.com/issue/KT-39503) New Project wizard 1.4+: release kotlinx.html version is added to dependencies with milestone IDE plugin
- [`KT-39700`](https://youtrack.jetbrains.com/issue/KT-39700) Wizard: group project templates on the first step by the project type
- [`KT-39770`](https://youtrack.jetbrains.com/issue/KT-39770) CSS Support in Kotlin wizards
- [`KT-39826`](https://youtrack.jetbrains.com/issue/KT-39826) Fix Android app in New Template Wizard
- [`KT-39843`](https://youtrack.jetbrains.com/issue/KT-39843) Change imports in JS/browser wizard
### JS. Tools
- [`KT-32273`](https://youtrack.jetbrains.com/issue/KT-32273) Kotlin/JS console error on hot reload
- [`KT-39498`](https://youtrack.jetbrains.com/issue/KT-39498) Update dukat version in toolchain near to release of 1.4-M3
### JavaScript
- [`KT-29916`](https://youtrack.jetbrains.com/issue/KT-29916) Implement `typeOf` on JS
- [`KT-35857`](https://youtrack.jetbrains.com/issue/KT-35857) Kotlin/JS CLI bundled to IDEA plugin can't compile using IR back-end out of the box
- [`KT-36798`](https://youtrack.jetbrains.com/issue/KT-36798) KJS: prohibit using @JsExport on a non-top-level declaration
- [`KT-37771`](https://youtrack.jetbrains.com/issue/KT-37771) KJS: Generated TypeScript does not recursively export base classes (can fail with generics)
- [`KT-38113`](https://youtrack.jetbrains.com/issue/KT-38113) Review public API of JS stdlib for IR BE
- [`KT-38765`](https://youtrack.jetbrains.com/issue/KT-38765) [JS / IR] AssertionError: class EventEmitter: Super class should be any: with nested class extending parent class
- [`KT-38768`](https://youtrack.jetbrains.com/issue/KT-38768) KJS IR: generate ES2015 (aka ES6) classes
### Libraries
#### New Features
- [`KT-11253`](https://youtrack.jetbrains.com/issue/KT-11253) Function to sum long or other numeric property of items in a collection
- [`KT-28933`](https://youtrack.jetbrains.com/issue/KT-28933) capitalize() with Locale argument in the JDK stdlib
- [`KT-34142`](https://youtrack.jetbrains.com/issue/KT-34142) Create SortedMap with Comparator and items
- [`KT-34506`](https://youtrack.jetbrains.com/issue/KT-34506) Add Sequence.flatMap overload that works on Iterable
- [`KT-36894`](https://youtrack.jetbrains.com/issue/KT-36894) Support flatMapIndexed in the Collections API
- [`KT-38480`](https://youtrack.jetbrains.com/issue/KT-38480) Introduce experimental annotation for enabling overload resolution by lambda result
- [`KT-38708`](https://youtrack.jetbrains.com/issue/KT-38708) minOf/maxOf functions to return min/max value provided by selector
- [`KT-39707`](https://youtrack.jetbrains.com/issue/KT-39707) Make some interfaces in stdlib functional
#### Performance Improvements
- [`KT-23142`](https://youtrack.jetbrains.com/issue/KT-23142) toHashSet is suboptimal for inputs with a lot of duplicates
#### Fixes
- [`KT-21266`](https://youtrack.jetbrains.com/issue/KT-21266) Add module-info for standard library artifacts
- [`KT-23322`](https://youtrack.jetbrains.com/issue/KT-23322) Document 'reduce' operation behavior on empty collections
- [`KT-28753`](https://youtrack.jetbrains.com/issue/KT-28753) Comparing floating point values in array/list operations 'contains', 'indexOf', 'lastIndexOf': IEEE 754 or total order
- [`KT-30083`](https://youtrack.jetbrains.com/issue/KT-30083) Annotate KTypeProjection.STAR with JvmField in a compatible way
- [`KT-30084`](https://youtrack.jetbrains.com/issue/KT-30084) Annotate functions in KTypeProjection.Companion with JvmStatic
- [`KT-31343`](https://youtrack.jetbrains.com/issue/KT-31343) Deprecate old String <-> CharArray, ByteArray conversion api
- [`KT-34596`](https://youtrack.jetbrains.com/issue/KT-34596) Add some validation to KTypeProjection constructor
- [`KT-35978`](https://youtrack.jetbrains.com/issue/KT-35978) Review and remove experimental stdlib API status for 1.4
- [`KT-38388`](https://youtrack.jetbrains.com/issue/KT-38388) Document `fromIndex` and `toIndex` parameters
- [`KT-38854`](https://youtrack.jetbrains.com/issue/KT-38854) Gradually change the return type of collection min/max functions to non-nullable
- [`KT-39023`](https://youtrack.jetbrains.com/issue/KT-39023) Document split(Pattern) extension differences from Pattern.split
- [`KT-39064`](https://youtrack.jetbrains.com/issue/KT-39064) Introduce minOrNull and maxOrNull extension functions on collections
- [`KT-39235`](https://youtrack.jetbrains.com/issue/KT-39235) Lift experimental annotation from bit operations
- [`KT-39237`](https://youtrack.jetbrains.com/issue/KT-39237) Lift experimental annotation from common StringBuilder
- [`KT-39238`](https://youtrack.jetbrains.com/issue/KT-39238) Appendable.appendRange - remove nullability
- [`KT-39239`](https://youtrack.jetbrains.com/issue/KT-39239) Lift experimental annotation from String <-> utf8 conversion api
- [`KT-39244`](https://youtrack.jetbrains.com/issue/KT-39244) KJS: update polyfills, all or most of them must not be enumerable
- [`KT-39330`](https://youtrack.jetbrains.com/issue/KT-39330) Migrate declarations from kotlin.dom and kotlin.browser packages to kotlinx.*
### Middle-end. IR
- [`KT-31088`](https://youtrack.jetbrains.com/issue/KT-31088) need a way to compute fake overrides for pure IR
- [`KT-33207`](https://youtrack.jetbrains.com/issue/KT-33207) Kotlin/Native: KNPE during deserialization of an inner class
- [`KT-33267`](https://youtrack.jetbrains.com/issue/KT-33267) Kotlin/Native: Deserialization error for an "inner" extension property imported from a class
- [`KT-37255`](https://youtrack.jetbrains.com/issue/KT-37255) Make psi2ir aware of declarations provided by compiler plugins
### Reflection
- [`KT-22936`](https://youtrack.jetbrains.com/issue/KT-22936) Not all things can be changed to `createType` yet, and now `defaultType` methods are starting to fail
- [`KT-32241`](https://youtrack.jetbrains.com/issue/KT-32241) Move KType.javaType into stdlib from reflect
- [`KT-34344`](https://youtrack.jetbrains.com/issue/KT-34344) KType.javaType implementation throws when invoked with a typeOf<T>()
- [`KT-38491`](https://youtrack.jetbrains.com/issue/KT-38491) IllegalArgumentException when using callBy on function with inline class parameters and default arguments
- [`KT-38881`](https://youtrack.jetbrains.com/issue/KT-38881) Add KClass.isFun modifier of functional interfaces to reflection
### Tools. Android Extensions
- [`KT-25807`](https://youtrack.jetbrains.com/issue/KT-25807) Kotlin extension annotation @Parcelize in AIDL returns Object instead of original T
### Tools. CLI
- [`KT-30211`](https://youtrack.jetbrains.com/issue/KT-30211) Support a way to pass arguments to the underlying JVM in kotlinc batch scripts on Windows
- [`KT-30778`](https://youtrack.jetbrains.com/issue/KT-30778) kotlin-compiler.jar contains shaded but not relocated kotlinx.coroutines
- [`KT-38070`](https://youtrack.jetbrains.com/issue/KT-38070) Compiler option to bypass prerelease metadata incompatibility error
- [`KT-38413`](https://youtrack.jetbrains.com/issue/KT-38413) Add JVM target bytecode version 14
### Tools. Compiler Plugins
- [`KT-39274`](https://youtrack.jetbrains.com/issue/KT-39274) [KJS / IR] Custom serializer for class without zero argument constructor doesn't compile
### Tools. Gradle
- [`KT-25428`](https://youtrack.jetbrains.com/issue/KT-25428) Kotlin Gradle Plugin: Use new Gradle API for Lazy tasks
- [`KT-34487`](https://youtrack.jetbrains.com/issue/KT-34487) Gradle build fails with "Cannot run program "java": error=7, Argument list too long
- [`KT-35957`](https://youtrack.jetbrains.com/issue/KT-35957) MPP IC fails with "X has several compatible actual declarations" error
- [`KT-38250`](https://youtrack.jetbrains.com/issue/KT-38250) Drop support for Gradle versions older than 5.3 in the Kotlin Gradle plugin
### Tools. Gradle. JS
#### New Features
- [`KT-30619`](https://youtrack.jetbrains.com/issue/KT-30619) Support NPM transitive dependencies in multi-platform JS target
- [`KT-38286`](https://youtrack.jetbrains.com/issue/KT-38286) [Gradle, JS] Error handling on Webpack problems
#### Fixes
- [`KT-31669`](https://youtrack.jetbrains.com/issue/KT-31669) Gradle/JS: rise error when plugin loaded more than once
- [`KT-32531`](https://youtrack.jetbrains.com/issue/KT-32531) [Gradle/JS] Add scoped NPM dependencies
- [`KT-34832`](https://youtrack.jetbrains.com/issue/KT-34832) [Kotlin/JS] Failed build after webpack run (Karma not found)
- [`KT-35194`](https://youtrack.jetbrains.com/issue/KT-35194) Kotlin/JS: browserRun fails with "address already in use" when trying to connect to local server
- [`KT-35611`](https://youtrack.jetbrains.com/issue/KT-35611) Kotlin Gradle plugin should report `kotlin2js` plugin ID as deprecated
- [`KT-35641`](https://youtrack.jetbrains.com/issue/KT-35641) Kotlin Gradle plugin should report `kotlin-dce-js` plugin ID as deprecated
- [`KT-36410`](https://youtrack.jetbrains.com/issue/KT-36410) JS: Collect stats about IR backend usage
- [`KT-36451`](https://youtrack.jetbrains.com/issue/KT-36451) KJS Adding npm dependency breaks Webpack devserver reloading
- [`KT-37258`](https://youtrack.jetbrains.com/issue/KT-37258) Kotlin/JS + Gradle: in continuous mode kotlinNpmInstall time to time outputs "ENOENT: no such file or directory" error
- [`KT-38109`](https://youtrack.jetbrains.com/issue/KT-38109) [Gradle, JS] Error handling on Karma launcher problems
- [`KT-38331`](https://youtrack.jetbrains.com/issue/KT-38331) Add an ability to control generating externals for npm deps individually
- [`KT-38485`](https://youtrack.jetbrains.com/issue/KT-38485) [Gradle, JS] Unable to configure JS compiler with string
- [`KT-38683`](https://youtrack.jetbrains.com/issue/KT-38683) Remove possibility to set NPM dependency without version
- [`KT-38990`](https://youtrack.jetbrains.com/issue/KT-38990) Support multiple range versions for NPM dependencies
- [`KT-38994`](https://youtrack.jetbrains.com/issue/KT-38994) Remove possibility to set NPM dependency with npm(org, name, version)
- [`KT-39109`](https://youtrack.jetbrains.com/issue/KT-39109) ArithmeticException: "/ by zero" caused by kotlinNodeJsSetup task with enabled gradle caching on Windows
- [`KT-39210`](https://youtrack.jetbrains.com/issue/KT-39210) Kotlin/JS: with both JS and MPP modules in the same project Gradle configuration fails on `nodejs {}` and `browser {}`
- [`KT-39377`](https://youtrack.jetbrains.com/issue/KT-39377) Use standard source-map-loader instead of custom one
### Tools. Gradle. Multiplatform
- [`KT-39184`](https://youtrack.jetbrains.com/issue/KT-39184) Support publication of Kotlin-distributed libraries with Gradle Metadata
- [`KT-39304`](https://youtrack.jetbrains.com/issue/KT-39304) Gradle import error `java.util.NoSuchElementException: Key source set foo is missing in the map` on unused source set
### Tools. Gradle. Native
- [`KT-37514`](https://youtrack.jetbrains.com/issue/KT-37514) CocoaPods Gradle plugin: Support building from terminal projects for several platforms
- [`KT-38440`](https://youtrack.jetbrains.com/issue/KT-38440) Make error message about missing Podfile path for cocoapods integration actionable for a user
- [`KT-38991`](https://youtrack.jetbrains.com/issue/KT-38991) Gradle MPP plugin: Enable parallel in-process execution for K/N compiler
- [`KT-39935`](https://youtrack.jetbrains.com/issue/KT-39935) Support overriding the `KotlinNativeCompile` task sources
- [`KT-37512`](https://youtrack.jetbrains.com/issue/KT-37512) Cocoapods Gradle plugin: Improve error logging for external tools
### Tools. J2K
- [`KT-35169`](https://youtrack.jetbrains.com/issue/KT-35169) Do not show "Inline local variable" popup during "Cleaning up code" phase of J2K
- [`KT-38004`](https://youtrack.jetbrains.com/issue/KT-38004) J2K breaks java getter call in java code
- [`KT-38450`](https://youtrack.jetbrains.com/issue/KT-38450) J2K should convert Java SAM interfaces to Kotlin fun interfaces
### Tools. JPS
- [`KT-27458`](https://youtrack.jetbrains.com/issue/KT-27458) The Kotlin standard library is not found in the module graph ... in a non-Kotlin project.
- [`KT-29552`](https://youtrack.jetbrains.com/issue/KT-29552) Project is completely rebuilt after each gradle sync.
### Tools. Scripts
- [`KT-37766`](https://youtrack.jetbrains.com/issue/KT-37766) Impossible to apply compiler plugins onto scripts with the new scripting API
### Tools. kapt
- [`KT-29355`](https://youtrack.jetbrains.com/issue/KT-29355) Provide access to default values for primary constructor properties
## 1.4-M2
### Compiler
@@ -100,6 +599,8 @@
- [`KT-38668`](https://youtrack.jetbrains.com/issue/KT-38668) Project with module dependency in KN, build fails with Kotlin 1.3.71 and associated libs but passes with 1.3.61.
- [`KT-38857`](https://youtrack.jetbrains.com/issue/KT-38857) Class versions V1_5 or less must use F_NEW frames.
- [`KT-39113`](https://youtrack.jetbrains.com/issue/KT-39113) "AssertionError: Uninitialized value on stack" with EXACTLY_ONCE contract in non-inline function and lambda destructuring
- [`KT-28483`](https://youtrack.jetbrains.com/issue/KT-28483) Override of generic-return-typed function with inline class should lead to a boxing
- [`KT-37963`](https://youtrack.jetbrains.com/issue/KT-37963) ClassCastException: Value of inline class represented as 'java.lang.Object' is not boxed properly on return from lambda
### Docs & Examples
@@ -325,6 +826,7 @@
- [`KT-38579`](https://youtrack.jetbrains.com/issue/KT-38579) New Project wizard 1.4+: multiplatform mobile application: build fails on lint task: Configuration with name 'compileClasspath' not found
- [`KT-38929`](https://youtrack.jetbrains.com/issue/KT-38929) New project wizard: update libraries in project template according to kotlin IDE plugin version
- [`KT-38417`](https://youtrack.jetbrains.com/issue/KT-38417) Enable new project wizard by-default
- [`KT-38158`](https://youtrack.jetbrains.com/issue/KT-38158) java.lang.NullPointerException when try to create new project via standard wizard on Mac os
### JS. Tools
@@ -377,6 +879,7 @@
- [`KT-16529`](https://youtrack.jetbrains.com/issue/KT-16529) Names of KProperty's type parameters are inconsistent with ReadOnlyProperty/ReadWriteProperty
- [`KT-36356`](https://youtrack.jetbrains.com/issue/KT-36356) Specify which element Iterable.distinctBy(selector) retains
- [`KT-38060`](https://youtrack.jetbrains.com/issue/KT-38060) runningFold and runningReduce instead of scanReduce
- [`KT-38566`](https://youtrack.jetbrains.com/issue/KT-38566) Kotlin/JS IR: kx.serialization & ktor+JsonFeature: SerializationException: Can't locate argument-less serializer for class
### Reflection
@@ -1006,6 +1509,33 @@
- [`KT-35414`](https://youtrack.jetbrains.com/issue/KT-35414) Switch for `-Xexpression` to `-expression`/`-e` cli argument syntax for JVM cli compiler in 1.4
## 1.3.72 - IDE plugins update
### Backend. JVM
- [`KT-39013`](https://youtrack.jetbrains.com/issue/KT-39013) 202, ASM 8: "AnalyzerException: Execution can fall off the end of the code"
### IDE. Decompiler, Indexing, Stubs
- [`KT-37896`](https://youtrack.jetbrains.com/issue/KT-37896) IAE: "Argument for @NotNull parameter 'file' of IndexTodoCacheManagerImpl.getTodoCount must not be null" through KotlinTodoSearcher.processQuery()
### IDE. Gradle Integration
- [`KT-38037`](https://youtrack.jetbrains.com/issue/KT-38037) UnsupportedOperationException on sync gradle Kotlin project with at least two multiplatform modules
### IDE. Highlighting
- [`KT-39590`](https://youtrack.jetbrains.com/issue/KT-39590) Turn new inference in IDE for 1.3.70 version off
### IDE. Refactorings
- [`KT-38527`](https://youtrack.jetbrains.com/issue/KT-38527) Move nested class to upper level fails silently: MissingResourceException
### Tools.JPS
- [`KT-27458`](https://youtrack.jetbrains.com/issue/KT-27458) The Kotlin standard library is not found in the module graph ... in a non-Kotlin project.
## 1.3.72
### Compiler

View File

@@ -41,7 +41,12 @@ For local development, if you're not working on bytecode generation or the stand
You also can use [Gradle properties](https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties) to setup `JDK_*` variables.
> Note: The JDK 6 for MacOS is not available on Oracle's site. You can [download it here](https://support.apple.com/kb/DL1572).
Note: The JDK 6 for MacOS is not available on Oracle's site. You can install it by
```bash
$ brew tap caskroom/versions
$ brew cask install java6
```
On Windows you might need to add long paths setting to the repo:
@@ -81,6 +86,8 @@ command line parameters on the first run:
- `compilerTest` - build and run all compiler tests
- `ideaPluginTest` - build and run all IDEA plugin tests
To reproduce TeamCity build use `-Pteamcity=true` flag. Local builds don't run proguard and have jar compression disabled by default.
**OPTIONAL:** Some artifacts, mainly Maven plugin ones, are built separately with Maven.
Refer to [libraries/ReadMe.md](libraries/ReadMe.md) for details.

View File

@@ -8,10 +8,8 @@ buildscript {
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlinx")
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-dev")
} else {
maven("https://dl.bintray.com/kotlin/kotlinx")
maven("https://dl.bintray.com/kotlin/kotlin-dev")
}
}
dependencies {
@@ -30,16 +28,15 @@ repositories {
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlinx")
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-dev")
} else {
} else {
maven("https://dl.bintray.com/kotlin/kotlinx")
maven("https://dl.bintray.com/kotlin/kotlin-dev")
}
}
dependencies {
compile(kotlinStdlib())
compile(project(":compiler:frontend"))
compile(projectTests(":compiler:tests-common"))
compile(project(":compiler:cli"))
compile(intellijCoreDep()) { includeJars("intellij-core") }
compile(jpsStandalone()) { includeJars("jps-model") }
@@ -73,6 +70,7 @@ benchmark {
param("size", 1000)
include("CommonCallsBenchmark")
include("ControlFlowAnalysisBenchmark")
//include("InferenceBaselineCallsBenchmark")
}
@@ -95,3 +93,52 @@ benchmark {
register("main")
}
}
tasks.named("classes") {
doLast {
tasks.named("mainBenchmarkJar", Zip::class.java) {
isZip64 = true
archiveName = "benchmarks.jar"
}
listOf("mainBenchmark", "mainFirBenchmark", "mainNiBenchmark").forEach {
tasks.named(it, JavaExec::class.java) {
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
}
}
}
}
tasks.register<JavaExec>("runBenchmark") {
// jmhArgs example: -PjmhArgs='CommonCalls -p size=500 -p isIR=true -p useNI=true -f 1'
val jmhArgs = if (project.hasProperty("jmhArgs")) project.property("jmhArgs").toString() else ""
val resultFilePath = "$buildDir/benchmarks/jmh-result.json"
val ideaHome = intellijRootDir().canonicalPath
val benchmarkJarPath = "$buildDir/benchmarks/main/jars/benchmarks.jar"
args = mutableListOf("-Didea.home.path=$ideaHome", benchmarkJarPath, "-rf", "json", "-rff", resultFilePath) + jmhArgs.split("\\s".toRegex())
main = "-jar"
doLast {
if (project.kotlinBuildProperties.isTeamcityBuild) {
val jsonArray = com.google.gson.JsonParser.parseString(File(resultFilePath).readText()).asJsonArray
jsonArray.forEach {
val benchmark = it.asJsonObject
// remove unnecessary name parts from string like this "org.jetbrains.kotlin.benchmarks.CommonCallsBenchmark.benchmark"
val name = benchmark["benchmark"].asString.removeSuffix(".benchmark").let {
val indexOfLastDot = it.indexOfLast { it == '.' }
it.removeRange(0..indexOfLastDot)
}
val params = benchmark["params"].asJsonObject
val isIR = if (params.has("isIR")) params["isIR"].asString else "false"
val useNI = if (params.has("useNI")) params["useNI"].asString else "false"
val size = params["size"].asString
val score = "%.3f".format(benchmark["primaryMetric"].asJsonObject["score"].asString.toFloat())
val irPostfix = if (isIR.toBoolean()) " isIR=true" else ""
val niPostfix = if (useNI.toBoolean() && !isIR.toBoolean()) " isNI=true" else ""
println("""##teamcity[buildStatisticValue key='$name size=$size${irPostfix}$niPostfix' value='$score']""")
}
}
}
}

View File

@@ -13,7 +13,6 @@ import com.intellij.psi.PsiFileFactory
import com.intellij.psi.impl.PsiFileFactoryImpl
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.testFramework.LightVirtualFile
import org.jetbrains.kotlin.analyzer.ModuleInfo
import org.jetbrains.kotlin.asJava.finder.JavaElementFinder
import org.jetbrains.kotlin.builtins.jvm.JvmBuiltIns
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
@@ -26,21 +25,15 @@ import org.jetbrains.kotlin.context.withModule
import org.jetbrains.kotlin.context.withProject
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
import org.jetbrains.kotlin.diagnostics.Severity
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.builder.RawFirBuilder
import org.jetbrains.kotlin.fir.java.FirJavaModuleBasedSession
import org.jetbrains.kotlin.fir.java.FirLibrarySession
import org.jetbrains.kotlin.fir.java.FirProjectSessionProvider
import org.jetbrains.kotlin.fir.createSession
import org.jetbrains.kotlin.fir.java.FirJavaElementFinder
import org.jetbrains.kotlin.fir.resolve.firProvider
import org.jetbrains.kotlin.fir.resolve.providers.impl.FirProviderImpl
import org.jetbrains.kotlin.fir.resolve.transformers.FirTotalResolveProcessor
import org.jetbrains.kotlin.idea.KotlinLanguage
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
import org.jetbrains.kotlin.storage.ExceptionTracker
import org.jetbrains.kotlin.storage.LockBasedStorageManager
import org.jetbrains.kotlin.storage.StorageManager
@@ -170,43 +163,10 @@ abstract class AbstractSimpleFileBenchmark {
totalTransformer.process(listOf(firFile))
bh.consume(firFile.hashCode())
Extensions.getArea(env.project)
.getExtensionPoint(PsiElementFinder.EP_NAME)
.unregisterExtension(FirJavaElementFinder::class.java)
}
protected abstract fun buildText(): String
}
fun createSession(
environment: KotlinCoreEnvironment,
sourceScope: GlobalSearchScope,
librariesScope: GlobalSearchScope = GlobalSearchScope.notScope(sourceScope)
): FirSession {
val moduleInfo = FirTestModuleInfo()
val project = environment.project
val provider = FirProjectSessionProvider(project)
return FirJavaModuleBasedSession.create(moduleInfo, provider, sourceScope).also {
createSessionForDependencies(provider, moduleInfo, librariesScope, environment)
}
}
private fun createSessionForDependencies(
provider: FirProjectSessionProvider,
moduleInfo: FirTestModuleInfo,
librariesScope: GlobalSearchScope,
environment: KotlinCoreEnvironment
) {
val dependenciesInfo = FirTestModuleInfo()
moduleInfo.dependencies.add(dependenciesInfo)
FirLibrarySession.create(
dependenciesInfo, provider, librariesScope, environment.project,
environment.createPackagePartProvider(librariesScope)
)
}
class FirTestModuleInfo(
override val name: Name = Name.identifier("TestModule"),
val dependencies: MutableList<ModuleInfo> = mutableListOf(),
override val platform: TargetPlatform = JvmPlatforms.unspecifiedJvmPlatform,
override val analyzerServices: PlatformDependentAnalyzerServices = JvmPlatformAnalyzerServices
) : ModuleInfo {
override fun dependencies(): List<ModuleInfo> = dependencies
}

View File

@@ -0,0 +1,35 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.benchmarks
import org.openjdk.jmh.annotations.*
import org.openjdk.jmh.infra.Blackhole
import java.util.concurrent.TimeUnit
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@State(Scope.Benchmark)
open class ControlFlowAnalysisBenchmark : AbstractSimpleFileBenchmark() {
@Param("1000")
private var size: Int = 0
@Benchmark
fun benchmark(bh: Blackhole) {
analyzeGreenFile(bh)
}
override fun buildText() =
buildString {
appendLine("fun test() {")
for (i in 0 until size) {
appendLine("for (i$i in 0..10) { ")
}
for (i in 0 until size) {
appendLine("}")
}
appendLine("}")
}
}

View File

@@ -75,7 +75,7 @@ open class IncrementalJsCache(
override fun markDirty(removedAndCompiledSources: Collection<File>) {
removedAndCompiledSources.forEach { sourceFile ->
// The common prefix of all FQN parents has to be the file package
sourceToClassesMap[sourceFile].map { it.parentOrNull()?.asString() ?: "" }.minBy { it.length }?.let {
sourceToClassesMap[sourceFile].map { it.parentOrNull()?.asString() ?: "" }.minByOrNull { it.length }?.let {
packageMetadata.remove(it)
}
}

View File

@@ -168,6 +168,8 @@ open class IncrementalJvmCache(
constantsMap.process(kotlinClass, changesCollector)
inlineFunctionsMap.process(kotlinClass, changesCollector)
}
KotlinClassHeader.Kind.UNKNOWN, KotlinClassHeader.Kind.SYNTHETIC_CLASS -> {
}
}
}

View File

@@ -80,7 +80,7 @@ open class LookupStorage(
for (lookupSymbol in lookups.keySet().sorted()) {
val key = LookupSymbolKey(lookupSymbol.name, lookupSymbol.scope)
val paths = lookups[lookupSymbol]!!
val paths = lookups[lookupSymbol]
val fileIds = paths.mapTo(TreeSet()) { pathToId[it]!! }
fileIds.addAll(lookupMap[key] ?: emptySet())
lookupMap[key] = fileIds

View File

@@ -14,6 +14,8 @@
* limitations under the License.
*/
@file:Suppress("UNUSED_PARAMETER")
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.library.metadata.KlibMetadataProtoBuf

View File

@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.incremental.storage
import com.intellij.util.io.DataExternalizer
import com.intellij.util.io.KeyDescriptor
import com.intellij.util.io.JpsPersistentHashMap
import com.intellij.util.io.PersistentHashMap
import java.io.File
@@ -28,10 +28,10 @@ class NonCachingLazyStorage<K, V>(
private val valueExternalizer: DataExternalizer<V>
) : LazyStorage<K, V> {
@Volatile
private var storage: JpsPersistentHashMap<K, V>? = null
private var storage: PersistentHashMap<K, V>? = null
@Synchronized
private fun getStorageIfExists(): JpsPersistentHashMap<K, V>? {
private fun getStorageIfExists(): PersistentHashMap<K, V>? {
if (storage != null) return storage
if (storageFile.exists()) {
@@ -43,7 +43,7 @@ class NonCachingLazyStorage<K, V>(
}
@Synchronized
private fun getStorageOrCreateNew(): JpsPersistentHashMap<K, V> {
private fun getStorageOrCreateNew(): PersistentHashMap<K, V> {
if (storage == null) {
storage = createMap()
}
@@ -69,7 +69,7 @@ class NonCachingLazyStorage<K, V>(
}
override fun append(key: K, value: V) {
getStorageOrCreateNew().appendDataWithoutCache(key, value)
getStorageOrCreateNew().appendData(key) { dataOutput -> valueExternalizer.save(dataOutput, value) }
}
@Synchronized
@@ -79,7 +79,7 @@ class NonCachingLazyStorage<K, V>(
} catch (ignored: Throwable) {
}
JpsPersistentHashMap.deleteFilesStartingWith(storageFile)
PersistentHashMap.deleteFilesStartingWith(storageFile)
storage = null
}
@@ -101,6 +101,6 @@ class NonCachingLazyStorage<K, V>(
storage?.close()
}
private fun createMap(): JpsPersistentHashMap<K, V> =
JpsPersistentHashMap(storageFile, keyDescriptor, valueExternalizer)
private fun createMap(): PersistentHashMap<K, V> =
PersistentHashMap(storageFile, keyDescriptor, valueExternalizer)
}

View File

@@ -0,0 +1,106 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.incremental.storage
import com.intellij.util.io.DataExternalizer
import com.intellij.util.io.KeyDescriptor
import com.intellij.util.io.JpsPersistentHashMap
import java.io.File
class NonCachingLazyStorage<K, V>(
private val storageFile: File,
private val keyDescriptor: KeyDescriptor<K>,
private val valueExternalizer: DataExternalizer<V>
) : LazyStorage<K, V> {
@Volatile
private var storage: JpsPersistentHashMap<K, V>? = null
@Synchronized
private fun getStorageIfExists(): JpsPersistentHashMap<K, V>? {
if (storage != null) return storage
if (storageFile.exists()) {
storage = createMap()
return storage
}
return null
}
@Synchronized
private fun getStorageOrCreateNew(): JpsPersistentHashMap<K, V> {
if (storage == null) {
storage = createMap()
}
return storage!!
}
override val keys: Collection<K>
get() = getStorageIfExists()?.allKeysWithExistingMapping ?: listOf()
override operator fun contains(key: K): Boolean =
getStorageIfExists()?.containsMapping(key) ?: false
override operator fun get(key: K): V? =
getStorageIfExists()?.get(key)
override operator fun set(key: K, value: V) {
getStorageOrCreateNew().put(key, value)
}
override fun remove(key: K) {
getStorageIfExists()?.remove(key)
}
override fun append(key: K, value: V) {
getStorageOrCreateNew().appendDataWithoutCache(key, value)
}
@Synchronized
override fun clean() {
try {
storage?.close()
} catch (ignored: Throwable) {
}
JpsPersistentHashMap.deleteFilesStartingWith(storageFile)
storage = null
}
@Synchronized
override fun flush(memoryCachesOnly: Boolean) {
val existingStorage = storage ?: return
if (memoryCachesOnly) {
if (existingStorage.isDirty) {
existingStorage.dropMemoryCaches()
}
} else {
existingStorage.force()
}
}
@Synchronized
override fun close() {
storage?.close()
}
private fun createMap(): JpsPersistentHashMap<K, V> =
JpsPersistentHashMap(storageFile, keyDescriptor, valueExternalizer)
}

View File

@@ -1,106 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.incremental.storage
import com.intellij.util.io.DataExternalizer
import com.intellij.util.io.KeyDescriptor
import com.intellij.util.io.PersistentHashMap
import java.io.File
class NonCachingLazyStorage<K, V>(
private val storageFile: File,
private val keyDescriptor: KeyDescriptor<K>,
private val valueExternalizer: DataExternalizer<V>
) : LazyStorage<K, V> {
@Volatile
private var storage: PersistentHashMap<K, V>? = null
@Synchronized
private fun getStorageIfExists(): PersistentHashMap<K, V>? {
if (storage != null) return storage
if (storageFile.exists()) {
storage = createMap()
return storage
}
return null
}
@Synchronized
private fun getStorageOrCreateNew(): PersistentHashMap<K, V> {
if (storage == null) {
storage = createMap()
}
return storage!!
}
override val keys: Collection<K>
get() = getStorageIfExists()?.allKeysWithExistingMapping ?: listOf()
override operator fun contains(key: K): Boolean =
getStorageIfExists()?.containsMapping(key) ?: false
override operator fun get(key: K): V? =
getStorageIfExists()?.get(key)
override operator fun set(key: K, value: V) {
getStorageOrCreateNew().put(key, value)
}
override fun remove(key: K) {
getStorageIfExists()?.remove(key)
}
override fun append(key: K, value: V) {
getStorageOrCreateNew().appendData(key) { dataOutput -> valueExternalizer.save(dataOutput, value) }
}
@Synchronized
override fun clean() {
try {
storage?.close()
} catch (ignored: Throwable) {
}
PersistentHashMap.deleteFilesStartingWith(storageFile)
storage = null
}
@Synchronized
override fun flush(memoryCachesOnly: Boolean) {
val existingStorage = storage ?: return
if (memoryCachesOnly) {
if (existingStorage.isDirty) {
existingStorage.dropMemoryCaches()
}
} else {
existingStorage.force()
}
}
@Synchronized
override fun close() {
storage?.close()
}
private fun createMap(): PersistentHashMap<K, V> =
PersistentHashMap(storageFile, keyDescriptor, valueExternalizer)
}

View File

@@ -27,7 +27,7 @@ buildscript {
dependencies {
bootstrapCompilerClasspath(kotlin("compiler-embeddable", bootstrapKotlinVersion))
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.17")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.19")
classpath(kotlin("gradle-plugin", bootstrapKotlinVersion))
classpath("org.jetbrains.dokka:dokka-gradle-plugin:0.9.17")
}
@@ -152,6 +152,7 @@ rootProject.apply {
from(rootProject.file("gradle/jps.gradle.kts"))
from(rootProject.file("gradle/checkArtifacts.gradle.kts"))
from(rootProject.file("gradle/checkCacheability.gradle.kts"))
from(rootProject.file("gradle/retryPublishing.gradle.kts"))
}
IdeVersionConfigurator.setCurrentIde(project)
@@ -177,7 +178,7 @@ extra["versions.jflex"] = "1.7.0"
extra["versions.markdown"] = "0.1.25"
extra["versions.trove4j"] = "1.0.20181211"
extra["versions.completion-ranking-kotlin"] = "0.1.2"
extra["versions.r8"] = "1.5.70"
extra["versions.r8"] = "2.0.88"
val immutablesVersion = "0.3.1"
extra["versions.kotlinx-collections-immutable"] = immutablesVersion
extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
@@ -186,12 +187,13 @@ extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
extra["versions.ktor-network"] = "1.0.1"
if (!project.hasProperty("versions.kotlin-native")) {
extra["versions.kotlin-native"] = "1.4-M3-dev-15627"
extra["versions.kotlin-native"] = "1.4.20-dev-16314"
}
val intellijUltimateEnabled by extra(project.kotlinBuildProperties.intellijUltimateEnabled)
val effectSystemEnabled by extra(project.getBooleanProperty("kotlin.compiler.effectSystemEnabled") ?: false)
val newInferenceEnabled by extra(project.getBooleanProperty("kotlin.compiler.newInferenceEnabled") ?: false)
val useJvmIrBackend by extra(project.getBooleanProperty("kotlin.build.useIR") ?: false)
val intellijSeparateSdks = project.getBooleanProperty("intellijSeparateSdks") ?: false
@@ -227,6 +229,8 @@ extra["compilerModules"] = arrayOf(
":compiler:frontend.java",
":compiler:cli-common",
":compiler:ir.tree",
":compiler:ir.tree.impl",
":compiler:ir.tree.persistent",
":compiler:ir.psi2ir",
":compiler:ir.backend.common",
":compiler:backend.jvm",
@@ -235,6 +239,7 @@ extra["compilerModules"] = arrayOf(
":compiler:ir.serialization.common",
":compiler:ir.serialization.js",
":compiler:ir.serialization.jvm",
":compiler:ir.interpreter",
":kotlin-util-io",
":kotlin-util-klib",
":kotlin-util-klib-metadata",
@@ -260,17 +265,17 @@ extra["compilerModules"] = arrayOf(
":kotlin-build-common",
":core:metadata",
":core:metadata.jvm",
":core:compiler.common",
":core:descriptors",
":core:descriptors.jvm",
":core:descriptors.runtime",
":core:deserialization",
":core:util.runtime",
":core:type-system",
":compiler:fir:cones",
":compiler:fir:resolve",
":compiler:fir:fir-serialization",
":compiler:fir:tree",
":compiler:fir:raw-fir:fir-common",
":compiler:fir:raw-fir:raw-fir.common",
":compiler:fir:raw-fir:psi2fir",
":compiler:fir:raw-fir:light-tree2fir",
":compiler:fir:fir2ir",
@@ -282,7 +287,6 @@ extra["compilerModules"] = arrayOf(
)
extra["compilerModulesForJps"] = listOf(
":core:type-system",
":kotlin-build-common",
":kotlin-util-io",
":kotlin-util-klib",
@@ -291,6 +295,7 @@ extra["compilerModulesForJps"] = listOf(
":kotlin-compiler-runner",
":daemon-common",
":daemon-common-new",
":core:compiler.common",
":core:descriptors",
":core:descriptors.jvm",
":idea:idea-jps-common",
@@ -307,7 +312,6 @@ val coreLibProjects = listOfNotNull(
":kotlin-stdlib",
":kotlin-stdlib-common",
":kotlin-stdlib-js",
":kotlin-stdlib-js-ir",
":kotlin-stdlib-jdk7",
":kotlin-stdlib-jdk8",
":kotlin-test:kotlin-test-annotations-common",
@@ -317,7 +321,6 @@ val coreLibProjects = listOfNotNull(
":kotlin-test:kotlin-test-junit5",
":kotlin-test:kotlin-test-testng",
":kotlin-test:kotlin-test-js".takeIf { !kotlinBuildProperties.isInJpsBuildIdeaSync },
":kotlin-test:kotlin-test-js-ir".takeIf { !kotlinBuildProperties.isInJpsBuildIdeaSync },
":kotlin-reflect",
":kotlin-coroutines-experimental-compat"
)
@@ -366,6 +369,15 @@ allprojects {
}
}
configurations.maybeCreate("embeddedElements").apply {
extendsFrom(configurations["embedded"])
isCanBeConsumed = true
isCanBeResolved = false
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named("embedded-java-runtime"))
}
}
jvmTarget = defaultJvmTarget
javaHome = defaultJavaHome
@@ -396,9 +408,6 @@ allprojects {
val commonCompilerArgs = listOfNotNull(
"-Xopt-in=kotlin.RequiresOptIn",
"-Xread-deserialized-contracts",
"-Xjvm-default=compatibility",
"-Xno-optimized-callable-references",
"-Xno-kotlin-nothing-value-exception",
"-progressive".takeIf { hasProperty("test.progressive.mode") }
)
@@ -410,9 +419,20 @@ allprojects {
}
}
val jvmCompilerArgs = listOf(
"-Xjvm-default=compatibility",
"-Xno-optimized-callable-references",
"-Xno-kotlin-nothing-value-exception",
"-Xnormalize-constructor-calls=enable"
)
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile> {
kotlinOptions {
freeCompilerArgs = commonCompilerArgs + listOf("-Xnormalize-constructor-calls=enable")
freeCompilerArgs = commonCompilerArgs + jvmCompilerArgs
if (useJvmIrBackend) {
useIR = true
}
}
}
@@ -437,11 +457,22 @@ allprojects {
outputs.doNotCacheIf("https://youtrack.jetbrains.com/issue/KT-37089") { true }
}
tasks.withType<SourceTask>().configureEach {
doFirst {
source.visit {
if (file.isDirectory && file.listFiles()?.isEmpty() == true) {
logger.warn("Empty source directories may cause build cache misses: " + file.absolutePath)
}
}
}
}
normalization {
runtimeClasspath {
ignore("META-INF/MANIFEST.MF")
ignore("META-INF/compiler.version")
ignore("META-INF/plugin.xml")
ignore("kotlin/KotlinVersionCurrentValue.class")
}
}
@@ -498,9 +529,12 @@ gradle.taskGraph.whenReady {
fun Boolean.toOnOff(): String = if (this) "on" else "off"
val profile = if (isTeamcityBuild) "CI" else "Local"
logger.warn("$profile build profile is active (proguard is ${kotlinBuildProperties.proguard.toOnOff()}" +
", jar compression is ${kotlinBuildProperties.jarCompression.toOnOff()})." +
" Use -Pteamcity=<true|false> to reproduce CI/local build")
val proguardMessage = "proguard is ${kotlinBuildProperties.proguard.toOnOff()}"
val jarCompressionMessage = "jar compression is ${kotlinBuildProperties.jarCompression.toOnOff()}"
val profileMessage = "$profile build profile is active ($proguardMessage, $jarCompressionMessage). " +
"Use -Pteamcity=<true|false> to reproduce CI/local build"
logger.warn("\n\n$profileMessage")
allTasks.filterIsInstance<org.gradle.jvm.tasks.Jar>().forEach { task ->
task.entryCompression = if (kotlinBuildProperties.jarCompression)
@@ -514,6 +548,10 @@ val dist = tasks.register("dist") {
dependsOn(":kotlin-compiler:dist")
}
val syncMutedTests = tasks.register("syncMutedTests") {
dependsOn(":compiler:tests-mutes:run")
}
val copyCompilerToIdeaPlugin by task<Copy> {
dependsOn(dist)
into(ideaPluginDir)
@@ -539,7 +577,7 @@ tasks {
}
}
listOf("clean", "assemble", "install", "dist").forEach { taskName ->
listOf("clean", "assemble", "install").forEach { taskName ->
register("coreLibs${taskName.capitalize()}") {
coreLibProjects.forEach { projectName -> dependsOn("$projectName:$taskName") }
}
@@ -548,6 +586,8 @@ tasks {
register("coreLibsTest") {
(coreLibProjects + listOf(
":kotlin-stdlib:samples",
":kotlin-stdlib-js-ir",
":kotlin-test:kotlin-test-js-ir".takeIf { !kotlinBuildProperties.isInJpsBuildIdeaSync },
":kotlin-test:kotlin-test-js:kotlin-test-js-it".takeIf { !kotlinBuildProperties.isInJpsBuildIdeaSync },
":kotlinx-metadata-jvm",
":tools:binary-compatibility-validator"
@@ -636,6 +676,7 @@ tasks {
dependsOn(":kotlin-scripting-jsr223-test:embeddableTest")
dependsOn(":kotlin-main-kts-test:test")
dependsOn(":kotlin-scripting-ide-services-test:test")
dependsOn(":kotlin-scripting-ide-services-test:embeddableTest")
dependsOn(":kotlin-scripting-js-test:test")
}
@@ -692,16 +733,9 @@ tasks {
dependsOn(":jps-plugin:test")
}
register("idea-plugin-main-tests") {
dependsOn("dist")
dependsOn(":idea:test")
}
register("idea-plugin-additional-tests") {
dependsOn("dist")
dependsOn(
":idea:idea-gradle:test",
":idea:idea-gradle-native:test",
":idea:idea-maven:test",
":j2k:test",
":nj2k:test",
@@ -724,17 +758,6 @@ tasks {
}
}
register("idea-plugin-tests") {
dependsOn("dist")
dependsOn(
"idea-plugin-main-tests",
"idea-plugin-additional-tests"
)
if (Ide.IJ()) {
dependsOn("idea-new-project-wizard-tests")
}
}
register("idea-plugin-performance-tests") {
dependsOn("dist")
dependsOn(
@@ -751,10 +774,21 @@ tasks {
)
}
register("plugins-tests") {
dependsOn("dist")
register("ideaPluginTest") {
dependsOn(
"mainIdeTests",
"gradleIdeTest",
"kaptIdeTest",
"miscIdeTests"
)
}
register("mainIdeTests") {
dependsOn(":idea:test")
}
register("miscIdeTests") {
dependsOn(
":kotlin-annotation-processing:test",
":kotlin-allopen-compiler-plugin:test",
":kotlin-noarg-compiler-plugin:test",
":kotlin-sam-with-receiver-compiler-plugin:test",
@@ -762,19 +796,58 @@ tasks {
":kotlin-annotation-processing-gradle:test",
":kotlinx-serialization-compiler-plugin:test",
":kotlinx-serialization-ide-plugin:test",
":idea:jvm-debugger:jvm-debugger-test:test"
":idea:jvm-debugger:jvm-debugger-test:test",
"idea-plugin-additional-tests",
"jps-tests",
":generators:test"
)
if (Ide.IJ()) {
dependsOn("idea-new-project-wizard-tests")
}
}
register("kaptIdeTest") {
dependsOn(":kotlin-annotation-processing:test")
}
register("gradleIdeTest") {
dependsOn(
":idea:idea-gradle:test",
":idea:idea-gradle-native:test"
)
}
register("ideaPluginTest") {
register("kmmTest", AggregateTest::class) {
dependsOn(
"idea-plugin-tests",
"jps-tests",
"plugins-tests",
"android-ide-tests",
":generators:test"
":idea:idea-gradle:test",
":idea:test",
":compiler:test",
":js:js.tests:test"
)
if (Ide.IJ193.orHigher())
dependsOn(":kotlin-gradle-plugin-integration-tests:test")
if (Ide.AS40.orHigher())
dependsOn(":kotlin-ultimate:ide:android-studio-native:test")
testPatternFile = file("tests/mpp/kmm-patterns.csv")
}
register("test") {
doLast {
throw GradleException("Don't use directly, use aggregate tasks *-check instead")
}
}
named("check") {
dependsOn("test")
}
named("checkBuild") {
if (kotlinBuildProperties.isTeamcityBuild) {
doFirst {
println("##teamcity[setParameter name='bootstrap.kotlin.version' value='$bootstrapKotlinVersion']")
}
}
}
register("publishIdeArtifacts") {
@@ -804,28 +877,12 @@ tasks {
":kotlin-stdlib-jdk7:publish",
":kotlin-stdlib-jdk8:publish",
":kotlin-reflect:publish",
":kotlin-main-kts:publish"
":kotlin-main-kts:publish",
":kotlin-stdlib-js:publish",
":kotlin-test:kotlin-test-js:publish"
)
}
}
register("test") {
doLast {
throw GradleException("Don't use directly, use aggregate tasks *-check instead")
}
}
named("check") {
dependsOn("test")
}
named("checkBuild") {
if (kotlinBuildProperties.isTeamcityBuild) {
doFirst {
println("##teamcity[setParameter name='bootstrap.kotlin.version' value='$bootstrapKotlinVersion']")
}
}
}
}
fun CopySpec.setExecutablePermissions() {
@@ -1058,4 +1115,4 @@ if (disableVerificationTasks) {
}
}
}
}
}

View File

@@ -22,7 +22,7 @@ buildscript {
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.17")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.19")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-sam-with-receiver:${project.bootstrapKotlinVersion}")
}
@@ -96,7 +96,8 @@ repositories {
dependencies {
implementation(kotlin("stdlib", embeddedKotlinVersion))
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.17")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.19")
implementation("com.gradle.publish:plugin-publish-plugin:0.11.0")
implementation("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")

View File

@@ -1,16 +1,15 @@
@file:Suppress("PropertyName", "HasPlatformType", "UnstableApiUsage")
import org.gradle.internal.os.OperatingSystem
import org.jetbrains.kotlin.gradle.tasks.internal.CleanableStore
import java.io.Closeable
import java.io.OutputStreamWriter
import java.net.URI
import java.text.SimpleDateFormat
import java.util.*
import javax.xml.stream.XMLOutputFactory
import org.jetbrains.kotlin.gradle.tasks.internal.CleanableStore
import java.time.Duration
import java.time.Instant
import java.util.*
import javax.xml.stream.XMLOutputFactory
plugins {
base
@@ -180,6 +179,7 @@ val mergeSources by tasks.creating(Jar::class.java) {
dependsOn(sources)
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
isZip64 = true
if (!kotlinBuildProperties.isTeamcityBuild) {
from(provider { sources.map(::zipTree) })
}

View File

@@ -20,7 +20,7 @@ buildscript {
}
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.17")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.19")
}
}

View File

@@ -0,0 +1,72 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
import org.gradle.api.GradleException
import org.gradle.api.tasks.*
import org.gradle.api.tasks.testing.Test
import java.io.File
// You can see "How To" via link: https://jetbrains.quip.com/xQ2WAUy9bZmy/How-to-use-AggregateTest-task
open class AggregateTest : Test() { // Inherit from Test to see test results in IDEA Test viewer
private var patterns: MutableMap<String, MutableList<String>> = mutableMapOf()
@InputFile
lateinit var testPatternFile: File
init {
// Set empty FileCollection to avoid NPE when initializing a base 'Test' class
classpath = project.objects.fileCollection()
testClassesDirs = project.objects.fileCollection()
project.gradle.taskGraph.whenReady {
if (allTasks.filterIsInstance<AggregateTest>().isNotEmpty()) {
initPatterns()
allTasks.filterIsInstance<Test>().forEach { testTask -> subTaskConfigure(testTask) }
if (!project.gradle.startParameter.taskNames.all { project.tasks.findByPath(it) is AggregateTest }) {
logger.warn("Please, don't use AggregateTest and non-AggregateTest test tasks together. You can get incorrect results.")
}
}
}
}
private fun initPatterns() {
if (!testPatternFile.exists())
throw GradleException("File with test patterns is not found")
testPatternFile
.readLines()
.asSequence()
.filter { it.isNotEmpty() }
.forEach { line ->
// patternType is exclude or include value
val (pattern, patternType) = line.split(',').map { it.trim() }
patterns.getOrPut(patternType) { mutableListOf() }.add(pattern)
}
}
private fun subTaskConfigure(testTask: Test) {
testTask.outputs.upToDateWhen { false }
testTask.ignoreFailures = true
testTask.filter {
isFailOnNoMatchingTests = false
patterns["include"]?.let {
it.forEach { pattern ->
includeTestsMatching(pattern)
}
}
patterns["exclude"]?.let {
it.forEach { pattern ->
excludeTestsMatching(pattern)
}
}
}
}
@Override
@TaskAction
override fun executeTests() {
// Do nothing
}
}

View File

@@ -56,7 +56,7 @@ var Project.javaHome: String?
fun Project.generator(fqName: String, sourceSet: SourceSet? = null) = smartJavaExec {
classpath = (sourceSet ?: testSourceSet).runtimeClasspath
main = fqName
mainClass.set(fqName)
workingDir = rootDir
systemProperty("line.separator", "\n")
}

View File

@@ -26,7 +26,7 @@ fun CompatibilityPredicate.or(other: CompatibilityPredicate): CompatibilityPredi
}
enum class Platform : CompatibilityPredicate {
P183, P191, P192, P193, P201, P202;
P183, P191, P192, P193, P201, P202, P203;
val version: Int = name.drop(1).toInt()
@@ -48,11 +48,13 @@ enum class Ide(val platform: Platform) : CompatibilityPredicate {
IJ193(Platform.P193),
IJ201(Platform.P201),
IJ202(Platform.P202),
IJ203(Platform.P203),
AS35(Platform.P183),
AS36(Platform.P192),
AS40(Platform.P193),
AS41(Platform.P201);
AS41(Platform.P201),
AS42(Platform.P201);
val kind = Kind.values().first { it.shortName == name.take(2) }
val version = name.dropWhile { !it.isDigit() }.toInt()

View File

@@ -23,6 +23,10 @@ fun JavaExec.passClasspathInJar() {
dependsOn(classpath)
inputs.files(classpath)
inputs.property("main", main)
archiveFileName.set("$main.${this@passClasspathInJar.name}.classpath.container.jar")
destinationDirectory.set(temporaryDir)
doFirst {
val classPathString = classpath.joinToString(" ") { project.file(it).toURI().toString() }
manifest {
@@ -34,16 +38,11 @@ fun JavaExec.passClasspathInJar() {
)
}
}
archiveName = "$main.${this@passClasspathInJar.name}.classpath.container.$extension"
destinationDir = temporaryDir
}
dependsOn(jarTask)
doFirst {
main = "-jar"
classpath = project.files()
args = listOf(jarTask.outputs.files.singleFile.path) + args.orEmpty()
}
main = "-jar"
classpath = project.files()
args = listOf(jarTask.outputs.files.singleFile.path) + args.orEmpty()
}

View File

@@ -27,6 +27,7 @@ import org.gradle.api.tasks.javadoc.Javadoc
import org.gradle.jvm.tasks.Jar
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.kotlin.dsl.*
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetContainer
import plugins.KotlinBuildPublishingPlugin
@@ -129,10 +130,16 @@ fun Project.sourcesJar(body: Jar.() -> Unit = {}): TaskProvider<Jar> {
}
val sourcesJar = getOrCreateTask<Jar>("sourcesJar") {
fun Project.mainJavaPluginSourceSet() = findJavaPluginConvention()?.sourceSets?.findByName("main")
fun Project.mainKotlinSourceSet() =
(extensions.findByName("kotlin") as? KotlinSourceSetContainer)?.sourceSets?.findByName("main")
fun Project.sources() = mainJavaPluginSourceSet()?.allSource ?: mainKotlinSourceSet()?.kotlin
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveClassifier.set("sources")
from(project.mainSourceSet.allSource)
from(project.sources())
project.configurations.findByName("embedded")?.let { embedded ->
from(provider {
@@ -141,10 +148,7 @@ fun Project.sourcesJar(body: Jar.() -> Unit = {}): TaskProvider<Jar> {
.map { it.id.componentIdentifier }
.filterIsInstance<ProjectComponentIdentifier>()
.mapNotNull {
project(it.projectPath)
.findJavaPluginConvention()
?.mainSourceSet
?.allSource
project(it.projectPath).sources()
}
})
}

View File

@@ -1,3 +1,8 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:Suppress("unused")
// usages in build scripts are not tracked properly
@@ -97,9 +102,11 @@ fun Project.kotlinStdlib(suffix: String? = null, classifier: String? = null): An
dependencies.project(listOfNotNull(":kotlin-stdlib", suffix).joinToString("-"), classifier)
}
fun Project.kotlinBuiltins(): Any =
fun Project.kotlinBuiltins(): Any = kotlinBuiltins(forJvm = false)
fun Project.kotlinBuiltins(forJvm: Boolean): Any =
if (kotlinBuildProperties.useBootstrapStdlib) "org.jetbrains.kotlin:builtins:$bootstrapKotlinVersion"
else dependencies.project(":core:builtins")
else dependencies.project(":core:builtins", configuration = "runtimeElementsJvm".takeIf { forJvm })
fun DependencyHandler.projectTests(name: String): ProjectDependency = project(name, configuration = "tests-jar")
fun DependencyHandler.projectRuntimeJar(name: String): ProjectDependency = project(name, configuration = "runtimeJar")

View File

@@ -165,7 +165,7 @@ fun Project.runIdeTask(name: String, ideaPluginDir: File, ideaSandboxDir: File,
classpath = mainSourceSet.runtimeClasspath
main = "com.intellij.idea.Main"
mainClass.set("com.intellij.idea.Main")
workingDir = File(intellijRootDir(), "bin")
@@ -184,7 +184,7 @@ fun Project.runIdeTask(name: String, ideaPluginDir: File, ideaSandboxDir: File,
"-Dplugin.path=${ideaPluginDir.absolutePath}"
)
if (Platform[201].orHigher()) {
if (Platform[201].orHigher() && !isIntellijUltimateSdkAvailable()) {
jvmArgs("-Didea.platform.prefix=Idea")
}

View File

@@ -9,12 +9,16 @@ import org.gradle.api.Project
import org.gradle.api.publish.PublicationContainer
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
import org.gradle.api.tasks.bundling.Jar
import org.gradle.kotlin.dsl.*
import plugins.KotlinBuildPublishingPlugin
import plugins.configureRepository
import java.util.*
internal const val PLUGIN_MARKER_SUFFIX = ".gradle.plugin"
@UseExperimental(ExperimentalStdlibApi::class)
fun Project.publishPluginMarkers(withEmptyJars: Boolean = true) {
val pluginDevelopment = extensions.getByType<PluginBundleExtension>()
val publishingExtension = extensions.getByType<PublishingExtension>()
@@ -25,6 +29,10 @@ fun Project.publishPluginMarkers(withEmptyJars: Boolean = true) {
if (withEmptyJars) {
addEmptyJarArtifacts(markerPublication)
}
tasks.named<PublishToMavenRepository>(
"publish${markerPublication.name.capitalize(Locale.ROOT)}PublicationTo${KotlinBuildPublishingPlugin.REPOSITORY_NAME}Repository"
).configureRepository()
}
}

View File

@@ -15,9 +15,11 @@ import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
import org.gradle.api.tasks.TaskProvider
import org.gradle.kotlin.dsl.*
import org.gradle.plugins.signing.SigningExtension
import org.gradle.plugins.signing.SigningPlugin
import java.net.URI
import java.util.*
import javax.inject.Inject
@@ -119,25 +121,8 @@ class KotlinBuildPublishingPlugin @Inject constructor(
dependsOn(tasks.named("publishToMavenLocal"))
}
tasks.named<PublishToMavenRepository>("publish${PUBLICATION_NAME}PublicationTo${REPOSITORY_NAME}Repository") {
dependsOn(project.rootProject.tasks.named("preparePublication"))
doFirst {
val preparePublication = project.rootProject.tasks.named("preparePublication").get()
val username: String? by preparePublication.extra
val password: String? by preparePublication.extra
val repoUrl: String by preparePublication.extra
repository.apply {
url = uri(repoUrl)
if (url.scheme != "file" && username != null && password != null) {
credentials {
this.username = username
this.password = password
}
}
}
}
}
tasks.named<PublishToMavenRepository>("publish${PUBLICATION_NAME}PublicationTo${REPOSITORY_NAME}Repository")
.configureRepository()
}
companion object {
@@ -152,4 +137,24 @@ class KotlinBuildPublishingPlugin @Inject constructor(
fun humanReadableName(project: Project) =
project.name.split("-").joinToString(separator = " ") { it.capitalize(Locale.ROOT) }
}
}
fun TaskProvider<PublishToMavenRepository>.configureRepository() = configure {
dependsOn(project.rootProject.tasks.named("preparePublication"))
doFirst {
val preparePublication = project.rootProject.tasks.named("preparePublication").get()
val username: String? by preparePublication.extra
val password: String? by preparePublication.extra
val repoUrl: String by preparePublication.extra
repository.apply {
url = project.uri(repoUrl)
if (url.scheme != "file" && username != null && password != null) {
credentials {
this.username = username
this.password = password
}
}
}
}
}

View File

@@ -52,6 +52,7 @@ open class PublishedKotlinModule : Plugin<Project> {
configure<SigningExtension> {
isRequired = signingRequired
sign(configurations["archives"])
useGpgCmd()
}
tasks.named<Sign>("signArchives").configure {

View File

@@ -31,6 +31,46 @@ import java.lang.Character.isUpperCase
import java.nio.file.Files
import java.nio.file.Path
fun Task.dependsOnKotlinPluginInstall() {
dependsOn(
":kotlin-allopen:install",
":kotlin-noarg:install",
":kotlin-sam-with-receiver:install",
":kotlin-android-extensions:install",
":kotlin-build-common:install",
":kotlin-compiler-embeddable:install",
":native:kotlin-native-utils:install",
":kotlin-util-klib:install",
":kotlin-util-io:install",
":kotlin-compiler-runner:install",
":kotlin-daemon-embeddable:install",
":kotlin-daemon-client:install",
":kotlin-gradle-plugin-api:install",
":kotlin-gradle-plugin:install",
":kotlin-gradle-plugin-model:install",
":kotlin-reflect:install",
":kotlin-annotation-processing-gradle:install",
":kotlin-test:kotlin-test-common:install",
":kotlin-test:kotlin-test-annotations-common:install",
":kotlin-test:kotlin-test-jvm:install",
":kotlin-test:kotlin-test-js:install",
":kotlin-test:kotlin-test-junit:install",
":kotlin-gradle-subplugin-example:install",
":kotlin-stdlib-common:install",
":kotlin-stdlib:install",
":kotlin-stdlib-jdk8:install",
":kotlin-stdlib-js:install",
":examples:annotation-processor-example:install",
":kotlin-script-runtime:install",
":kotlin-scripting-common:install",
":kotlin-scripting-jvm:install",
":kotlin-scripting-compiler-embeddable:install",
":kotlin-scripting-compiler-impl-embeddable:install",
":kotlin-test-js-runner:install",
":native:kotlin-klib-commonizer-embeddable:install"
)
}
fun Project.projectTest(
taskName: String = "test",
parallel: Boolean = false,

View File

@@ -25,7 +25,7 @@ import org.junit.runners.AllTests;
import java.io.File;
@RunWith(AllTests.class)
//@RunWith(AllTests.class)
public class AndroidRunner {
private static PathManager pathManager;

View File

@@ -294,7 +294,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
val kind = KotlinBaseTest.extractConfigurationKind(testFiles)
val jdkKind = KotlinBaseTest.getTestJdkKind(testFiles)
val keyConfiguration = CompilerConfiguration()
CodegenTestCase.updateConfigurationByDirectivesInTestFiles(testFiles, keyConfiguration)
KotlinBaseTest.updateConfigurationByDirectivesInTestFiles(testFiles, keyConfiguration)
val key = ConfigurationKey(kind, jdkKind, keyConfiguration.toString())
val compiler = if (isJvm8Target) {
@@ -303,7 +303,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
val filesHolder = holders.getOrPut(key) {
FilesWriter(compiler, KotlinTestUtils.newConfiguration(kind, jdkKind, KotlinTestUtils.getAnnotationsJar()).apply {
println("Creating new configuration by $key")
CodegenTestCase.updateConfigurationByDirectivesInTestFiles(testFiles, this)
KotlinBaseTest.updateConfigurationByDirectivesInTestFiles(testFiles, this)
})
}

View File

@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.backend.common
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.backend.common.bridges.findInterfaceImplementation
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
import org.jetbrains.kotlin.diagnostics.Errors
@@ -24,6 +23,7 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
import org.jetbrains.kotlin.resolve.multiplatform.ExpectedActualResolver
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.util.getExceptionMessage
import org.jetbrains.kotlin.util.getNonPrivateTraitMembersForDelegation
import org.jetbrains.kotlin.utils.DFS
import org.jetbrains.kotlin.utils.KotlinExceptionWithAttachments
@@ -55,14 +55,8 @@ object CodegenUtil {
@JvmOverloads
fun getNonPrivateTraitMethods(descriptor: ClassDescriptor, copy: Boolean = true): Map<FunctionDescriptor, FunctionDescriptor> {
val result = linkedMapOf<FunctionDescriptor, FunctionDescriptor>()
for (declaration in DescriptorUtils.getAllDescriptors(descriptor.defaultType.memberScope)) {
if (declaration !is CallableMemberDescriptor) continue
val traitMember = findInterfaceImplementation(declaration)
if (traitMember == null ||
Visibilities.isPrivate(traitMember.visibility) ||
traitMember.visibility == Visibilities.INVISIBLE_FAKE) continue
for ((declaration, traitMember) in getNonPrivateTraitMembersForDelegation(descriptor)) {
assert(traitMember.modality !== Modality.ABSTRACT) { "Cannot delegate to abstract trait method: $declaration" }
// inheritedMember can be abstract here. In order for FunctionCodegen to generate the method body, we're creating a copy here

View File

@@ -24,6 +24,8 @@ import org.jetbrains.kotlin.resolve.OverridingUtil
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.isOrOverridesSynthesized
import org.jetbrains.kotlin.resolve.descriptorUtil.isTypeRefinementEnabled
import org.jetbrains.kotlin.resolve.descriptorUtil.module
import org.jetbrains.kotlin.util.findImplementationFromInterface
import org.jetbrains.kotlin.util.findInterfaceImplementation
fun <Signature> generateBridgesForFunctionDescriptor(
descriptor: FunctionDescriptor,
@@ -81,60 +83,4 @@ open class DescriptorBasedFunctionHandle(val descriptor: FunctionDescriptor) : F
override fun toString(): String {
return descriptor.toString()
}
}
/**
* Given a fake override in a class, returns an overridden declaration with implementation in trait, such that a method delegating to that
* trait implementation should be generated into the class containing the fake override; or null if the given function is not a fake
* override of any trait implementation or such method was already generated into the superclass or is a method from Any.
*/
fun findInterfaceImplementation(descriptor: CallableMemberDescriptor): CallableMemberDescriptor? {
if (descriptor.kind.isReal) return null
if (isOrOverridesSynthesized(descriptor)) return null
val implementation = findImplementationFromInterface(descriptor) ?: return null
val immediateConcreteSuper = firstSuperMethodFromKotlin(descriptor, implementation) ?: return null
if (!DescriptorUtils.isInterface(immediateConcreteSuper.containingDeclaration)) {
// If this implementation is already generated into the superclass, we need not generate it again, it'll be inherited
return null
}
return immediateConcreteSuper
}
/**
* Given a fake override, returns an overridden non-abstract function from an interface which is the actual implementation of this function
* that should be called when the given fake override is called.
*/
fun findImplementationFromInterface(descriptor: CallableMemberDescriptor): CallableMemberDescriptor? {
val overridden = OverridingUtil.getOverriddenDeclarations(descriptor)
val filtered = OverridingUtil.filterOutOverridden(overridden)
val result = filtered.firstOrNull { it.modality != Modality.ABSTRACT } ?: return null
if (DescriptorUtils.isClassOrEnumClass(result.containingDeclaration)) return null
return result
}
/**
* Given a fake override and its implementation (non-abstract declaration) somewhere in supertypes,
* returns the first immediate super function of the given fake override which overrides that implementation.
* The returned function should be called from TImpl-bridges generated for the given fake override.
*/
fun firstSuperMethodFromKotlin(
descriptor: CallableMemberDescriptor,
implementation: CallableMemberDescriptor
): CallableMemberDescriptor? {
return descriptor.overriddenDescriptors.firstOrNull { overridden ->
overridden.modality != Modality.ABSTRACT &&
(overridden == implementation || OverridingUtil.overrides(
overridden,
implementation,
overridden.module.isTypeRefinementEnabled(),
true
))
}
}
}

View File

@@ -90,12 +90,18 @@ public abstract class AnnotationCodegen {
private final KotlinTypeMapper typeMapper;
private final ModuleDescriptor module;
private final GenerationState state;
private final boolean skipNullabilityAnnotations;
private AnnotationCodegen(@NotNull InnerClassConsumer innerClassConsumer, @NotNull GenerationState state) {
this(innerClassConsumer, state, false);
}
private AnnotationCodegen(@NotNull InnerClassConsumer innerClassConsumer, @NotNull GenerationState state, boolean skipNullabilityAnnotations) {
this.innerClassConsumer = innerClassConsumer;
this.typeMapper = state.getTypeMapper();
this.module = state.getModule();
this.state = state;
this.skipNullabilityAnnotations = skipNullabilityAnnotations;
}
/**
@@ -105,6 +111,16 @@ public abstract class AnnotationCodegen {
@Nullable Annotated annotated,
@Nullable Type returnType,
@Nullable KotlinType typeForTypeAnnotations
) {
genAnnotations(annotated, returnType, typeForTypeAnnotations, null, Collections.emptyList());
}
public void genAnnotations(
@Nullable Annotated annotated,
@Nullable Type returnType,
@Nullable KotlinType typeForTypeAnnotations,
@Nullable DeclarationDescriptorWithVisibility parameterContainer,
@NotNull List<String> additionalVisibleAnnotations
) {
if (annotated == null) return;
@@ -139,22 +155,28 @@ public abstract class AnnotationCodegen {
}
}
generateAdditionalAnnotations(annotated, returnType, annotationDescriptorsAlreadyPresent);
for (String annotation : additionalVisibleAnnotations) {
generateAnnotationIfNotPresent(annotationDescriptorsAlreadyPresent, annotation, true);
annotationDescriptorsAlreadyPresent.add(annotation);
}
generateAdditionalAnnotations(annotated, returnType, annotationDescriptorsAlreadyPresent, parameterContainer);
generateTypeAnnotations(annotated, typeForTypeAnnotations);
}
private void generateAdditionalAnnotations(
@NotNull Annotated annotated,
@Nullable Type returnType,
@NotNull Set<String> annotationDescriptorsAlreadyPresent
@NotNull Set<String> annotationDescriptorsAlreadyPresent,
@Nullable DeclarationDescriptorWithVisibility parameterContainer
) {
if (annotated instanceof CallableDescriptor) {
generateAdditionalCallableAnnotations((CallableDescriptor) annotated, returnType, annotationDescriptorsAlreadyPresent);
generateAdditionalCallableAnnotations((CallableDescriptor) annotated, returnType, annotationDescriptorsAlreadyPresent, parameterContainer);
}
else if (annotated instanceof FieldDescriptor) {
generateAdditionalCallableAnnotations(
((FieldDescriptor) annotated).getCorrespondingProperty(), returnType, annotationDescriptorsAlreadyPresent
);
((FieldDescriptor) annotated).getCorrespondingProperty(), returnType, annotationDescriptorsAlreadyPresent,
parameterContainer);
}
else if (annotated instanceof ClassDescriptor) {
generateAdditionalClassAnnotations(annotationDescriptorsAlreadyPresent, (ClassDescriptor) annotated);
@@ -164,11 +186,15 @@ public abstract class AnnotationCodegen {
private void generateAdditionalCallableAnnotations(
@NotNull CallableDescriptor descriptor,
@Nullable Type returnType,
@NotNull Set<String> annotationDescriptorsAlreadyPresent
@NotNull Set<String> annotationDescriptorsAlreadyPresent,
@Nullable DeclarationDescriptorWithVisibility parameterContainer
) {
// No need to annotate privates, synthetic accessors and their parameters
if (isInvisibleFromTheOutside(descriptor)) return;
if (descriptor instanceof ValueParameterDescriptor && isInvisibleFromTheOutside(descriptor.getContainingDeclaration())) return;
if (descriptor instanceof ParameterDescriptor &&
isInvisibleFromTheOutside(parameterContainer != null ? parameterContainer : descriptor.getContainingDeclaration())) {
return;
}
// No need to annotate annotation methods since they're always non-null
if (descriptor instanceof PropertyGetterDescriptor &&
@@ -176,7 +202,7 @@ public abstract class AnnotationCodegen {
return;
}
if (returnType != null && !AsmUtil.isPrimitive(returnType)) {
if (returnType != null && !AsmUtil.isPrimitive(returnType) && !skipNullabilityAnnotations) {
generateNullabilityAnnotation(descriptor.getReturnType(), annotationDescriptorsAlreadyPresent);
}
}
@@ -222,17 +248,17 @@ public abstract class AnnotationCodegen {
if (!TypeUtils.isNullableType(flexibleType.getLowerBound()) && TypeUtils.isNullableType(flexibleType.getUpperBound())) {
AnnotationDescriptor notNull = type.getAnnotations().findAnnotation(JvmAnnotationNames.JETBRAINS_NOT_NULL_ANNOTATION);
if (notNull != null) {
generateAnnotationIfNotPresent(annotationDescriptorsAlreadyPresent, NotNull.class);
generateAnnotationIfNotPresent(annotationDescriptorsAlreadyPresent, Type.getType(NotNull.class).getDescriptor(), false);
}
return;
}
}
boolean isNullableType = TypeUtils.isNullableType(type);
Class<?> annotationClass = isNullableType ? Nullable.class : NotNull.class;
generateAnnotationIfNotPresent(annotationDescriptorsAlreadyPresent, annotationClass);
generateAnnotationIfNotPresent(
annotationDescriptorsAlreadyPresent,
TypeUtils.isNullableType(type) ? Type.getType(Nullable.class).getDescriptor() : Type.getType(NotNull.class).getDescriptor(),
false
);
}
private static final Map<JvmTarget, Map<KotlinTarget, ElementType>> annotationTargetMaps = new EnumMap<>(JvmTarget.class);
@@ -312,10 +338,13 @@ public abstract class AnnotationCodegen {
visitor.visitEnd();
}
private void generateAnnotationIfNotPresent(Set<String> annotationDescriptorsAlreadyPresent, Class<?> annotationClass) {
String descriptor = Type.getType(annotationClass).getDescriptor();
if (!annotationDescriptorsAlreadyPresent.contains(descriptor)) {
visitAnnotation(descriptor, false).visitEnd();
private void generateAnnotationIfNotPresent(
Set<String> annotationDescriptorsAlreadyPresent,
String annotationDescriptor,
boolean visible
) {
if (!annotationDescriptorsAlreadyPresent.contains(annotationDescriptor)) {
visitAnnotation(annotationDescriptor, visible).visitEnd();
}
}
@@ -600,7 +629,16 @@ public abstract class AnnotationCodegen {
@NotNull InnerClassConsumer innerClassConsumer,
@NotNull GenerationState state
) {
return new AnnotationCodegen(innerClassConsumer, state) {
return forMethod(mv, innerClassConsumer, state, false);
}
public static AnnotationCodegen forMethod(
@NotNull MethodVisitor mv,
@NotNull InnerClassConsumer innerClassConsumer,
@NotNull GenerationState state,
boolean skipNullabilityAnnotations
) {
return new AnnotationCodegen(innerClassConsumer, state, skipNullabilityAnnotations) {
@NotNull
@Override
AnnotationVisitor visitAnnotation(String descr, boolean visible) {
@@ -620,7 +658,16 @@ public abstract class AnnotationCodegen {
@NotNull InnerClassConsumer innerClassConsumer,
@NotNull GenerationState state
) {
return new AnnotationCodegen(innerClassConsumer, state) {
return forField(fv, innerClassConsumer, state, false);
}
public static AnnotationCodegen forField(
@NotNull FieldVisitor fv,
@NotNull InnerClassConsumer innerClassConsumer,
@NotNull GenerationState state,
boolean skipNullabilityAnnotations
) {
return new AnnotationCodegen(innerClassConsumer, state, skipNullabilityAnnotations) {
@NotNull
@Override
AnnotationVisitor visitAnnotation(String descr, boolean visible) {
@@ -639,9 +686,10 @@ public abstract class AnnotationCodegen {
int parameter,
@NotNull MethodVisitor mv,
@NotNull InnerClassConsumer innerClassConsumer,
@NotNull GenerationState state
@NotNull GenerationState state,
boolean skipNullabilityAnnotations
) {
return new AnnotationCodegen(innerClassConsumer, state) {
return new AnnotationCodegen(innerClassConsumer, state, skipNullabilityAnnotations) {
@NotNull
@Override
AnnotationVisitor visitAnnotation(String descr, boolean visible) {

View File

@@ -10,7 +10,6 @@ import kotlin.collections.CollectionsKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.backend.common.CodegenUtil;
import org.jetbrains.kotlin.backend.common.bridges.ImplKt;
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
import org.jetbrains.kotlin.codegen.context.ClassContext;
import org.jetbrains.kotlin.codegen.state.GenerationState;
@@ -39,6 +38,8 @@ import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.enumEntryNeedS
import static org.jetbrains.kotlin.resolve.DescriptorToSourceUtils.descriptorToDeclaration;
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.OBJECT_TYPE;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKind.CLASS_MEMBER_DELEGATION_TO_DEFAULT_IMPL;
import static org.jetbrains.kotlin.util.DeclarationUtilKt.findImplementationFromInterface;
import static org.jetbrains.kotlin.util.DeclarationUtilKt.findInterfaceImplementation;
public abstract class ClassBodyCodegen extends MemberCodegen<KtPureClassOrObject> {
@NotNull
@@ -125,7 +126,7 @@ public abstract class ClassBodyCodegen extends MemberCodegen<KtPureClassOrObject
for (DeclarationDescriptor memberDescriptor : DescriptorUtils.getAllDescriptors(descriptor.getDefaultType().getMemberScope())) {
if (memberDescriptor instanceof CallableMemberDescriptor) {
CallableMemberDescriptor member = (CallableMemberDescriptor) memberDescriptor;
if (!member.getKind().isReal() && ImplKt.findInterfaceImplementation(member) == null) {
if (!member.getKind().isReal() && findInterfaceImplementation(member) == null) {
if (member instanceof FunctionDescriptor) {
functionCodegen.generateBridges((FunctionDescriptor) member);
}
@@ -236,12 +237,12 @@ public abstract class ClassBodyCodegen extends MemberCodegen<KtPureClassOrObject
@NotNull GenerationState state,
boolean isErasedInlineClass
) {
CallableMemberDescriptor actualImplementation =
interfaceFun.getKind().isReal() ? interfaceFun : findImplementationFromInterface(interfaceFun);
assert actualImplementation != null : "Can't find actual implementation for " + interfaceFun;
// Skip Java 8 default methods
if (CodegenUtilKt.isDefinitelyNotDefaultImplsMethod(interfaceFun) ||
JvmAnnotationUtilKt.isCallableMemberCompiledToJvmDefault(
DescriptorUtils.unwrapFakeOverrideToAnyDeclaration(interfaceFun), state.getJvmDefaultMode()
)
) {
if (CodegenUtilKt.isDefinitelyNotDefaultImplsMethod(actualImplementation) ||
JvmAnnotationUtilKt.isCallableMemberCompiledToJvmDefault(actualImplementation, state.getJvmDefaultMode())) {
return;
}

View File

@@ -153,18 +153,18 @@ class DefaultParameterValueSubstitutor(val state: GenerationState) {
signature.genericsSignature,
FunctionCodegen.getThrownExceptions(functionDescriptor, typeMapper)
)
val skipNullabilityAnnotations = flags and Opcodes.ACC_PRIVATE != 0 || flags and Opcodes.ACC_SYNTHETIC != 0
AnnotationCodegen.forMethod(mv, memberCodegen, state).genAnnotations(
functionDescriptor,
signature.returnType,
functionDescriptor.returnType
)
AnnotationCodegen.forMethod(mv, memberCodegen, state, skipNullabilityAnnotations)
.genAnnotations(functionDescriptor, signature.returnType, functionDescriptor.returnType)
if (state.classBuilderMode == ClassBuilderMode.KAPT3) {
mv.visitAnnotation(ANNOTATION_TYPE_DESCRIPTOR_FOR_JVM_OVERLOADS_GENERATED_METHODS, false)
}
FunctionCodegen.generateParameterAnnotations(functionDescriptor, mv, signature, remainingParameters, memberCodegen, state)
FunctionCodegen.generateParameterAnnotations(
functionDescriptor, mv, signature, remainingParameters, memberCodegen, state, skipNullabilityAnnotations
)
if (!state.classBuilderMode.generateBodies) {
FunctionCodegen.generateLocalVariablesForParameters(

View File

@@ -173,7 +173,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
return null;
}
static class BlockStackElement {
public static class BlockStackElement {
}
static class LoopBlockStackElement extends BlockStackElement {
@@ -2224,8 +2224,9 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
if (!skipPropertyAccessors) {
if (isBackingFieldMovedFromCompanion && context.getContextDescriptor() instanceof AccessorForPropertyBackingField) {
propertyDescriptor = (PropertyDescriptor) backingFieldContext.getParentContext()
.getAccessor(propertyDescriptor, AccessorKind.IN_CLASS_COMPANION, delegateType, superCallTarget);
CodegenContext<?> parentContext = backingFieldContext.getParentContext();
propertyDescriptor =
parentContext.getAccessor(propertyDescriptor, AccessorKind.IN_CLASS_COMPANION, delegateType, superCallTarget);
}
else {
propertyDescriptor =
@@ -2835,7 +2836,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
TypeApproximator approximator = new TypeApproximator(state.getModule().getBuiltIns());
KotlinType approximatedType =
CapturedTypeConstructorKt.isCaptured(type) ?
TypeUtils.contains(type, (containedType) -> CapturedTypeConstructorKt.isCaptured(containedType)) ?
(KotlinType) approximator.approximateToSuperType(
type, TypeApproximatorConfiguration.InternalTypesApproximation.INSTANCE
) : null;

View File

@@ -33,10 +33,7 @@ import org.jetbrains.kotlin.load.java.JvmAbi;
import org.jetbrains.kotlin.load.java.SpecialBuiltinMembers;
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.InlineClassesUtilsKt;
import org.jetbrains.kotlin.resolve.*;
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
import org.jetbrains.kotlin.resolve.calls.util.UnderscoreUtilKt;
import org.jetbrains.kotlin.resolve.constants.ArrayValue;
@@ -76,7 +73,7 @@ import static org.jetbrains.kotlin.codegen.serialization.JvmSerializationBinding
import static org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.isAccessor;
import static org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.DECLARATION;
import static org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.DELEGATION;
import static org.jetbrains.kotlin.descriptors.ModalityKt.isOverridable;
import static org.jetbrains.kotlin.descriptors.ModalityUtilsKt.isOverridable;
import static org.jetbrains.kotlin.resolve.DescriptorToSourceUtils.getSourceFromDescriptor;
import static org.jetbrains.kotlin.resolve.DescriptorUtils.*;
import static org.jetbrains.kotlin.resolve.inline.InlineOnlyKt.isInlineOnlyPrivateInBytecode;
@@ -86,6 +83,8 @@ import static org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils.*;
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
public class FunctionCodegen {
private static final String JAVA_LANG_DEPRECATED = Type.getType(Deprecated.class).getDescriptor();
public final GenerationState state;
private final KotlinTypeMapper typeMapper;
private final BindingContext bindingContext;
@@ -193,6 +192,10 @@ public class FunctionCodegen {
if (origin.getOriginKind() == JvmDeclarationOriginKind.SAM_DELEGATION) {
flags |= ACC_SYNTHETIC;
}
boolean isCompatibilityStubInDefaultImpls = isCompatibilityStubInDefaultImpls(functionDescriptor, methodContext, state.getJvmDefaultMode());
if (isCompatibilityStubInDefaultImpls) {
flags |= ACC_DEPRECATED;
}
if (functionDescriptor.isExternal() && owner instanceof MultifileClassFacadeContext) {
// Native methods are only defined in facades and do not need package part implementations
@@ -201,12 +204,13 @@ public class FunctionCodegen {
MethodVisitor mv =
strategy.wrapMethodVisitor(
newMethod(origin,
flags,
asmMethod.getName(),
asmMethod.getDescriptor(),
strategy.skipGenericSignature() ? null : jvmSignature.getGenericsSignature(),
getThrownExceptions(functionDescriptor, typeMapper)
newMethod(
origin,
flags,
asmMethod.getName(),
asmMethod.getDescriptor(),
strategy.skipGenericSignature() ? null : jvmSignature.getGenericsSignature(),
getThrownExceptions(functionDescriptor, typeMapper)
),
flags, asmMethod.getName(),
asmMethod.getDescriptor()
@@ -214,8 +218,14 @@ public class FunctionCodegen {
recordMethodForFunctionIfAppropriate(functionDescriptor, asmMethod);
generateMethodAnnotationsIfRequired(functionDescriptor, asmMethod, jvmSignature, mv);
boolean skipNullabilityAnnotations =
(flags & ACC_PRIVATE) != 0 || (flags & ACC_SYNTHETIC) != 0 ||
InlineClassDescriptorResolver.isSpecializedEqualsMethod(functionDescriptor);
generateMethodAnnotationsIfRequired(
functionDescriptor, asmMethod, jvmSignature, mv,
isCompatibilityStubInDefaultImpls ? Collections.singletonList(JAVA_LANG_DEPRECATED) : Collections.emptyList(),
skipNullabilityAnnotations
);
GenerateJava8ParameterNamesKt.generateParameterNames(functionDescriptor, mv, jvmSignature, state, (flags & ACC_SYNTHETIC) != 0);
if (contextKind != OwnerKind.ERASED_INLINE_CLASS) {
@@ -276,7 +286,9 @@ public class FunctionCodegen {
@NotNull FunctionDescriptor functionDescriptor,
@NotNull Method asmMethod,
@NotNull JvmMethodGenericSignature jvmSignature,
@NotNull MethodVisitor mv
@NotNull MethodVisitor mv,
@NotNull List<String> additionalVisibleAnnotations,
boolean skipNullabilityAnnotations
) {
FunctionDescriptor annotationsOwner;
if (shouldHideConstructorDueToInlineClassTypeValueParameters(functionDescriptor)) {
@@ -291,10 +303,14 @@ public class FunctionCodegen {
annotationsOwner = functionDescriptor;
}
AnnotationCodegen.forMethod(mv, memberCodegen, state)
.genAnnotations(annotationsOwner, asmMethod.getReturnType(), functionDescriptor.getReturnType());
AnnotationCodegen.forMethod(mv, memberCodegen, state, skipNullabilityAnnotations)
.genAnnotations(annotationsOwner, asmMethod.getReturnType(), functionDescriptor.getReturnType(), null, additionalVisibleAnnotations);
generateParameterAnnotations(annotationsOwner, mv, jvmSignature, memberCodegen, state);
generateParameterAnnotations(
annotationsOwner, mv, jvmSignature,
annotationsOwner.getValueParameters(),
memberCodegen, state, skipNullabilityAnnotations
);
}
@NotNull
@@ -488,25 +504,14 @@ public class FunctionCodegen {
return descriptor != null && !InlineUtil.isInlineOrContainingInline(descriptor);
}
public static void generateParameterAnnotations(
@NotNull FunctionDescriptor functionDescriptor,
@NotNull MethodVisitor mv,
@NotNull JvmMethodSignature jvmSignature,
@NotNull InnerClassConsumer innerClassConsumer,
@NotNull GenerationState state
) {
generateParameterAnnotations(
functionDescriptor, mv, jvmSignature, functionDescriptor.getValueParameters(), innerClassConsumer, state
);
}
public static void generateParameterAnnotations(
@NotNull FunctionDescriptor functionDescriptor,
@NotNull MethodVisitor mv,
@NotNull JvmMethodSignature jvmSignature,
@NotNull List<ValueParameterDescriptor> valueParameters,
@NotNull InnerClassConsumer innerClassConsumer,
@NotNull GenerationState state
@NotNull MemberCodegen<?> memberCodegen,
@NotNull GenerationState state,
boolean skipNullabilityAnnotations
) {
if (isAccessor(functionDescriptor)) return;
@@ -516,6 +521,7 @@ public class FunctionCodegen {
Asm7UtilKt.visitAnnotableParameterCount(mv, kotlinParameterTypes.size() - syntheticParameterCount);
boolean isDefaultImpl = OwnerKind.DEFAULT_IMPLS == memberCodegen.context.getContextKind();
for (int i = 0; i < kotlinParameterTypes.size(); i++) {
JvmMethodParameterSignature parameterSignature = kotlinParameterTypes.get(i);
JvmMethodParameterKind kind = parameterSignature.getKind();
@@ -528,13 +534,18 @@ public class FunctionCodegen {
? iterator.next()
: kind == JvmMethodParameterKind.RECEIVER
? JvmCodegenUtil.getDirectMember(functionDescriptor).getExtensionReceiverParameter()
: null;
: kind == JvmMethodParameterKind.THIS && isDefaultImpl
? JvmCodegenUtil.getDirectMember(functionDescriptor).getDispatchReceiverParameter()
: null;
if (annotated != null) {
//noinspection ConstantConditions
int parameterIndex = i - syntheticParameterCount;
AnnotationCodegen.forParameter(parameterIndex, mv, innerClassConsumer, state)
.genAnnotations(annotated, parameterSignature.getAsmType(), annotated.getReturnType());
AnnotationCodegen
.forParameter(parameterIndex, mv, memberCodegen, state, skipNullabilityAnnotations)
.genAnnotations(
annotated, parameterSignature.getAsmType(), annotated.getReturnType(), functionDescriptor,
Collections.emptyList()
);
}
}
}
@@ -606,7 +617,7 @@ public class FunctionCodegen {
true, mv,
method.getAsmMethod(),
method.getOwner().getInternalName(),
true);
true, signature.getReturnType());
methodEnd = new Label();
}
else {
@@ -710,10 +721,8 @@ public class FunctionCodegen {
@NotNull JvmDefaultMode jvmDefaultMode
) {
return OwnerKind.DEFAULT_IMPLS == context.getContextKind() &&
JvmAnnotationUtilKt
.isCompiledToJvmDefault(DescriptorUtils.unwrapFakeOverrideToAnyDeclaration(functionDescriptor),
jvmDefaultMode) &&
jvmDefaultMode.isCompatibility();
jvmDefaultMode.isCompatibility() &&
JvmAnnotationUtilKt.checkIsImplementationCompiledToJvmDefault(functionDescriptor, jvmDefaultMode);
}
private static void generateLocalVariableTable(
@@ -849,7 +858,8 @@ public class FunctionCodegen {
@NotNull Method asmMethod,
@NotNull String classToDelegateTo,
int opcode,
boolean isInterface
boolean isInterface,
@NotNull Type returnType
) {
InstructionAdapter iv = new InstructionAdapter(mv);
Type[] argTypes = asmMethod.getArgumentTypes();
@@ -871,7 +881,8 @@ public class FunctionCodegen {
paramIndex += argType.getSize();
}
iv.visitMethodInsn(opcode, classToDelegateTo, asmMethod.getName(), asmMethod.getDescriptor(), isInterface);
iv.areturn(asmMethod.getReturnType());
StackValue.onStack(asmMethod.getReturnType()).coerceTo(returnType, null, iv);
iv.areturn(returnType);
}
private static void generateDelegateToStaticErasedVersion(
@@ -910,7 +921,19 @@ public class FunctionCodegen {
@NotNull String classToDelegateTo,
boolean isInterfaceMethodCall
) {
generateDelegateToMethodBody(isStatic ? 0 : 1, mv, asmMethod, classToDelegateTo, Opcodes.INVOKESTATIC, isInterfaceMethodCall);
generateDelegateToStaticMethodBody(isStatic, mv, asmMethod, classToDelegateTo, isInterfaceMethodCall, asmMethod.getReturnType());
}
private static void generateDelegateToStaticMethodBody(
boolean isStatic,
@NotNull MethodVisitor mv,
@NotNull Method asmMethod,
@NotNull String classToDelegateTo,
boolean isInterfaceMethodCall,
@NotNull Type returnType
) {
generateDelegateToMethodBody(isStatic ? 0 : 1, mv, asmMethod, classToDelegateTo, Opcodes.INVOKESTATIC, isInterfaceMethodCall, returnType);
}
private static boolean needIndexForVar(JvmMethodParameterKind kind) {
@@ -1656,7 +1679,9 @@ public class FunctionCodegen {
if (JvmAnnotationUtilKt.isCompiledToJvmDefault(memberDescriptor, mode)) {
return (kind != OwnerKind.DEFAULT_IMPLS && !isSynthetic) ||
(kind == OwnerKind.DEFAULT_IMPLS && (isSynthetic || mode.isCompatibility()));
(kind == OwnerKind.DEFAULT_IMPLS &&
(isSynthetic || //TODO: move synthetic method generation into interface
(mode.isCompatibility() && !JvmAnnotationUtilKt.hasJvmDefaultNoCompatibilityAnnotation(containingDeclaration))));
} else {
switch (kind) {
case DEFAULT_IMPLS: return true;

View File

@@ -16,7 +16,6 @@ import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
import org.jetbrains.kotlin.descriptors.FunctionDescriptor;
import org.jetbrains.kotlin.descriptors.PropertyDescriptor;
import org.jetbrains.kotlin.lexer.KtTokens;
import org.jetbrains.kotlin.psi.KtClassOrObject;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.InlineClassesUtilsKt;
@@ -46,6 +45,7 @@ public class FunctionsFromAnyGeneratorImpl extends FunctionsFromAnyGenerator {
private final GenerationState generationState;
private final KotlinTypeMapper typeMapper;
private final JvmKotlinType underlyingType;
private final boolean isInErasedInlineClass;
public FunctionsFromAnyGeneratorImpl(
@NotNull KtClassOrObject declaration,
@@ -67,23 +67,27 @@ public class FunctionsFromAnyGeneratorImpl extends FunctionsFromAnyGenerator {
typeMapper.mapType(descriptor),
InlineClassesUtilsKt.substitutedUnderlyingType(descriptor.getDefaultType())
);
this.isInErasedInlineClass = fieldOwnerContext.getContextKind() == OwnerKind.ERASED_INLINE_CLASS;
}
@Override
protected void generateToStringMethod(
@NotNull FunctionDescriptor function, @NotNull List<? extends PropertyDescriptor> properties
@NotNull FunctionDescriptor function,
@NotNull List<? extends PropertyDescriptor> properties
) {
MethodContext context = fieldOwnerContext.intoFunction(function);
JvmDeclarationOrigin methodOrigin = JvmDeclarationOriginKt.OtherOrigin(function);
String toStringMethodName = mapFunctionName(function);
MethodVisitor mv = v.newMethod(methodOrigin, getAccess(), toStringMethodName, getToStringDesc(), null, null);
if (fieldOwnerContext.getContextKind() != OwnerKind.ERASED_INLINE_CLASS && classDescriptor.isInline()) {
if (!isInErasedInlineClass && classDescriptor.isInline()) {
FunctionCodegen.generateMethodInsideInlineClassWrapper(methodOrigin, function, classDescriptor, mv, typeMapper);
return;
}
visitEndForAnnotationVisitor(mv.visitAnnotation(Type.getDescriptor(NotNull.class), false));
if (!isInErasedInlineClass) {
visitEndForAnnotationVisitor(mv.visitAnnotation(Type.getDescriptor(NotNull.class), false));
}
if (!generationState.getClassBuilderMode().generateBodies) {
FunctionCodegen.endVisit(mv, toStringMethodName, getDeclaration());
@@ -144,7 +148,7 @@ public class FunctionsFromAnyGeneratorImpl extends FunctionsFromAnyGenerator {
String hashCodeMethodName = mapFunctionName(function);
MethodVisitor mv = v.newMethod(methodOrigin, getAccess(), hashCodeMethodName, getHashCodeDesc(), null, null);
if (fieldOwnerContext.getContextKind() != OwnerKind.ERASED_INLINE_CLASS && classDescriptor.isInline()) {
if (!isInErasedInlineClass && classDescriptor.isInline()) {
FunctionCodegen.generateMethodInsideInlineClassWrapper(methodOrigin, function, classDescriptor, mv, typeMapper);
return;
}
@@ -213,15 +217,14 @@ public class FunctionsFromAnyGeneratorImpl extends FunctionsFromAnyGenerator {
String equalsMethodName = mapFunctionName(function);
MethodVisitor mv = v.newMethod(methodOrigin, getAccess(), equalsMethodName, getEqualsDesc(), null, null);
boolean isErasedInlineClassKind = fieldOwnerContext.getContextKind() == OwnerKind.ERASED_INLINE_CLASS;
if (!isErasedInlineClassKind && classDescriptor.isInline()) {
if (!isInErasedInlineClass && classDescriptor.isInline()) {
FunctionCodegen.generateMethodInsideInlineClassWrapper(methodOrigin, function, classDescriptor, mv, typeMapper);
return;
}
visitEndForAnnotationVisitor(
mv.visitParameterAnnotation(isErasedInlineClassKind ? 1 : 0, Type.getDescriptor(Nullable.class), false)
);
if (!isInErasedInlineClass) {
visitEndForAnnotationVisitor(mv.visitParameterAnnotation(0, Type.getDescriptor(Nullable.class), false));
}
if (!generationState.getClassBuilderMode().generateBodies) {
FunctionCodegen.endVisit(mv, equalsMethodName, getDeclaration());

View File

@@ -62,6 +62,8 @@ import org.jetbrains.org.objectweb.asm.commons.Method;
import java.util.*;
import static org.jetbrains.kotlin.builtins.StandardNames.ENUM_VALUES;
import static org.jetbrains.kotlin.builtins.StandardNames.ENUM_VALUE_OF;
import static org.jetbrains.kotlin.codegen.AsmUtil.*;
import static org.jetbrains.kotlin.codegen.CodegenUtilKt.isGenericToArray;
import static org.jetbrains.kotlin.codegen.CodegenUtilKt.isNonGenericToArray;
@@ -771,10 +773,12 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
if (isNonCompanionObject(descriptor)) {
StackValue.Field field = StackValue.createSingletonViaInstance(descriptor, typeMapper, INSTANCE_FIELD);
v.newField(JvmDeclarationOriginKt.OtherOriginFromPure(myClass),
ACC_PUBLIC | ACC_STATIC | ACC_FINAL,
field.name, field.type.getDescriptor(), null, null);
FieldVisitor fv = v.newField(
JvmDeclarationOriginKt.OtherOriginFromPure(myClass),
ACC_PUBLIC | ACC_STATIC | ACC_FINAL,
field.name, field.type.getDescriptor(), null, null
);
AnnotationCodegen.forField(fv, this, state).visitAnnotation(Type.getDescriptor(NotNull.class), false).visitEnd();
return;
}
@@ -816,10 +820,13 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
fieldAccessFlags |= ACC_SYNTHETIC;
}
StackValue.Field field = StackValue.singleton(companionObjectDescriptor, typeMapper);
FieldVisitor fv = v.newField(JvmDeclarationOriginKt.OtherOrigin(companionObject == null ? myClass.getPsiOrParent() : companionObject),
fieldAccessFlags, field.name, field.type.getDescriptor(), null, null);
FieldVisitor fv = v.newField(
JvmDeclarationOriginKt.OtherOrigin(companionObject == null ? myClass.getPsiOrParent() : companionObject),
fieldAccessFlags, field.name, field.type.getDescriptor(), null, null
);
AnnotationCodegen.forField(fv, this, state).visitAnnotation(Type.getDescriptor(NotNull.class), false).visitEnd();
if (fieldShouldBeDeprecated) {
AnnotationCodegen.forField(fv, this, state).visitAnnotation("Ljava/lang/Deprecated;", true).visitEnd();
AnnotationCodegen.forField(fv, this, state).visitAnnotation(Type.getDescriptor(Deprecated.class), true).visitEnd();
}
}

View File

@@ -17,8 +17,7 @@
package org.jetbrains.kotlin.codegen
import com.intellij.util.ArrayUtil
import org.jetbrains.kotlin.backend.common.bridges.findImplementationFromInterface
import org.jetbrains.kotlin.backend.common.bridges.firstSuperMethodFromKotlin
import org.jetbrains.kotlin.util.findImplementationFromInterface
import org.jetbrains.kotlin.codegen.context.ClassContext
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.codegen.state.JvmMethodExceptionTypes
@@ -29,6 +28,7 @@ import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKind
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
import org.jetbrains.kotlin.util.firstSuperMethodFromKotlin
import org.jetbrains.org.objectweb.asm.MethodVisitor
import org.jetbrains.org.objectweb.asm.Opcodes.*

View File

@@ -16,6 +16,8 @@ import org.jetbrains.kotlin.load.java.descriptors.JavaForKotlinOverridePropertyD
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.jvm.annotations.isCompiledToJvmDefault
import org.jetbrains.kotlin.resolve.jvm.annotations.hasPlatformDependentAnnotation
import org.jetbrains.kotlin.util.findImplementationFromInterface
import org.jetbrains.kotlin.util.findInterfaceImplementation
class DescriptorBasedFunctionHandleForJvm(
descriptor: FunctionDescriptor,

View File

@@ -12,6 +12,7 @@ import kotlin.text.StringsKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.backend.common.CodegenUtil;
import org.jetbrains.kotlin.builtins.StandardNames;
import org.jetbrains.kotlin.builtins.functions.FunctionInvokeDescriptor;
import org.jetbrains.kotlin.codegen.binding.CalculatedClosure;
import org.jetbrains.kotlin.codegen.context.CodegenContext;
@@ -404,7 +405,7 @@ public class JvmCodegenUtil {
// The Result class is the only inline class in the standard library without special rules for equality.
// We only call Result.equals-impl0 if we are compiling for Kotlin 1.4 or later. Otherwise, the code
// might well be running against an older version of the standard library.
if (DescriptorUtils.getFqNameSafe(classDescriptor).equals(DescriptorUtils.RESULT_FQ_NAME)) {
if (DescriptorUtils.getFqNameSafe(classDescriptor).equals(StandardNames.RESULT_FQ_NAME)) {
return state.getLanguageVersionSettings().getApiVersion().compareTo(ApiVersion.KOTLIN_1_4) >= 0;
} else {
return ((DeserializedClassDescriptor) descriptor).getMetadataVersion().isAtLeast(1, 1, 16);

View File

@@ -24,6 +24,8 @@ import org.jetbrains.kotlin.resolve.calls.checkers.isRestrictsSuspensionReceiver
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
import org.jetbrains.kotlin.storage.LockBasedStorageManager
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.utils.KotlinExceptionWithAttachments
class JvmRuntimeTypes(
module: ModuleDescriptor,
@@ -96,6 +98,14 @@ class JvmRuntimeTypes(
else
descriptor
if (actualFunctionDescriptor.returnType == null)
throw KotlinExceptionWithAttachments(
"Return type for function description is null. Super type cannot be calculated." +
"initDesc=${descriptor}, actDesc=${actualFunctionDescriptor}, isReleaseCoroutines=${
languageVersionSettings.supportsFeature(LanguageFeature.ReleaseCoroutines)
}"
)
val functionType = createFunctionType(
descriptor.builtIns,
Annotations.EMPTY,

View File

@@ -726,7 +726,7 @@ public abstract class MemberCodegen<T extends KtPureElement/* TODO: & KtDeclarat
public SourceMapper getOrCreateSourceMapper() {
if (sourceMapper == null) {
// note: this is used in InlineCodegen and the element is always physical (KtElement) there
sourceMapper = new SourceMapper(SourceInfo.Companion.createInfo((KtElement)element, getClassName()));
sourceMapper = new SourceMapper(SourceInfo.Companion.createFromPsi((KtElement)element, getClassName()));
}
return sourceMapper;
}

View File

@@ -210,7 +210,6 @@ public class PropertyCodegen {
if (kind == OwnerKind.DEFAULT_IMPLS && isDefaultAccessor) return false;
// Delegated or extension properties can only be referenced via accessors
//noinspection deprecation
if (descriptor.isDelegated() || descriptor.getExtensionReceiverParameter() != null) return true;
// Companion object properties should have accessors for non-private properties because these properties can be referenced
@@ -337,11 +336,8 @@ public class PropertyCodegen {
return;
}
@SuppressWarnings("deprecation")
boolean isDelegate = descriptor.isDelegated();
Object defaultValue;
if (isDelegate) {
if (descriptor.isDelegated()) {
defaultValue = null;
}
else if (Boolean.TRUE.equals(bindingContext.get(BindingContext.BACKING_FIELD_REQUIRED, descriptor))) {
@@ -357,7 +353,7 @@ public class PropertyCodegen {
return;
}
generateBackingField(descriptor, isDelegate, defaultValue, isBackingFieldOwner);
generateBackingField(descriptor, descriptor.isDelegated(), defaultValue, isBackingFieldOwner);
}
// Annotations on properties are stored in bytecode on an empty synthetic method. This way they're still
@@ -438,7 +434,13 @@ public class PropertyCodegen {
);
if (annotatedField != null) {
AnnotationCodegen.forField(fv, memberCodegen, state)
// Don't emit nullability annotations for backing field if:
// - backing field is synthetic;
// - property is lateinit (since corresponding field is actually nullable).
boolean skipNullabilityAnnotations =
(modifiers & ACC_SYNTHETIC) != 0 ||
propertyDescriptor.isLateInit();
AnnotationCodegen.forField(fv, memberCodegen, state, skipNullabilityAnnotations)
.genAnnotations(annotatedField, type, propertyDescriptor.getType());
}
}
@@ -516,9 +518,7 @@ public class PropertyCodegen {
FunctionGenerationStrategy strategy;
if (accessor == null || !accessor.hasBody()) {
@SuppressWarnings("deprecation")
boolean isDelegated = descriptor.getCorrespondingProperty().isDelegated();
if (isDelegated) {
if (descriptor.getCorrespondingProperty().isDelegated()) {
strategy = new DelegatedPropertyAccessorStrategy(state, descriptor);
}
else {

View File

@@ -21,28 +21,26 @@ import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.KtNamedFunction
data class SourceInfo(val source: String, val pathOrCleanFQN: String, val linesInFile: Int) {
data class SourceInfo(
val sourceFileName: String?,
val pathOrCleanFQN: String,
val linesInFile: Int
) {
companion object {
fun createInfo(element: KtElement?, internalClassName: String): SourceInfo {
fun createFromPsi(element: KtElement?, internalClassName: String): SourceInfo {
assert(element != null) { "Couldn't create source mapper for null element $internalClassName" }
val lineNumbers = CodegenUtil.getLineNumberForElement(element!!.containingFile, true)
?: error("Couldn't extract line count in ${element.containingFile}")
?: error("Couldn't extract line count in ${element.containingFile}")
//TODO hack condition for package parts cleaning
val isTopLevel = element is KtFile || (element is KtNamedFunction && element.getParent() is KtFile)
val cleanedClassFqName = if (!isTopLevel) internalClassName else internalClassName.substringBefore('$')
return SourceInfo(element.containingKtFile.name, cleanedClassFqName, lineNumbers)
val fileName = element.containingKtFile.name
return SourceInfo(fileName, cleanedClassFqName, lineNumbers)
}
fun createInfoForIr(lineNumbers: Int, internalClassName: String, containingFileName: String): SourceInfo {
//TODO cut topLevel names
// val isTopLevel = element is KtFile || (element is KtNamedFunction && element.getParent() is KtFile)
// val cleanedClassFqName = if (!isTopLevel) internalClassName else internalClassName.substringBefore('$')
return SourceInfo(containingFileName, internalClassName, lineNumbers)
}
}
}

View File

@@ -1543,7 +1543,7 @@ public abstract class StackValue {
//TODO: try to don't generate defaults at all in CollectionElementReceiver
List<ResolvedValueArgument> getterArguments = new ArrayList(collectionElementReceiver.valueArguments);
List<ResolvedValueArgument> getterArguments = new ArrayList<>(collectionElementReceiver.valueArguments);
List<ResolvedValueArgument> getterDefaults = CollectionsKt.takeLastWhile(getterArguments,
argument -> argument instanceof DefaultValueArgument);

View File

@@ -821,20 +821,17 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
Map<ValueParameterDescriptor, ResolvedValueArgument> arguments = newResolvedCall.getValueArguments();
for (ValueParameterDescriptor valueParameter : arguments.keySet()) {
SamType samType = SamType.createByValueParameter(valueParameter);
if (samType == null) continue;
ResolvedValueArgument argument = arguments.get(valueParameter);
if (argument instanceof ExpressionValueArgument) {
ValueArgument valueArgument = ((ExpressionValueArgument) argument).getValueArgument();
if (valueArgument != null && newResolvedCall.getExpectedTypeForSamConvertedArgument(valueArgument) != null) {
recordSamTypeOnArgumentExpression(samType, valueArgument);
recordSamTypeOnArgumentExpression(valueParameter, valueArgument);
}
} else if (argument instanceof VarargValueArgument) {
VarargValueArgument varargValueArgument = (VarargValueArgument) argument;
for (ValueArgument valueArgument : varargValueArgument.getArguments()) {
if (valueArgument != null && newResolvedCall.getExpectedTypeForSamConvertedArgument(valueArgument) != null) {
recordSamTypeOnArgumentExpression(samType, valueArgument);
recordSamTypeOnArgumentExpression(valueParameter, valueArgument);
}
}
}
@@ -872,6 +869,13 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
}
}
private void recordSamTypeOnArgumentExpression(ValueParameterDescriptor valueParameter, ValueArgument valueArgument) {
SamType samType = SamType.createByValueParameter(valueParameter);
if (samType == null) return;
recordSamTypeOnArgumentExpression(samType, valueArgument);
}
private void recordSamTypeOnArgumentExpression(SamType samType, ValueArgument valueArgument) {
KtExpression argumentExpression = valueArgument.getArgumentExpression();
assert argumentExpression != null : valueArgument.asElement().getText();

View File

@@ -590,7 +590,7 @@ private fun generateLambdaForRunSuspend(
lambdaBuilder.newField(
JvmDeclarationOrigin.NO_ORIGIN,
ACC_PRIVATE or ACC_FINAL,
ACC_PRIVATE or ACC_FINAL or ACC_SYNTHETIC,
"args",
ARRAY_OF_STRINGS_TYPE.descriptor, null, null
)

View File

@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.codegen.context.MethodContext
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings.METHOD_FOR_FUNCTION
import org.jetbrains.kotlin.codegen.serialization.JvmSerializerExtension
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.config.JVMConfigurationKeys
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.config.isReleaseCoroutines
import org.jetbrains.kotlin.descriptors.*
@@ -42,7 +43,6 @@ import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
import org.jetbrains.kotlin.serialization.DescriptorSerializer
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.typeUtil.makeNullable
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
import org.jetbrains.kotlin.utils.sure
import org.jetbrains.org.objectweb.asm.Label
import org.jetbrains.org.objectweb.asm.MethodVisitor
@@ -103,9 +103,9 @@ abstract class AbstractCoroutineCodegen(
ValueParameterDescriptorImpl(
this, null, index, Annotations.EMPTY, name,
type,
false, false,
false,
null, SourceElement.NO_SOURCE
declaresDefaultValue = false, isCrossinline = false,
isNoinline = false,
varargElementType = null, source = SourceElement.NO_SOURCE
)
override fun generateConstructor(): Method {
@@ -156,7 +156,7 @@ abstract class AbstractCoroutineCodegen(
return constructor
}
abstract protected val passArityToSuperClass: Boolean
protected abstract val passArityToSuperClass: Boolean
}
class CoroutineCodegenForLambda private constructor(
@@ -186,6 +186,23 @@ class CoroutineCodegenForLambda private constructor(
private val endLabel = Label()
private val varsCountByType = hashMapOf<Type, Int>()
private val fieldsForParameters: Map<ParameterDescriptor, FieldInfo> = createFieldsForParameters()
private fun createFieldsForParameters(): Map<ParameterDescriptor, FieldInfo> {
val result = hashMapOf<ParameterDescriptor, FieldInfo>()
for (parameter in allFunctionParameters()) {
if (parameter.isUnused()) continue
val type = state.typeMapper.mapType(parameter.type)
val normalizedType = type.normalize()
val index = varsCountByType[normalizedType]?.plus(1) ?: 0
varsCountByType[normalizedType] = index
result[parameter] = createHiddenFieldInfo(parameter.type, "${normalizedType.descriptor[0]}$$index")
}
return result
}
private fun getCreateFunction(): SimpleFunctionDescriptor = SimpleFunctionDescriptorImpl.create(
funDescriptor.containingDeclaration,
Annotations.EMPTY,
@@ -231,11 +248,10 @@ class CoroutineCodegenForLambda private constructor(
override fun generateClosureBody() {
for (parameter in allFunctionParameters()) {
if (parameter.isUnused()) continue
val fieldInfo = parameter.getFieldInfoForCoroutineLambdaParameter()
val fieldInfo = fieldsForParameters[parameter] ?: continue
v.newField(
OtherOrigin(parameter),
Opcodes.ACC_PRIVATE,
Opcodes.ACC_PRIVATE + Opcodes.ACC_SYNTHETIC,
fieldInfo.fieldName,
fieldInfo.fieldType.descriptor, null, null
)
@@ -256,7 +272,7 @@ class CoroutineCodegenForLambda private constructor(
super.generateBody()
if (doNotGenerateInvokeBridge) {
v.serializationBindings.put<FunctionDescriptor, Method>(
v.serializationBindings.put(
METHOD_FOR_FUNCTION,
originalSuspendFunctionDescriptor,
typeMapper.mapAsmMethod(erasedInvokeFunction)
@@ -319,7 +335,7 @@ class CoroutineCodegenForLambda private constructor(
newarray(AsmTypes.OBJECT_TYPE)
// 0 - this
// 1..22 - parameters
// 23 - first empy slot
// 23 - first empty slot
val arraySlot = 23
store(arraySlot, AsmTypes.OBJECT_TYPE)
for ((varIndex, type) in parameterTypes.withVariableIndices()) {
@@ -404,8 +420,8 @@ class CoroutineCodegenForLambda private constructor(
// Pass lambda parameters to 'invoke' call on newly constructed object
var index = 1
for (parameter in allFunctionParameters()) {
val fieldInfoForCoroutineLambdaParameter = parameter.getFieldInfoForCoroutineLambdaParameter()
if (!parameter.isUnused()) {
val fieldInfoForCoroutineLambdaParameter = fieldsForParameters[parameter]
if (fieldInfoForCoroutineLambdaParameter != null) {
if (isBigArity) {
load(cloneIndex, fieldInfoForCoroutineLambdaParameter.ownerType)
load(1, AsmTypes.OBJECT_TYPE)
@@ -441,7 +457,7 @@ class CoroutineCodegenForLambda private constructor(
)
}
}
index += if (isBigArity || generateErasedCreate) 1 else fieldInfoForCoroutineLambdaParameter.fieldType.size
index += if (isBigArity || generateErasedCreate) 1 else state.typeMapper.mapType(parameter.type).size
}
load(cloneIndex, AsmTypes.OBJECT_TYPE)
@@ -451,17 +467,22 @@ class CoroutineCodegenForLambda private constructor(
private fun ExpressionCodegen.initializeCoroutineParameters() {
for (parameter in allFunctionParameters()) {
if (parameter.isUnused()) continue
val fieldStackValue =
StackValue.field(
parameter.getFieldInfoForCoroutineLambdaParameter(), generateThisOrOuter(context.thisDescriptor, false)
)
val fieldForParameter = fieldsForParameters[parameter] ?: continue
val fieldStackValue = StackValue.field(fieldForParameter, generateThisOrOuter(context.thisDescriptor, false))
val mappedType = typeMapper.mapType(parameter.type)
fieldStackValue.put(mappedType, v)
val originalType = typeMapper.mapType(parameter.type)
// If a parameter has reference type, it has prefix L$,
// however, when the type is primitive, its prefix is ${type.descriptor}$.
// In other words, it the type is Boolean, the prefix is Z$.
// This is different from spilled variables, where all int-like primitives have prefix I$.
// This is not a problem, since we do not clean spilled primitives up
// and we do not coerce Int to Boolean, which takes quite a bit of bytecode (see coerceInt).
val normalizedType = originalType.normalize()
fieldStackValue.put(normalizedType, v)
val newIndex = myFrameMap.enter(parameter, mappedType)
v.store(newIndex, mappedType)
val newIndex = myFrameMap.enter(parameter, originalType)
StackValue.coerce(normalizedType, originalType, v)
v.store(newIndex, originalType)
val name =
if (parameter is ReceiverParameterDescriptor)
@@ -470,7 +491,7 @@ class CoroutineCodegenForLambda private constructor(
(getNameForDestructuredParameterOrNull(parameter as ValueParameterDescriptor) ?: parameter.name.asString())
val label = Label()
v.mark(label)
v.visitLocalVariable(name, mappedType.descriptor, null, label, endLabel, newIndex)
v.visitLocalVariable(name, originalType.descriptor, null, label, endLabel, newIndex)
}
initializeVariablesForDestructuredLambdaParameters(
@@ -484,13 +505,10 @@ class CoroutineCodegenForLambda private constructor(
originalSuspendFunctionDescriptor.extensionReceiverParameter.let(::listOfNotNull) +
originalSuspendFunctionDescriptor.valueParameters
private fun ParameterDescriptor.getFieldInfoForCoroutineLambdaParameter() =
createHiddenFieldInfo(type, COROUTINE_LAMBDA_PARAMETER_PREFIX + (this.safeAs<ValueParameterDescriptor>()?.index ?: ""))
private fun createHiddenFieldInfo(type: KotlinType, name: String) =
FieldInfo.createForHiddenField(
typeMapper.mapClass(closureContext.thisDescriptor),
typeMapper.mapType(type),
typeMapper.mapType(type).normalize(),
type,
name
)
@@ -512,7 +530,9 @@ class CoroutineCodegenForLambda private constructor(
containingClassInternalName = v.thisName,
isForNamedFunction = false,
languageVersionSettings = languageVersionSettings,
disableTailCallOptimizationForFunctionReturningUnit = false
disableTailCallOptimizationForFunctionReturningUnit = false,
useOldSpilledVarTypeAnalysis = state.configuration.getBoolean(JVMConfigurationKeys.USE_OLD_SPILLED_VAR_TYPE_ANALYSIS),
initialVarsCountByType = varsCountByType
)
val maybeWithForInline = if (forInline)
SuspendForInlineCopyingMethodVisitor(stateMachineBuilder, access, name, desc, functionCodegen::newMethod)
@@ -756,16 +776,11 @@ class CoroutineCodegenForNamedFunction private constructor(
declaration: KtFunction
): CoroutineCodegenForNamedFunction {
val bindingContext = expressionCodegen.state.bindingContext
val closure =
bindingContext[
CodegenBinding.CLOSURE,
bindingContext[CodegenBinding.CLASS_FOR_CALLABLE, originalSuspendDescriptor]
].sure { "There must be a closure defined for $originalSuspendDescriptor" }
val closure = bindingContext[CLOSURE, bindingContext[CodegenBinding.CLASS_FOR_CALLABLE, originalSuspendDescriptor]]
.sure { "There must be a closure defined for $originalSuspendDescriptor" }
val suspendFunctionView =
bindingContext[
CodegenBinding.SUSPEND_FUNCTION_TO_JVM_VIEW, originalSuspendDescriptor
].sure { "There must be a jvm view defined for $originalSuspendDescriptor" }
val suspendFunctionView = bindingContext[CodegenBinding.SUSPEND_FUNCTION_TO_JVM_VIEW, originalSuspendDescriptor]
.sure { "There must be a jvm view defined for $originalSuspendDescriptor" }
if (suspendFunctionView.dispatchReceiverParameter != null) {
closure.setNeedsCaptureOuterClass()
@@ -783,10 +798,8 @@ class CoroutineCodegenForNamedFunction private constructor(
}
}
private const val COROUTINE_LAMBDA_PARAMETER_PREFIX = "p$"
private object FailingFunctionGenerationStrategy : FunctionGenerationStrategy() {
override fun skipNotNullAssertionsForParameters(): kotlin.Boolean {
override fun skipNotNullAssertionsForParameters(): Boolean {
error("This functions must not be called")
}

View File

@@ -5,14 +5,10 @@
package org.jetbrains.kotlin.codegen.coroutines
import org.jetbrains.kotlin.codegen.AsmUtil
import org.jetbrains.kotlin.codegen.ClassBuilder
import org.jetbrains.kotlin.codegen.StackValue
import org.jetbrains.kotlin.codegen.TransformationMethodVisitor
import org.jetbrains.kotlin.codegen.*
import org.jetbrains.kotlin.codegen.inline.*
import org.jetbrains.kotlin.codegen.optimization.common.*
import org.jetbrains.kotlin.codegen.optimization.fixStack.FixStackMethodTransformer
import org.jetbrains.kotlin.codegen.linkWithLabel
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.config.isReleaseCoroutines
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
@@ -24,6 +20,7 @@ import org.jetbrains.org.objectweb.asm.Opcodes
import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
import org.jetbrains.org.objectweb.asm.tree.*
import org.jetbrains.org.objectweb.asm.tree.analysis.BasicValue
import kotlin.math.max
private const val COROUTINES_DEBUG_METADATA_VERSION = 1
@@ -65,7 +62,11 @@ class CoroutineTransformerMethodVisitor(
// May differ from containingClassInternalName in case of DefaultImpls
private val internalNameForDispatchReceiver: String? = null,
// JVM_IR backend generates $completion, while old backend does not
private val putContinuationParameterToLvt: Boolean = true
private val putContinuationParameterToLvt: Boolean = true,
// New SourceInterpreter-less analyser can be somewhat unstable, disable it
private val useOldSpilledVarTypeAnalysis: Boolean = false,
// Parameters of suspend lambda are put to the same fields as spilled variables
private val initialVarsCountByType: Map<Type, Int> = emptyMap()
) : TransformationMethodVisitor(delegate, access, name, desc, signature, exceptions) {
private val classBuilderForCoroutineState: ClassBuilder by lazy(obtainClassBuilderForCoroutineState)
@@ -134,15 +135,19 @@ class CoroutineTransformerMethodVisitor(
UninitializedStoresProcessor(methodNode, shouldPreserveClassInitialization).run()
updateLvtAccordingToLiveness(methodNode, isForNamedFunction)
val spilledToVariableMapping = spillVariables(suspensionPoints, methodNode)
val suspendMarkerVarIndex = methodNode.maxLocals++
val suspensionPointLineNumbers = suspensionPoints.map { findSuspensionPointLineNumber(it) }
val continuationLabels = suspensionPoints.withIndex().map {
transformCallAndReturnContinuationLabel(
it.index + 1, it.value, methodNode, suspendMarkerVarIndex, suspensionPointLineNumbers[it.index])
// Create states in state-machine, to which state-machine can jump
val stateLabels = suspensionPoints.withIndex().map {
transformCallAndReturnStateLabel(
it.index + 1, it.value, methodNode, suspendMarkerVarIndex, suspensionPointLineNumbers[it.index]
)
}
methodNode.instructions.apply {
@@ -165,7 +170,7 @@ class CoroutineTransformerMethodVisitor(
0,
suspensionPoints.size,
defaultLabel,
firstStateLabel, *continuationLabels.toTypedArray()
firstStateLabel, *stateLabels.toTypedArray()
),
firstStateLabel
)
@@ -182,25 +187,38 @@ class CoroutineTransformerMethodVisitor(
})
}
initializeFakeInlinerVariables(methodNode, stateLabels)
dropSuspensionMarkers(methodNode)
methodNode.removeEmptyCatchBlocks()
// The parameters (and 'this') shall live throughout the method, otherwise, d8 emits warning about invalid debug info
val startLabel = LabelNode()
val endLabel = LabelNode()
methodNode.instructions.insertBefore(methodNode.instructions.first, startLabel)
methodNode.instructions.insert(methodNode.instructions.last, endLabel)
fixLvtForParameters(methodNode, startLabel, endLabel)
if (languageVersionSettings.isReleaseCoroutines()) {
writeDebugMetadata(methodNode, suspensionPointLineNumbers, spilledToVariableMapping)
}
}
// When suspension point is inlined, it is in range of fake inliner variables.
// Path from TABLESWITCH into unspilling goes to latter part of the range.
// In this case the variables are uninitialized, initialize them
private fun initializeFakeInlinerVariables(methodNode: MethodNode, stateLabels: List<LabelNode>) {
for (stateLabel in stateLabels) {
for (record in methodNode.localVariables) {
if (isFakeLocalVariableForInline(record.name) &&
methodNode.instructions.indexOf(record.start) < methodNode.instructions.indexOf(stateLabel) &&
methodNode.instructions.indexOf(stateLabel) < methodNode.instructions.indexOf(record.end)
) {
methodNode.instructions.insert(stateLabel, withInstructionAdapter {
iconst(0)
store(record.index, Type.INT_TYPE)
})
}
}
}
}
private fun addCompletionParameterToLVT(methodNode: MethodNode) {
val index =
/* all args */ Type.getMethodType(methodNode.desc).argumentTypes.fold(0) { a, b -> a + b.size } +
/* all args */ Type.getMethodType(methodNode.desc).argumentTypes.fold(0) { a, b -> a + b.size } +
/* this */ (if (isStatic(methodNode.access)) 0 else 1) -
/* only last */ 1
val startLabel = with(methodNode.instructions) {
@@ -313,31 +331,10 @@ class CoroutineTransformerMethodVisitor(
}
}
private fun fixLvtForParameters(methodNode: MethodNode, startLabel: LabelNode, endLabel: LabelNode) {
val paramsNum =
/* this */ (if (isStatic(methodNode.access)) 0 else 1) +
/* real params */ Type.getArgumentTypes(methodNode.desc).fold(0) { a, b -> a + b.size }
for (i in 0 until paramsNum) {
fixRangeOfLvtRecord(methodNode, i, startLabel, endLabel)
}
}
private fun fixRangeOfLvtRecord(methodNode: MethodNode, index: Int, startLabel: LabelNode, endLabel: LabelNode) {
val vars = methodNode.localVariables.filter { it.index == index }
assert(vars.size <= 1) {
"Someone else occupies parameter's slot at $index"
}
vars.firstOrNull()?.let {
it.start = startLabel
it.end = endLabel
}
}
private fun writeDebugMetadata(
methodNode: MethodNode,
suspensionPointLineNumbers: List<LineNumberNode?>,
spilledToLocalMapping: List<List<SpilledVariableDescriptor>>
spilledToLocalMapping: List<List<SpilledVariableAndField>>
) {
val lines = suspensionPointLineNumbers.map { it?.line ?: -1 }
val metadata = classBuilderForCoroutineState.newAnnotation(DEBUG_METADATA_ANNOTATION_ASM_TYPE.descriptor, true)
@@ -592,16 +589,31 @@ class CoroutineTransformerMethodVisitor(
}
}
private fun spillVariables(suspensionPoints: List<SuspensionPoint>, methodNode: MethodNode): List<List<SpilledVariableDescriptor>> {
private fun spillVariables(suspensionPoints: List<SuspensionPoint>, methodNode: MethodNode): List<List<SpilledVariableAndField>> {
val instructions = methodNode.instructions
val frames = performRefinedTypeAnalysis(methodNode, containingClassInternalName)
val frames =
if (useOldSpilledVarTypeAnalysis) performRefinedTypeAnalysis(methodNode, containingClassInternalName)
else performSpilledVariableFieldTypesAnalysis(methodNode, containingClassInternalName)
fun AbstractInsnNode.index() = instructions.indexOf(this)
// We postpone these actions because they change instruction indices that we use when obtaining frames
val postponedActions = mutableListOf<() -> Unit>()
val maxVarsCountByType = mutableMapOf<Type, Int>()
var initialSpilledVariablesCount = 0
for ((type, count) in initialVarsCountByType) {
if (type == AsmTypes.OBJECT_TYPE) {
initialSpilledVariablesCount = count
}
maxVarsCountByType[type] = count
}
val livenessFrames = analyzeLiveness(methodNode)
val spilledToVariableMapping = arrayListOf<List<SpilledVariableDescriptor>>()
// References shall be cleaned up after uspill (during spill in next suspension point) to prevent memory leaks,
val referencesToSpillBySuspensionPointIndex = arrayListOf<List<ReferenceToSpill>>()
// while primitives shall not
val primitivesToSpillBySuspensionPointIndex = arrayListOf<List<PrimitiveToSpill>>()
// Collect information about spillable variables, that we use to determine which variables we need to cleanup
for (suspension in suspensionPoints) {
val suspensionCallBegin = suspension.suspensionCallBegin
@@ -628,7 +640,8 @@ class CoroutineTransformerMethodVisitor(
// NB: it's also rather useful for sake of optimization
val livenessFrame = livenessFrames[suspensionCallBegin.index()]
val spilledToVariable = arrayListOf<SpilledVariableDescriptor>()
val referencesToSpill = arrayListOf<ReferenceToSpill>()
val primitivesToSpill = arrayListOf<PrimitiveToSpill>()
// 0 - this
// 1 - parameter
@@ -636,77 +649,181 @@ class CoroutineTransformerMethodVisitor(
// k - continuation
// k + 1 - data
// k + 2 - exception
val variablesToSpill =
(0 until localsCount)
.filterNot { it in setOf(continuationIndex, dataIndex, exceptionIndex) }
.map { Pair(it, frame.getLocal(it)) }
.filter { (index, value) ->
(index == 0 && needDispatchReceiver && isForNamedFunction) ||
(value != StrictBasicValue.UNINITIALIZED_VALUE && livenessFrame.isAlive(index))
}
for (slot in 0 until localsCount) {
if (slot == continuationIndex || slot == dataIndex || slot == exceptionIndex) continue
val value = frame.getLocal(slot)
if (value.type == null || !livenessFrame.isAlive(slot)) continue
for ((index, basicValue) in variablesToSpill) {
if (basicValue === StrictBasicValue.NULL_VALUE) {
postponedActions.add {
with(instructions) {
insert(suspension.tryCatchBlockEndLabelAfterSuspensionCall, withInstructionAdapter {
aconst(null)
store(index, AsmTypes.OBJECT_TYPE)
})
}
}
if (value == StrictBasicValue.NULL_VALUE) {
referencesToSpill += slot to null
continue
}
val type = basicValue.type
val type = value.type!!
val normalizedType = type.normalize()
val indexBySort = varsCountByType[normalizedType]?.plus(1) ?: 0
varsCountByType[normalizedType] = indexBySort
val fieldName = normalizedType.fieldNameForVar(indexBySort)
localVariableName(methodNode, index, suspension.suspensionCallEnd.next.index())
?.let { spilledToVariable.add(SpilledVariableDescriptor(fieldName, it)) }
postponedActions.add {
with(instructions) {
// store variable before suspension call
insertBefore(suspension.suspensionCallBegin, withInstructionAdapter {
load(continuationIndex, AsmTypes.OBJECT_TYPE)
load(index, type)
StackValue.coerce(type, normalizedType, this)
putfield(classBuilderForCoroutineState.thisName, fieldName, normalizedType.descriptor)
})
// restore variable after suspension call
insert(suspension.tryCatchBlockEndLabelAfterSuspensionCall, withInstructionAdapter {
load(continuationIndex, AsmTypes.OBJECT_TYPE)
getfield(classBuilderForCoroutineState.thisName, fieldName, normalizedType.descriptor)
StackValue.coerce(normalizedType, type, this)
store(index, type)
})
}
if (normalizedType == AsmTypes.OBJECT_TYPE) {
referencesToSpill += slot to SpillableVariable(value, type, normalizedType, fieldName)
} else {
primitivesToSpill += slot to SpillableVariable(value, type, normalizedType, fieldName)
}
}
spilledToVariableMapping.add(spilledToVariable)
referencesToSpillBySuspensionPointIndex += referencesToSpill
primitivesToSpillBySuspensionPointIndex += primitivesToSpill
varsCountByType.forEach {
maxVarsCountByType[it.key] = max(maxVarsCountByType[it.key] ?: 0, it.value)
for ((type, index) in varsCountByType) {
maxVarsCountByType[type] = max(maxVarsCountByType[type] ?: 0, index)
}
}
postponedActions.forEach(Function0<Unit>::invoke)
// Calculate variables to cleanup
maxVarsCountByType.forEach { entry ->
// Use CFG to calculate amount of spilled variables in previous suspension point (P) and current one (C).
// All fields from L$C to L$P should be cleaned. I.e. we should spill ACONST_NULL to them.
val cfg = ControlFlowGraph.build(methodNode)
// Collect all immediately preceding suspension points. I.e. suspension points, from which there is a path
// into current one, that does not cross other suspension points.
val suspensionPointEnds = suspensionPoints.associateBy { it.suspensionCallEnd }
fun findSuspensionPointPredecessors(suspension: SuspensionPoint): List<SuspensionPoint> {
val visited = mutableSetOf<AbstractInsnNode>()
fun dfs(current: AbstractInsnNode): List<SuspensionPoint> {
if (!visited.add(current)) return emptyList()
suspensionPointEnds[current]?.let { return listOf(it) }
return cfg.getPredecessorsIndices(current).flatMap { dfs(instructions[it]) }
}
return dfs(suspension.suspensionCallBegin)
}
val predSuspensionPoints = suspensionPoints.associateWith { findSuspensionPointPredecessors(it) }
// Calculate all pairs SuspensionPoint -> C and P, where P is minimum of all preds' Cs
fun countVariablesToSpill(index: Int): Int =
referencesToSpillBySuspensionPointIndex[index].count { (_, variable) -> variable != null }
val referencesToCleanBySuspensionPointIndex = arrayListOf<Pair<Int, Int>>() // current to pred
for (suspensionPointIndex in suspensionPoints.indices) {
val suspensionPoint = suspensionPoints[suspensionPointIndex]
val currentSpilledReferencesCount = countVariablesToSpill(suspensionPointIndex)
val preds = predSuspensionPoints[suspensionPoint]
val predSpilledReferencesCount =
if (preds.isNullOrEmpty()) initialSpilledVariablesCount
else preds.maxOf { countVariablesToSpill(suspensionPoints.indexOf(it)) }
referencesToCleanBySuspensionPointIndex += currentSpilledReferencesCount to predSpilledReferencesCount
}
// Mutate method node
fun generateSpillAndUnspill(suspension: SuspensionPoint, slot: Int, spillableVariable: SpillableVariable?) {
if (spillableVariable == null) {
with(instructions) {
insert(suspension.tryCatchBlockEndLabelAfterSuspensionCall, withInstructionAdapter {
aconst(null)
store(slot, AsmTypes.OBJECT_TYPE)
})
}
return
}
with(instructions) {
// store variable before suspension call
insertBefore(suspension.suspensionCallBegin, withInstructionAdapter {
load(continuationIndex, AsmTypes.OBJECT_TYPE)
load(slot, spillableVariable.type)
StackValue.coerce(spillableVariable.type, spillableVariable.normalizedType, this)
putfield(
classBuilderForCoroutineState.thisName,
spillableVariable.fieldName,
spillableVariable.normalizedType.descriptor
)
})
// restore variable after suspension call
insert(suspension.tryCatchBlockEndLabelAfterSuspensionCall, withInstructionAdapter {
load(continuationIndex, AsmTypes.OBJECT_TYPE)
getfield(
classBuilderForCoroutineState.thisName,
spillableVariable.fieldName,
spillableVariable.normalizedType.descriptor
)
StackValue.coerce(spillableVariable.normalizedType, spillableVariable.type, this)
store(slot, spillableVariable.type)
})
}
}
fun cleanUpField(suspension: SuspensionPoint, fieldIndex: Int) {
with(instructions) {
insertBefore(suspension.suspensionCallBegin, withInstructionAdapter {
load(continuationIndex, AsmTypes.OBJECT_TYPE)
aconst(null)
putfield(
classBuilderForCoroutineState.thisName,
"L\$$fieldIndex",
AsmTypes.OBJECT_TYPE.descriptor
)
})
}
}
for (suspensionPointIndex in suspensionPoints.indices) {
val suspension = suspensionPoints[suspensionPointIndex]
for ((slot, referenceToSpill) in referencesToSpillBySuspensionPointIndex[suspensionPointIndex]) {
generateSpillAndUnspill(suspension, slot, referenceToSpill)
}
val (currentSpilledCount, predSpilledCount) = referencesToCleanBySuspensionPointIndex[suspensionPointIndex]
if (predSpilledCount > currentSpilledCount) {
for (fieldIndex in currentSpilledCount until predSpilledCount) {
cleanUpField(suspension, fieldIndex)
}
}
for ((slot, primitiveToSpill) in primitivesToSpillBySuspensionPointIndex[suspensionPointIndex]) {
generateSpillAndUnspill(suspension, slot, primitiveToSpill)
}
}
for (entry in maxVarsCountByType) {
val (type, maxIndex) = entry
for (index in 0..maxIndex) {
for (index in (initialVarsCountByType[type]?.plus(1) ?: 0)..maxIndex) {
classBuilderForCoroutineState.newField(
JvmDeclarationOrigin.NO_ORIGIN, AsmUtil.NO_FLAG_PACKAGE_PRIVATE,
type.fieldNameForVar(index), type.descriptor, null, null
)
}
}
// Calculate debug metadata mapping
fun calculateSpilledVariableAndField(
suspension: SuspensionPoint,
slot: Int,
spillableVariable: SpillableVariable?
): SpilledVariableAndField? {
if (spillableVariable == null) return null
val name = localVariableName(methodNode, slot, suspension.suspensionCallEnd.next.index()) ?: return null
return SpilledVariableAndField(spillableVariable.fieldName, name)
}
val spilledToVariableMapping = arrayListOf<List<SpilledVariableAndField>>()
for (suspensionPointIndex in suspensionPoints.indices) {
val suspension = suspensionPoints[suspensionPointIndex]
val spilledToVariable = arrayListOf<SpilledVariableAndField>()
referencesToSpillBySuspensionPointIndex[suspensionPointIndex].mapNotNullTo(spilledToVariable) { (slot, spillableVariable) ->
calculateSpilledVariableAndField(suspension, slot, spillableVariable)
}
primitivesToSpillBySuspensionPointIndex[suspensionPointIndex].mapNotNullTo(spilledToVariable) { (slot, spillableVariable) ->
calculateSpilledVariableAndField(suspension, slot, spillableVariable)
}
spilledToVariableMapping += spilledToVariable
}
return spilledToVariableMapping
}
@@ -728,21 +845,21 @@ class CoroutineTransformerMethodVisitor(
private val SuspensionPoint.tryCatchBlockEndLabelAfterSuspensionCall: LabelNode
get() {
assert(suspensionCallEnd.next is LabelNode) {
"Next instruction after ${this} should be a label, but " +
"Next instruction after $this should be a label, but " +
"${suspensionCallEnd.next::class.java}/${suspensionCallEnd.next.opcode} was found"
}
return suspensionCallEnd.next as LabelNode
}
private fun transformCallAndReturnContinuationLabel(
private fun transformCallAndReturnStateLabel(
id: Int,
suspension: SuspensionPoint,
methodNode: MethodNode,
suspendMarkerVarIndex: Int,
suspendPointLineNumber: LineNumberNode?
): LabelNode {
val continuationLabel = LabelNode().linkWithLabel()
val stateLabel = LabelNode().linkWithLabel()
val continuationLabelAfterLoadedResult = LabelNode()
val suspendElementLineNumber = lineNumber
var nextLineNumberNode = nextDefinitelyHitLineNumber(suspension)
@@ -770,7 +887,7 @@ class CoroutineTransformerMethodVisitor(
load(suspendMarkerVarIndex, AsmTypes.OBJECT_TYPE)
areturn(AsmTypes.OBJECT_TYPE)
// Mark place for continuation
visitLabel(continuationLabel.label)
visitLabel(stateLabel.label)
})
// After suspension point there is always three nodes: L1, NOP, L2
@@ -821,7 +938,7 @@ class CoroutineTransformerMethodVisitor(
}
}
return continuationLabel
return stateLabel
}
// Find the next line number instruction that is defintely hit. That is, a line number
@@ -829,9 +946,11 @@ class CoroutineTransformerMethodVisitor(
private fun nextDefinitelyHitLineNumber(suspension: SuspensionPoint): LineNumberNode? {
var next = suspension.suspensionCallEnd.next
while (next != null) {
if (next.isBranchOrCall) return null
else if (next is LineNumberNode) return next
else next = next.next
when {
next.isBranchOrCall -> return null
next is LineNumberNode -> return next
else -> next = next.next
}
}
return next
}
@@ -887,9 +1006,19 @@ class CoroutineTransformerMethodVisitor(
return
}
private data class SpilledVariableDescriptor(val fieldName: String, val variableName: String)
private data class SpilledVariableAndField(val fieldName: String, val variableName: String)
}
private class SpillableVariable(
val value: BasicValue,
val type: Type,
val normalizedType: Type,
val fieldName: String
)
private typealias ReferenceToSpill = Pair<Int, SpillableVariable?>
private typealias PrimitiveToSpill = Pair<Int, SpillableVariable>
internal fun InstructionAdapter.generateContinuationConstructorCall(
objectTypeForState: Type?,
methodNode: MethodNode,
@@ -955,7 +1084,7 @@ inline fun withInstructionAdapter(block: InstructionAdapter.() -> Unit): InsnLis
return tmpMethodNode.instructions
}
private fun Type.normalize() =
internal fun Type.normalize() =
when (sort) {
Type.ARRAY, Type.OBJECT -> AsmTypes.OBJECT_TYPE
else -> this
@@ -1026,3 +1155,72 @@ internal fun replaceFakeContinuationsWithRealOnes(methodNode: MethodNode, contin
methodNode.instructions.set(fakeContinuation, VarInsnNode(Opcodes.ALOAD, continuationIndex))
}
}
/* We do not want to spill dead variables, thus, we shrink its LVT record to region, where the variable is alive,
* so, the variable will not be visible in debugger. User can still prolong life span of the variable by using it.
*
* This means, that function parameters do not longer span the whole function, including `this`.
* This might and will break some bytecode processors, including old versions of R8. See KT-24510.
*/
private fun updateLvtAccordingToLiveness(method: MethodNode, isForNamedFunction: Boolean) {
val liveness = analyzeLiveness(method)
fun List<LocalVariableNode>.findRecord(insnIndex: Int, variableIndex: Int): LocalVariableNode? {
for (variable in this) {
if (variable.index == variableIndex &&
method.instructions.indexOf(variable.start) <= insnIndex &&
insnIndex < method.instructions.indexOf(variable.end)
) return variable
}
return null
}
fun isAlive(insnIndex: Int, variableIndex: Int): Boolean =
liveness[insnIndex].isAlive(variableIndex)
val oldLvt = arrayListOf<LocalVariableNode>()
for (record in method.localVariables) {
oldLvt += record
}
method.localVariables.clear()
// Skip `this` for suspend lamdba
val start = if (isForNamedFunction) 0 else 1
for (variableIndex in start until method.maxLocals) {
if (oldLvt.none { it.index == variableIndex }) continue
var startLabel: LabelNode? = null
for (insnIndex in 0 until (method.instructions.size() - 1)) {
val insn = method.instructions[insnIndex]
if (!isAlive(insnIndex, variableIndex) && isAlive(insnIndex + 1, variableIndex)) {
startLabel = insn as? LabelNode ?: insn.findNextOrNull { it is LabelNode } as? LabelNode
}
if (isAlive(insnIndex, variableIndex) && !isAlive(insnIndex + 1, variableIndex)) {
// No variable in LVT -> do not add one
val lvtRecord = oldLvt.findRecord(insnIndex, variableIndex) ?: continue
if (lvtRecord.name == CONTINUATION_VARIABLE_NAME) continue
val endLabel = insn as? LabelNode ?: insn.findNextOrNull { it is LabelNode } as? LabelNode ?: continue
// startLabel can be null in case of parameters
@Suppress("NAME_SHADOWING") val startLabel = startLabel ?: lvtRecord.start
// No LINENUMBER in range -> no way to put a breakpoint -> do not bother adding a record
if (InsnSequence(startLabel, endLabel).none { it is LineNumberNode }) continue
method.localVariables.add(
LocalVariableNode(lvtRecord.name, lvtRecord.desc, lvtRecord.signature, startLabel, endLabel, lvtRecord.index)
)
}
}
}
for (variable in oldLvt) {
// $continuation and $result are dead, but they are used by debugger, as well as fake inliner variables
// For example, $continuation is used to create async stack trace
if (variable.name == CONTINUATION_VARIABLE_NAME ||
variable.name == SUSPEND_CALL_RESULT_NAME ||
isFakeLocalVariableForInline(variable.name)
) {
method.localVariables.add(variable)
}
// this acts like $continuation for lambdas. For example, it is used by debugger to create async stack trace. Keep it.
if (variable.name == "this" && !isForNamedFunction) {
method.localVariables.add(variable)
}
}
}

View File

@@ -1,11 +1,10 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen.coroutines
import org.jetbrains.kotlin.codegen.inline.nodeText
import org.jetbrains.kotlin.codegen.optimization.boxing.isUnitInstance
import org.jetbrains.kotlin.codegen.optimization.common.MethodAnalyzer
import org.jetbrains.kotlin.codegen.optimization.common.asSequence
@@ -13,169 +12,136 @@ import org.jetbrains.kotlin.codegen.optimization.common.removeAll
import org.jetbrains.kotlin.codegen.optimization.fixStack.top
import org.jetbrains.kotlin.codegen.optimization.transformer.MethodTransformer
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
import org.jetbrains.org.objectweb.asm.Opcodes
import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.tree.*
import org.jetbrains.org.objectweb.asm.tree.AbstractInsnNode
import org.jetbrains.org.objectweb.asm.tree.LabelNode
import org.jetbrains.org.objectweb.asm.tree.MethodNode
import org.jetbrains.org.objectweb.asm.tree.VarInsnNode
import org.jetbrains.org.objectweb.asm.tree.analysis.BasicInterpreter
import org.jetbrains.org.objectweb.asm.tree.analysis.BasicValue
import org.jetbrains.org.objectweb.asm.tree.analysis.Frame
import java.util.*
private class PossibleSpilledValue(val source: AbstractInsnNode, type: Type?) : BasicValue(type) {
val usages = mutableSetOf<AbstractInsnNode>()
override fun toString(): String = when {
source.opcode == Opcodes.ALOAD -> "" + (source as VarInsnNode).`var`
source.isUnitInstance() -> "U"
else -> error("unreachable")
}
override fun equals(other: Any?): Boolean =
other is PossibleSpilledValue && source == other.source
override fun hashCode(): Int = super.hashCode() xor source.hashCode()
}
private object NonSpillableValue : BasicValue(AsmTypes.OBJECT_TYPE) {
override fun equals(other: Any?): Boolean = other is NonSpillableValue
override fun toString(): String = "N"
}
private object ConstructedValue : BasicValue(AsmTypes.OBJECT_TYPE) {
override fun equals(other: Any?): Boolean = other is ConstructedValue
override fun toString(): String = "C"
}
fun BasicValue?.nonspillable(): BasicValue? = if (this?.type?.sort == Type.OBJECT) NonSpillableValue else this
private class RedundantSpillingInterpreter : BasicInterpreter(Opcodes.API_VERSION) {
val possibleSpilledValues = mutableSetOf<PossibleSpilledValue>()
override fun newOperation(insn: AbstractInsnNode): BasicValue? {
if (insn.opcode == Opcodes.NEW) return ConstructedValue
val basicValue = super.newOperation(insn)
return if (insn.isUnitInstance())
// Unit instances come from inlining suspend functions returning Unit.
// They can be spilled before they are eventually popped.
// Track them.
PossibleSpilledValue(insn, basicValue.type).also { possibleSpilledValues += it }
else basicValue.nonspillable()
}
override fun copyOperation(insn: AbstractInsnNode, value: BasicValue?): BasicValue? =
when (value) {
is ConstructedValue -> value
is PossibleSpilledValue -> {
value.usages += insn
if (insn.opcode == Opcodes.ALOAD || insn.opcode == Opcodes.ASTORE) value
else value.nonspillable()
}
else -> value?.nonspillable()
}
override fun naryOperation(insn: AbstractInsnNode, values: MutableList<out BasicValue?>): BasicValue? {
for (value in values.filterIsInstance<PossibleSpilledValue>()) {
value.usages += insn
}
return super.naryOperation(insn, values)?.nonspillable()
}
override fun merge(v: BasicValue?, w: BasicValue?): BasicValue? =
if (v is PossibleSpilledValue && w is PossibleSpilledValue && v.source == w.source) v
else v?.nonspillable()
}
// Inliner emits a lot of locals during inlining.
// Remove all of them since these locals are
// 1) going to be spilled into continuation object
// 2) breaking tail-call elimination
/**
* This pass removes unused Unit values. These typically occur as a result of inlining and could end up spilling
* into the continuation object or break tail-call elimination.
*
* Concretely, we remove "GETSTATIC kotlin/Unit.INSTANCE" instructions if they are unused, or all uses are either
* POP instructions, or ASTORE instructions to locals which are never read and are not named local variables.
*
* This pass does not touch [suspensionPoints], as later passes rely on the bytecode patterns around suspension points.
*/
internal class RedundantLocalsEliminationMethodTransformer(private val suspensionPoints: List<SuspensionPoint>) : MethodTransformer() {
override fun transform(internalClassName: String, methodNode: MethodNode) {
val interpreter = RedundantSpillingInterpreter()
val frames = MethodAnalyzer<BasicValue>(internalClassName, methodNode, interpreter).analyze()
val interpreter = UnitSourceInterpreter(methodNode.localVariables?.mapTo(mutableSetOf()) { it.index } ?: setOf())
val frames = interpreter.run(internalClassName, methodNode)
// Mark all unused instructions for deletion (except for labels which may be used in debug information)
val toDelete = mutableSetOf<AbstractInsnNode>()
for (spilledValue in interpreter.possibleSpilledValues.filter { it.usages.isNotEmpty() }) {
@Suppress("UNCHECKED_CAST")
val aloads = spilledValue.usages.filter { it.opcode == Opcodes.ALOAD } as List<VarInsnNode>
if (aloads.isEmpty()) continue
val slot = aloads.first().`var`
if (aloads.any { it.`var` != slot }) continue
for (aload in aloads) {
methodNode.instructions.set(aload, spilledValue.source.clone())
}
toDelete.addAll(spilledValue.usages.filter { it.opcode == Opcodes.ASTORE })
toDelete.add(spilledValue.source)
methodNode.instructions.asSequence().zip(frames.asSequence()).mapNotNullTo(toDelete) { (insn, frame) ->
insn.takeIf { frame == null && insn !is LabelNode }
}
for (pop in methodNode.instructions.asSequence().filter { it.opcode == Opcodes.POP }) {
val value = (frames[methodNode.instructions.indexOf(pop)]?.top() as? PossibleSpilledValue) ?: continue
if (value.usages.isEmpty() && value.source !in suspensionPoints) {
toDelete.add(pop)
toDelete.add(value.source)
}
}
// Remove unreachable instructions to simplify further analyses
for (index in frames.indices) {
if (frames[index] == null) {
val insn = methodNode.instructions[index]
if (insn !is LabelNode) {
toDelete.add(insn)
}
// Mark all spillable "GETSTATIC kotlin/Unit.INSTANCE" instructions for deletion
for ((unit, uses) in interpreter.unitUsageInformation) {
if (unit !in interpreter.unspillableUnitValues && unit !in suspensionPoints) {
toDelete += unit
toDelete += uses
}
}
methodNode.instructions.removeAll(toDelete)
}
private fun AbstractInsnNode.clone() = when (this) {
is FieldInsnNode -> FieldInsnNode(opcode, owner, name, desc)
is VarInsnNode -> VarInsnNode(opcode, `var`)
is InsnNode -> InsnNode(opcode)
is TypeInsnNode -> TypeInsnNode(opcode, desc)
else -> error("clone of $this is not implemented yet")
}
}
// Handy debugging routing
@Suppress("unused")
fun MethodNode.nodeTextWithFrames(frames: Array<*>): String {
var insns = nodeText.split("\n")
val first = insns.indexOfLast { it.trim().startsWith("@") } + 1
var last = insns.indexOfFirst { it.trim().startsWith("LOCALVARIABLE") }
if (last < 0) last = insns.size
val prefix = insns.subList(0, first).joinToString(separator = "\n")
val postfix = insns.subList(last, insns.size).joinToString(separator = "\n")
insns = insns.subList(first, last)
if (insns.any { it.contains("TABLESWITCH") }) {
var insideTableSwitch = false
var buffer = ""
val res = arrayListOf<String>()
for (insn in insns) {
if (insn.contains("TABLESWITCH")) {
insideTableSwitch = true
}
if (insideTableSwitch) {
buffer += insn
if (insn.contains("default")) {
insideTableSwitch = false
res += buffer
buffer = ""
continue
}
} else {
res += insn
// A version of SourceValue which inherits from BasicValue and is only used for Unit values.
private class UnitValue(val insns: Set<AbstractInsnNode>) : BasicValue(AsmTypes.OBJECT_TYPE) {
constructor(insn: AbstractInsnNode) : this(Collections.singleton(insn))
override fun equals(other: Any?): Boolean = other is UnitValue && insns == other.insns
override fun hashCode() = Objects.hash(insns)
override fun toString() = "U"
}
// A specialized SourceInterpreter which only keeps track of the use sites for Unit values which are exclusively used as
// arguments to POP and unused ASTORE instructions.
private class UnitSourceInterpreter(private val localVariables: Set<Int>) : BasicInterpreter(Opcodes.API_VERSION) {
// All unit values with visible use-sites.
val unspillableUnitValues = mutableSetOf<AbstractInsnNode>()
// Map from unit values to ASTORE/POP use-sites.
val unitUsageInformation = mutableMapOf<AbstractInsnNode, MutableSet<AbstractInsnNode>>()
private fun markUnspillable(value: BasicValue?) =
value?.safeAs<UnitValue>()?.let { unspillableUnitValues += it.insns }
private fun collectUnitUsage(use: AbstractInsnNode, value: UnitValue) {
for (def in value.insns) {
if (def !in unspillableUnitValues) {
unitUsageInformation.getOrPut(def) { mutableSetOf() } += use
}
}
insns = res
}
return prefix + "\n" + insns.withIndex().joinToString(separator = "\n") { (index, insn) ->
if (index >= frames.size) "N/A\t$insn" else "${frames[index]}\t$insn"
} + "\n" + postfix
fun run(internalClassName: String, methodNode: MethodNode): Array<Frame<BasicValue>?> {
val frames = MethodAnalyzer<BasicValue>(internalClassName, methodNode, this).analyze()
// The ASM analyzer does not visit POP instructions, so we do so here.
for ((insn, frame) in methodNode.instructions.asSequence().zip(frames.asSequence())) {
if (frame != null && insn.opcode == Opcodes.POP) {
val value = frame.top()
value.safeAs<UnitValue>()?.let { collectUnitUsage(insn, it) }
}
}
return frames
}
override fun newOperation(insn: AbstractInsnNode?): BasicValue =
if (insn?.isUnitInstance() == true) UnitValue(insn) else super.newOperation(insn)
override fun copyOperation(insn: AbstractInsnNode, value: BasicValue?): BasicValue? {
if (value is UnitValue) {
if (insn is VarInsnNode && insn.opcode == Opcodes.ASTORE && insn.`var` !in localVariables) {
collectUnitUsage(insn, value)
// We track the stored value in case it is subsequently read.
return value
}
unspillableUnitValues += value.insns
}
return super.copyOperation(insn, value)
}
override fun unaryOperation(insn: AbstractInsnNode, value: BasicValue?): BasicValue? {
markUnspillable(value)
return super.unaryOperation(insn, value)
}
override fun binaryOperation(insn: AbstractInsnNode, value1: BasicValue?, value2: BasicValue?): BasicValue? {
markUnspillable(value1)
markUnspillable(value2)
return super.binaryOperation(insn, value1, value2)
}
override fun ternaryOperation(insn: AbstractInsnNode, value1: BasicValue?, value2: BasicValue?, value3: BasicValue?): BasicValue? {
markUnspillable(value1)
markUnspillable(value2)
markUnspillable(value3)
return super.ternaryOperation(insn, value1, value2, value3)
}
override fun naryOperation(insn: AbstractInsnNode, values: List<BasicValue>?): BasicValue? {
values?.forEach(this::markUnspillable)
return super.naryOperation(insn, values)
}
override fun merge(value1: BasicValue?, value2: BasicValue?): BasicValue? =
if (value1 is UnitValue && value2 is UnitValue) {
UnitValue(value1.insns.union(value2.insns))
} else {
// Mark unit values as unspillable if we merge them with non-unit values here.
// This is conservative since the value could turn out to be unused.
markUnspillable(value1)
markUnspillable(value2)
super.merge(value1, value2)
}
}

View File

@@ -1,11 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen.coroutines
import org.jetbrains.org.objectweb.asm.tree.analysis.Frame
import org.jetbrains.org.objectweb.asm.tree.analysis.SourceValue
typealias SourceFrames = Array<Frame<SourceValue>?>

View File

@@ -1,11 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen.coroutines
import org.jetbrains.org.objectweb.asm.tree.analysis.Frame
import org.jetbrains.org.objectweb.asm.tree.analysis.SourceValue
typealias SourceFrames = Array<Frame<SourceValue>>

View File

@@ -0,0 +1,160 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen.coroutines
import org.jetbrains.kotlin.codegen.StackValue
import org.jetbrains.kotlin.codegen.optimization.common.MethodAnalyzer
import org.jetbrains.kotlin.codegen.optimization.common.OptimizationBasicInterpreter
import org.jetbrains.org.objectweb.asm.Label
import org.jetbrains.org.objectweb.asm.Opcodes
import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
import org.jetbrains.org.objectweb.asm.tree.*
import org.jetbrains.org.objectweb.asm.tree.analysis.BasicValue
import org.jetbrains.org.objectweb.asm.tree.analysis.Frame
// BasicValue interpreter from ASM does not distinct 'int' types from other int-like types like 'byte' or 'boolean',
// neither do HotSpot and JVM spec.
// But it seems like Dalvik does not follow it, and spilling boolean value into an 'int' field fails with VerifyError on Android 4,
// so this function calculates refined frames' markup.
// Note that type of some values is only possible to determine by their usages (e.g. ICONST_1, BALOAD both may push boolean or byte on stack)
// In this case, coerce the type of the value.
internal class IloadedValue(val insns: Set<VarInsnNode>) : BasicValue(Type.INT_TYPE)
private class IntLikeCoerceInterpreter : OptimizationBasicInterpreter() {
val needsToBeCoerced = mutableMapOf<VarInsnNode, Type>()
private fun coerce(value: IloadedValue, type: Type) {
for (insn in value.insns) {
needsToBeCoerced[insn] = type
}
}
override fun copyOperation(insn: AbstractInsnNode, value: BasicValue?): BasicValue? =
when {
insn.opcode == Opcodes.ILOAD -> IloadedValue(setOf(insn as VarInsnNode))
value == null -> null
else -> BasicValue(value.type)
}
override fun binaryOperation(insn: AbstractInsnNode, v: BasicValue, w: BasicValue): BasicValue? {
if (insn.opcode == Opcodes.PUTFIELD) {
val expectedType = Type.getType((insn as FieldInsnNode).desc)
if (w is IloadedValue && expectedType.isIntLike()) {
coerce(w, expectedType)
}
}
return super.binaryOperation(insn, v, w)
}
override fun unaryOperation(insn: AbstractInsnNode, value: BasicValue?): BasicValue? {
if (insn.opcode == Opcodes.PUTSTATIC) {
val expectedType = Type.getType((insn as FieldInsnNode).desc)
if (value is IloadedValue && expectedType.isIntLike()) {
coerce(value, expectedType)
}
}
return super.unaryOperation(insn, value)
}
override fun naryOperation(insn: AbstractInsnNode, values: MutableList<out BasicValue?>): BasicValue? {
fun checkTypes(argTypes: Array<Type>, withReceiver: Boolean) {
val offset = if (withReceiver) 1 else 0
for ((index, argType) in argTypes.withIndex()) {
val value = values[index + offset] ?: continue
if (argType.isIntLike() && value is IloadedValue) {
coerce(value, argType)
}
}
}
when (insn.opcode) {
Opcodes.INVOKEDYNAMIC -> {
checkTypes(Type.getArgumentTypes((insn as InvokeDynamicInsnNode).desc), false)
}
Opcodes.INVOKESTATIC -> {
checkTypes(Type.getArgumentTypes((insn as MethodInsnNode).desc), false)
}
Opcodes.INVOKEVIRTUAL, Opcodes.INVOKEINTERFACE, Opcodes.INVOKESPECIAL -> {
checkTypes(Type.getArgumentTypes((insn as MethodInsnNode).desc), true)
}
}
return super.naryOperation(insn, values)
}
override fun ternaryOperation(insn: AbstractInsnNode, arrayref: BasicValue?, index: BasicValue?, value: BasicValue?): BasicValue? {
when (insn.opcode) {
Opcodes.BASTORE -> {
if (value is IloadedValue) {
val type = if (arrayref?.type?.descriptor == "[Z") Type.BOOLEAN_TYPE else Type.BYTE_TYPE
coerce(value, type)
}
}
Opcodes.CASTORE -> {
if (value is IloadedValue) {
coerce(value, Type.CHAR_TYPE)
}
}
Opcodes.SASTORE -> {
if (value is IloadedValue) {
coerce(value, Type.SHORT_TYPE)
}
}
}
return super.ternaryOperation(insn, arrayref, index, value)
}
override fun merge(v: BasicValue, w: BasicValue): BasicValue =
when {
v is IloadedValue && w is IloadedValue && v.type == w.type -> {
val insns = v.insns + w.insns
insns.find { it in needsToBeCoerced }?.let {
val type = needsToBeCoerced[it]!!
coerce(v, type)
coerce(w, type)
}
IloadedValue(insns)
}
v.type == w.type -> {
if (w is IloadedValue) w else v
}
else -> super.merge(v, w)
}
}
internal fun performSpilledVariableFieldTypesAnalysis(
methodNode: MethodNode,
thisName: String
): Array<out Frame<BasicValue>?> {
val interpreter = IntLikeCoerceInterpreter()
MethodAnalyzer(thisName, methodNode, interpreter).analyze()
for ((insn, type) in interpreter.needsToBeCoerced) {
methodNode.instructions.insert(insn, withInstructionAdapter { coerceInt(type, this) })
}
return MethodAnalyzer(thisName, methodNode, OptimizationBasicInterpreter()).analyze()
}
private fun coerceInt(to: Type, v: InstructionAdapter) {
if (to == Type.BOOLEAN_TYPE) {
with(v) {
val zeroLabel = Label()
val resLabel = Label()
ifeq(zeroLabel)
iconst(1)
goTo(resLabel)
mark(zeroLabel)
iconst(0)
mark(resLabel)
}
} else {
StackValue.coerce(Type.INT_TYPE, to, v)
}
}
private fun Type.isIntLike(): Boolean = when (sort) {
Type.BOOLEAN, Type.BYTE, Type.CHAR, Type.SHORT -> true
else -> false
}

View File

@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.codegen.inline.addFakeContinuationConstructorCallMar
import org.jetbrains.kotlin.codegen.inline.coroutines.FOR_INLINE_SUFFIX
import org.jetbrains.kotlin.codegen.inline.preprocessSuspendMarkers
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.config.JVMConfigurationKeys
import org.jetbrains.kotlin.config.JVMConstructorCallNormalizationMode
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.config.languageVersionSettings
@@ -95,7 +96,8 @@ class SuspendFunctionGenerationStrategy(
languageVersionSettings = languageVersionSettings,
disableTailCallOptimizationForFunctionReturningUnit = originalSuspendDescriptor.returnType?.isUnit() == true &&
originalSuspendDescriptor.overriddenDescriptors.isNotEmpty() &&
!originalSuspendDescriptor.allOverriddenFunctionsReturnUnit()
!originalSuspendDescriptor.allOverriddenFunctionsReturnUnit(),
useOldSpilledVarTypeAnalysis = state.configuration.getBoolean(JVMConfigurationKeys.USE_OLD_SPILLED_VAR_TYPE_ANALYSIS)
)
}

View File

@@ -26,7 +26,6 @@ import org.jetbrains.org.objectweb.asm.tree.analysis.BasicInterpreter
import org.jetbrains.org.objectweb.asm.tree.analysis.BasicValue
import org.jetbrains.org.objectweb.asm.tree.analysis.Frame
// TODO Use this in variable liveness analysis
internal class MethodNodeExaminer(
val languageVersionSettings: LanguageVersionSettings,
containingClassInternalName: String,

View File

@@ -8,8 +8,8 @@ package org.jetbrains.kotlin.codegen.coroutines
import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.backend.common.COROUTINE_SUSPENDED_NAME
import org.jetbrains.kotlin.backend.common.isBuiltInSuspendCoroutineUninterceptedOrReturn
import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.builtins.isBuiltinFunctionalClassDescriptor
import org.jetbrains.kotlin.builtins.isBuiltinFunctionalType
import org.jetbrains.kotlin.codegen.*
import org.jetbrains.kotlin.codegen.binding.CodegenBinding
import org.jetbrains.kotlin.codegen.inline.addFakeContinuationMarker
@@ -312,7 +312,7 @@ private fun FunctionDescriptor.getContinuationParameterTypeOfSuspendFunction(isR
fun ModuleDescriptor.getResult(kotlinType: KotlinType) =
module.resolveTopLevelClass(
DescriptorUtils.RESULT_FQ_NAME,
StandardNames.RESULT_FQ_NAME,
NoLookupLocation.FROM_BACKEND
)?.defaultType?.let {
KotlinTypeFactory.simpleType(
@@ -501,7 +501,7 @@ fun FunctionDescriptor.isSuspendLambdaOrLocalFunction() = this.isSuspend && when
fun FunctionDescriptor.isLocalSuspendFunctionNotSuspendLambda() = isSuspendLambdaOrLocalFunction() && this !is AnonymousFunctionDescriptor
@JvmField
val EXPERIMENTAL_CONTINUATION_ASM_TYPE = DescriptorUtils.CONTINUATION_INTERFACE_FQ_NAME_EXPERIMENTAL.topLevelClassAsmType()
val EXPERIMENTAL_CONTINUATION_ASM_TYPE = StandardNames.CONTINUATION_INTERFACE_FQ_NAME_EXPERIMENTAL.topLevelClassAsmType()
@JvmField
val RELEASE_CONTINUATION_ASM_TYPE = DescriptorUtils.CONTINUATION_INTERFACE_FQ_NAME_RELEASE.topLevelClassAsmType()
val RELEASE_CONTINUATION_ASM_TYPE = StandardNames.CONTINUATION_INTERFACE_FQ_NAME_RELEASE.topLevelClassAsmType()

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/

View File

@@ -128,7 +128,7 @@ fun createFreeFakeLocalPropertyDescriptor(descriptor: LocalVariableDescriptor, t
val property = PropertyDescriptorImpl.create(
descriptor.containingDeclaration, descriptor.annotations, Modality.FINAL, descriptor.visibility, descriptor.isVar,
descriptor.name, CallableMemberDescriptor.Kind.DECLARATION, descriptor.source, false, descriptor.isConst,
false, false, false, @Suppress("DEPRECATION") descriptor.isDelegated
false, false, false, descriptor.isDelegated
)
property.setType(
descriptor.type, descriptor.typeParameters,

View File

@@ -7,7 +7,7 @@ package org.jetbrains.kotlin.codegen.inline
import com.intellij.psi.PsiElement
import com.intellij.util.ArrayUtil
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.codegen.*
import org.jetbrains.kotlin.codegen.AsmUtil.isPrimitive
import org.jetbrains.kotlin.codegen.context.ClosureContext
@@ -15,9 +15,11 @@ import org.jetbrains.kotlin.codegen.inline.coroutines.FOR_INLINE_SUFFIX
import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicArrayConstructors
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
import org.jetbrains.kotlin.config.CommonConfigurationKeys
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.incremental.components.Position
import org.jetbrains.kotlin.incremental.components.ScopeKind
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.renderer.DescriptorRenderer
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
import org.jetbrains.kotlin.resolve.DescriptorUtils
@@ -25,10 +27,8 @@ import org.jetbrains.kotlin.resolve.ImportedFromObjectCallableDescriptor
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
import org.jetbrains.kotlin.resolve.inline.InlineUtil
import org.jetbrains.kotlin.resolve.inline.isInlineOnly
import org.jetbrains.kotlin.resolve.isInlineClassType
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
import org.jetbrains.kotlin.resolve.jvm.requiresFunctionNameManglingForReturnType
import org.jetbrains.kotlin.resolve.scopes.MemberScope
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DescriptorWithContainerSource
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeSystemCommonBackendContext
@@ -87,12 +87,9 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
isSameModule = sourceCompiler.isCallInsideSameModuleAsDeclared(functionDescriptor)
if (functionDescriptor !is FictitiousArrayConstructor) {
val functionOrAccessorName = jvmSignature.asmMethod.name
//track changes for property accessor and @JvmName inline functions/property accessors
if (functionOrAccessorName != functionDescriptor.name.asString()) {
val scope = getMemberScope(functionDescriptor)
//Fake lookup to track track changes for property accessors and @JvmName functions/property accessors
scope?.getContributedFunctions(Name.identifier(functionOrAccessorName), sourceCompiler.lookupLocation)
if (jvmSignature.asmMethod.name != functionDescriptor.name.asString()) {
trackLookup(functionDescriptor)
}
}
}
@@ -233,7 +230,7 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
)
val sourceInfo = sourceMapper.sourceInfo!!
val callSite = SourcePosition(codegen.lastLineNumber, sourceInfo.source, sourceInfo.pathOrCleanFQN)
val callSite = SourcePosition(codegen.lastLineNumber, sourceInfo.sourceFileName!!, sourceInfo.pathOrCleanFQN)
val inliner = MethodInliner(
node, parameters, info, FieldRemapper(null, null, parameters), isSameModule,
"Method inlining " + sourceCompiler.callElementText,
@@ -500,19 +497,24 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
return true
}
private fun trackLookup(functionOrAccessor: FunctionDescriptor) {
val functionOrAccessorName = jvmSignature.asmMethod.name
val lookupTracker = state.configuration.get(CommonConfigurationKeys.LOOKUP_TRACKER) ?: return
val location = sourceCompiler.lookupLocation.location ?: return
val position = if (lookupTracker.requiresPosition) location.position else Position.NO_POSITION
val classOrPackageFragment = functionOrAccessor.containingDeclaration
lookupTracker.record(
location.filePath,
position,
DescriptorUtils.getFqName(classOrPackageFragment).asString(),
ScopeKind.CLASSIFIER,
functionOrAccessorName
)
}
companion object {
private fun getMemberScope(functionOrAccessor: FunctionDescriptor): MemberScope? {
val callableMemberDescriptor = JvmCodegenUtil.getDirectMember(functionOrAccessor)
val classOrPackageFragment = callableMemberDescriptor.containingDeclaration
return when (classOrPackageFragment) {
is ClassDescriptor -> classOrPackageFragment.unsubstitutedMemberScope
is PackageFragmentDescriptor -> classOrPackageFragment.getMemberScope()
else -> null
}
}
internal fun createInlineMethodNode(
functionDescriptor: FunctionDescriptor,
methodOwner: Type,
@@ -656,6 +658,10 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
if (nameWithoutManglingSuffix != null) {
methodNode = getMethodNode(bytes, nameWithoutManglingSuffix, asmMethod.descriptor, classType)
}
if (methodNode == null) {
val nameWithImplSuffix = "$nameWithoutManglingSuffix-impl"
methodNode = getMethodNode(bytes, nameWithImplSuffix, asmMethod.descriptor, classType)
}
}
return methodNode
}
@@ -669,7 +675,7 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
if (callableDescriptor is FictitiousArrayConstructor) return true
val name = callableDescriptor.name.asString()
return (name == "arrayOf" || name == "emptyArray") && callableDescriptor.containingDeclaration.let { container ->
container is PackageFragmentDescriptor && container.fqName == KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME
container is PackageFragmentDescriptor && container.fqName == StandardNames.BUILT_INS_PACKAGE_FQ_NAME
}
}

View File

@@ -171,7 +171,7 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
checkClusterInvariant(clustersFromInnermost);
int originalDepthIndex = 0;
List<TryCatchBlockNodeInfo> nestedUnsplitBlocksWithoutFinally = new ArrayList();
List<TryCatchBlockNodeInfo> nestedUnsplitBlocksWithoutFinally = new ArrayList<>();
while (tryCatchBlockIterator.hasNext()) {
TryBlockCluster<TryCatchBlockNodeInfo> clusterToFindFinally = tryCatchBlockIterator.next();
List<TryCatchBlockNodeInfo> clusterBlocks = clusterToFindFinally.getBlocks();

View File

@@ -100,6 +100,11 @@ class PsiDefaultLambda(
override fun mapAsmSignature(sourceCompiler: SourceCompilerForInline): Method {
return sourceCompiler.state.typeMapper.mapSignatureSkipGeneric(invokeMethodDescriptor).asmMethod
}
override fun findInvokeMethodDescriptor(): FunctionDescriptor =
parameterDescriptor.type.memberScope
.getContributedFunctions(OperatorNameConventions.INVOKE, NoLookupLocation.FROM_BACKEND)
.single()
}
abstract class DefaultLambda(
@@ -150,14 +155,10 @@ abstract class DefaultLambda(
}
}, ClassReader.SKIP_CODE or ClassReader.SKIP_FRAMES or ClassReader.SKIP_DEBUG)
invokeMethodDescriptor =
parameterDescriptor.type.memberScope
.getContributedFunctions(OperatorNameConventions.INVOKE, NoLookupLocation.FROM_BACKEND)
.single()
.let {
//property reference generates erased 'get' method
if (isPropertyReference) it.original else it
}
invokeMethodDescriptor = findInvokeMethodDescriptor().let {
//property reference generates erased 'get' method
if (isPropertyReference) it.original else it
}
val descriptor = Type.getMethodDescriptor(Type.VOID_TYPE, *capturedArgs)
val constructor = getMethodNode(
@@ -206,6 +207,8 @@ abstract class DefaultLambda(
protected abstract fun mapAsmSignature(sourceCompiler: SourceCompilerForInline): Method
protected abstract fun findInvokeMethodDescriptor(): FunctionDescriptor
private companion object {
val PROPERTY_REFERENCE_SUPER_CLASSES =
listOf(

View File

@@ -91,7 +91,7 @@ class ParametersBuilder private constructor() {
}
fun buildParameters(): Parameters {
var nextDeclarationIndex = (params.maxBy { it.declarationIndex }?.declarationIndex ?: -1) + 1
var nextDeclarationIndex = (params.maxOfOrNull { it.declarationIndex } ?: -1) + 1
return Parameters(params.map { param ->
if (param is CapturedParamInfo) {

View File

@@ -85,9 +85,14 @@ class SourceMapper(val sourceInfo: SourceInfo?) {
get() = fileMappings.values.toList()
init {
sourceInfo?.let {
// Explicitly map the file to itself -- we'll probably need a lot of lines from it, so this will produce fewer ranges.
getOrRegisterNewSource(it.source, it.pathOrCleanFQN).mapNewInterval(1, 1, it.linesInFile)
sourceInfo?.let { sourceInfo ->
// If 'sourceFileName' is null, this class doesn't have debug information
// (e.g., multi-file class facade with multiple parts).
sourceInfo.sourceFileName?.let { sourceFileName ->
// Explicitly map the file to itself -- we'll probably need a lot of lines from it, so this will produce fewer ranges.
getOrRegisterNewSource(sourceFileName, sourceInfo.pathOrCleanFQN)
.mapNewInterval(1, 1, sourceInfo.linesInFile)
}
}
}

View File

@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.codegen.coroutines.*
import org.jetbrains.kotlin.codegen.inline.*
import org.jetbrains.kotlin.codegen.optimization.common.asSequence
import org.jetbrains.kotlin.codegen.optimization.transformer.MethodTransformer
import org.jetbrains.kotlin.config.JVMConfigurationKeys
import org.jetbrains.kotlin.config.isReleaseCoroutines
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
@@ -95,7 +96,8 @@ class CoroutineTransformer(
shouldPreserveClassInitialization = state.constructorCallNormalizationMode.shouldPreserveClassInitialization,
containingClassInternalName = classBuilder.thisName,
isForNamedFunction = false,
disableTailCallOptimizationForFunctionReturningUnit = false
disableTailCallOptimizationForFunctionReturningUnit = false,
useOldSpilledVarTypeAnalysis = state.configuration.getBoolean(JVMConfigurationKeys.USE_OLD_SPILLED_VAR_TYPE_ANALYSIS)
)
if (generateForInline)
@@ -131,7 +133,8 @@ class CoroutineTransformer(
needDispatchReceiver = true,
internalNameForDispatchReceiver = classBuilder.thisName,
disableTailCallOptimizationForFunctionReturningUnit = disableTailCallOptimization,
putContinuationParameterToLvt = !state.isIrBackend
putContinuationParameterToLvt = !state.isIrBackend,
useOldSpilledVarTypeAnalysis = state.configuration.getBoolean(JVMConfigurationKeys.USE_OLD_SPILLED_VAR_TYPE_ANALYSIS)
)
if (generateForInline)

View File

@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.codegen.inline
import org.jetbrains.kotlin.backend.common.isBuiltInIntercepted
import org.jetbrains.kotlin.backend.common.isBuiltInSuspendCoroutineUninterceptedOrReturn
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.codegen.AsmUtil
import org.jetbrains.kotlin.codegen.coroutines.createMethodNodeForCoroutineContext
import org.jetbrains.kotlin.codegen.coroutines.createMethodNodeForIntercepted
@@ -54,7 +55,7 @@ internal fun generateInlineIntrinsic(
private fun isSpecialEnumMethod(descriptor: FunctionDescriptor): Boolean {
val containingDeclaration = descriptor.containingDeclaration as? PackageFragmentDescriptor ?: return false
if (containingDeclaration.fqName != KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME) {
if (containingDeclaration.fqName != StandardNames.BUILT_INS_PACKAGE_FQ_NAME) {
return false
}
if (descriptor.typeParameters.size != 1) {

View File

@@ -20,7 +20,7 @@ import com.google.common.collect.ImmutableList;
import kotlin.text.StringsKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
import org.jetbrains.kotlin.builtins.StandardNames;
import org.jetbrains.kotlin.builtins.PrimitiveType;
import org.jetbrains.kotlin.codegen.AsmUtil;
import org.jetbrains.kotlin.config.JvmTarget;
@@ -32,7 +32,7 @@ import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType;
import org.jetbrains.kotlin.types.expressions.OperatorConventions;
import org.jetbrains.org.objectweb.asm.Type;
import static org.jetbrains.kotlin.builtins.KotlinBuiltIns.*;
import static org.jetbrains.kotlin.builtins.StandardNames.*;
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
public class IntrinsicMethods {
@@ -70,15 +70,15 @@ public class IntrinsicMethods {
public IntrinsicMethods(JvmTarget jvmTarget, boolean canReplaceStdlibRuntimeApiBehavior, boolean shouldThrowNpeOnExplicitEqualsForBoxedNull) {
intrinsicsMap.registerIntrinsic(KOTLIN_JVM, RECEIVER_PARAMETER_FQ_NAME, "javaClass", -1, JavaClassProperty.INSTANCE);
intrinsicsMap.registerIntrinsic(KOTLIN_JVM, KotlinBuiltIns.FQ_NAMES.kClass, "java", -1, new KClassJavaProperty());
intrinsicsMap.registerIntrinsic(KOTLIN_JVM, KotlinBuiltIns.FQ_NAMES.kClass, "javaObjectType", -1, new KClassJavaObjectTypeProperty());
intrinsicsMap.registerIntrinsic(KOTLIN_JVM, KotlinBuiltIns.FQ_NAMES.kClass, "javaPrimitiveType", -1, new KClassJavaPrimitiveTypeProperty());
intrinsicsMap.registerIntrinsic(KotlinBuiltIns.FQ_NAMES.kCallable.toSafe(), null, "name", -1, new KCallableNameProperty());
intrinsicsMap.registerIntrinsic(KOTLIN_JVM, StandardNames.FqNames.kClass, "java", -1, new KClassJavaProperty());
intrinsicsMap.registerIntrinsic(KOTLIN_JVM, StandardNames.FqNames.kClass, "javaObjectType", -1, new KClassJavaObjectTypeProperty());
intrinsicsMap.registerIntrinsic(KOTLIN_JVM, StandardNames.FqNames.kClass, "javaPrimitiveType", -1, new KClassJavaPrimitiveTypeProperty());
intrinsicsMap.registerIntrinsic(StandardNames.FqNames.kCallable.toSafe(), null, "name", -1, new KCallableNameProperty());
intrinsicsMap.registerIntrinsic(new FqName("kotlin.jvm.internal.unsafe"), null, "monitorEnter", 1, MonitorInstruction.MONITOR_ENTER);
intrinsicsMap.registerIntrinsic(new FqName("kotlin.jvm.internal.unsafe"), null, "monitorExit", 1, MonitorInstruction.MONITOR_EXIT);
intrinsicsMap.registerIntrinsic(KOTLIN_JVM, KotlinBuiltIns.FQ_NAMES.array, "isArrayOf", 0, new IsArrayOf());
intrinsicsMap.registerIntrinsic(KOTLIN_JVM, StandardNames.FqNames.array, "isArrayOf", 0, new IsArrayOf());
intrinsicsMap.registerIntrinsic(BUILT_INS_PACKAGE_FQ_NAME, KotlinBuiltIns.FQ_NAMES.kProperty0, "isInitialized", -1, LateinitIsInitialized.INSTANCE);
intrinsicsMap.registerIntrinsic(BUILT_INS_PACKAGE_FQ_NAME, StandardNames.FqNames.kProperty0, "isInitialized", -1, LateinitIsInitialized.INSTANCE);
intrinsicsMap.registerIntrinsic(BUILT_INS_PACKAGE_FQ_NAME, null, "arrayOf", 1, new ArrayOf());
@@ -87,7 +87,7 @@ public class IntrinsicMethods {
ImmutableList<Name> primitiveCastMethods = OperatorConventions.NUMBER_CONVERSIONS.asList();
for (Name method : primitiveCastMethods) {
String methodName = method.asString();
declareIntrinsicFunction(FQ_NAMES.number, methodName, 0, NUMBER_CAST);
declareIntrinsicFunction(StandardNames.FqNames.number, methodName, 0, NUMBER_CAST);
for (PrimitiveType type : PrimitiveType.NUMBER_TYPES) {
declareIntrinsicFunction(type.getTypeFqName(), methodName, 0, NUMBER_CAST);
}
@@ -139,20 +139,20 @@ public class IntrinsicMethods {
declareBinaryOp("or", IOR);
declareBinaryOp("xor", IXOR);
declareIntrinsicFunction(FQ_NAMES._boolean, "not", 0, new Not());
declareIntrinsicFunction(StandardNames.FqNames._boolean, "not", 0, new Not());
declareIntrinsicFunction(FQ_NAMES.string, "plus", 1, new Concat());
declareIntrinsicFunction(FQ_NAMES.string, "get", 1, new StringGetChar());
declareIntrinsicFunction(StandardNames.FqNames.string, "plus", 1, new Concat());
declareIntrinsicFunction(StandardNames.FqNames.string, "get", 1, new StringGetChar());
if (canReplaceStdlibRuntimeApiBehavior) {
intrinsicsMap.registerIntrinsic(TEXT_PACKAGE_FQ_NAME, FQ_NAMES.string, "trimMargin", 1, new TrimMargin());
intrinsicsMap.registerIntrinsic(TEXT_PACKAGE_FQ_NAME, FQ_NAMES.string, "trimIndent", 0, new TrimIndent());
intrinsicsMap.registerIntrinsic(TEXT_PACKAGE_FQ_NAME, StandardNames.FqNames.string, "trimMargin", 1, new TrimMargin());
intrinsicsMap.registerIntrinsic(TEXT_PACKAGE_FQ_NAME, StandardNames.FqNames.string, "trimIndent", 0, new TrimIndent());
}
declareIntrinsicFunction(FQ_NAMES.cloneable, "clone", 0, CLONE);
declareIntrinsicFunction(StandardNames.FqNames.cloneable, "clone", 0, CLONE);
intrinsicsMap.registerIntrinsic(BUILT_INS_PACKAGE_FQ_NAME, KotlinBuiltIns.FQ_NAMES.any, "toString", 0, TO_STRING);
intrinsicsMap.registerIntrinsic(BUILT_INS_PACKAGE_FQ_NAME, KotlinBuiltIns.FQ_NAMES.string, "plus", 1, STRING_PLUS);
intrinsicsMap.registerIntrinsic(BUILT_INS_PACKAGE_FQ_NAME, StandardNames.FqNames.any, "toString", 0, TO_STRING);
intrinsicsMap.registerIntrinsic(BUILT_INS_PACKAGE_FQ_NAME, StandardNames.FqNames.string, "plus", 1, STRING_PLUS);
intrinsicsMap.registerIntrinsic(BUILT_INS_PACKAGE_FQ_NAME, null, "arrayOfNulls", 1, new NewArray());
for (PrimitiveType type : PrimitiveType.values()) {
@@ -197,7 +197,7 @@ public class IntrinsicMethods {
for (JvmPrimitiveType jvmPrimitiveType : JvmPrimitiveType.values()) {
declareArrayMethods(jvmPrimitiveType.getPrimitiveType().getArrayTypeFqName());
}
declareArrayMethods(FQ_NAMES.array.toSafe());
declareArrayMethods(FqNames.array.toSafe());
}
private void declareArrayMethods(@NotNull FqName arrayTypeFqName) {

View File

@@ -16,7 +16,7 @@
package org.jetbrains.kotlin.codegen.intrinsics
import org.jetbrains.kotlin.builtins.KotlinBuiltIns.COLLECTIONS_PACKAGE_FQ_NAME
import org.jetbrains.kotlin.builtins.StandardNames.COLLECTIONS_PACKAGE_FQ_NAME
import org.jetbrains.kotlin.codegen.AsmUtil
import org.jetbrains.kotlin.codegen.Callable
import org.jetbrains.kotlin.codegen.CallableMethod

View File

@@ -5,7 +5,7 @@
package org.jetbrains.kotlin.codegen.intrinsics
import org.jetbrains.kotlin.builtins.KotlinBuiltIns.FQ_NAMES
import org.jetbrains.kotlin.builtins.StandardNames.FqNames
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
@@ -16,7 +16,6 @@ import org.jetbrains.org.objectweb.asm.Opcodes
import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
import org.jetbrains.org.objectweb.asm.tree.*
import kotlin.text.Regex
object TypeIntrinsics {
@JvmStatic
@@ -134,20 +133,20 @@ object TypeIntrinsics {
private val MUTABLE_COLLECTION_TYPE_FQ_NAMES = setOf(
FQ_NAMES.mutableIterator,
FQ_NAMES.mutableIterable,
FQ_NAMES.mutableCollection,
FQ_NAMES.mutableList,
FQ_NAMES.mutableListIterator,
FQ_NAMES.mutableMap,
FQ_NAMES.mutableSet,
FQ_NAMES.mutableMapEntry
FqNames.mutableIterator,
FqNames.mutableIterable,
FqNames.mutableCollection,
FqNames.mutableList,
FqNames.mutableListIterator,
FqNames.mutableMap,
FqNames.mutableSet,
FqNames.mutableMapEntry
)
private fun getMutableCollectionMethodName(prefix: String, jetType: KotlinType): String? {
val fqName = getClassFqName(jetType)
if (fqName == null || fqName !in MUTABLE_COLLECTION_TYPE_FQ_NAMES) return null
val baseName = if (fqName == FQ_NAMES.mutableMapEntry) "MutableMapEntry" else fqName.shortName().asString()
val baseName = if (fqName == FqNames.mutableMapEntry) "MutableMapEntry" else fqName.shortName().asString()
return prefix + baseName
}
@@ -200,4 +199,4 @@ object TypeIntrinsics {
private val BEFORE_CHECKCAST_TO_FUNCTION_OF_ARITY_DESCRIPTOR =
Type.getMethodDescriptor(OBJECT_TYPE, OBJECT_TYPE, Type.INT_TYPE)
}
}

View File

@@ -242,6 +242,17 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
methodNode.removeUnusedLocalVariables()
}
// Be careful to not remove instructions that are the only instruction for a line number. That will
// break debugging. If the previous instruction is a line number and the following instruction is
// a label followed by a line number, insert a nop instead of deleting the instruction.
private fun InsnList.removeOrReplaceByNop(insn: AbstractInsnNode) {
if (insn.previous is LineNumberNode && insn.next is LabelNode && insn.next.next is LineNumberNode) {
set(insn, InsnNode(Opcodes.NOP))
} else {
remove(insn)
}
}
private fun rewriteRefValue(capturedVar: CapturedVarDescriptor) {
methodNode.instructions.run {
val localVar = capturedVar.localVar!!
@@ -259,9 +270,10 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
remove(capturedVar.newInsn)
remove(capturedVar.initCallInsn!!)
capturedVar.stackInsns.forEach { remove(it) }
capturedVar.aloadInsns.forEach { remove(it) }
capturedVar.astoreInsns.forEach { remove(it) }
capturedVar.stackInsns.forEach { removeOrReplaceByNop(it) }
capturedVar.aloadInsns.forEach { removeOrReplaceByNop(it) }
capturedVar.astoreInsns.forEach { removeOrReplaceByNop(it) }
capturedVar.getFieldInsns.forEach { set(it, VarInsnNode(loadOpcode, capturedVar.localVarIndex)) }
capturedVar.putFieldInsns.forEach { set(it, VarInsnNode(storeOpcode, capturedVar.localVarIndex)) }
@@ -273,6 +285,7 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
}
}
}
}
}

View File

@@ -5,16 +5,10 @@
package org.jetbrains.kotlin.codegen.optimization.common
import org.jetbrains.kotlin.codegen.coroutines.SUSPEND_FUNCTION_COMPLETION_PARAMETER_NAME
import org.jetbrains.kotlin.codegen.optimization.transformer.MethodTransformer
import org.jetbrains.kotlin.load.java.JvmAbi
import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.tree.AbstractInsnNode
import org.jetbrains.org.objectweb.asm.tree.IincInsnNode
import org.jetbrains.org.objectweb.asm.tree.MethodNode
import org.jetbrains.org.objectweb.asm.tree.VarInsnNode
import org.jetbrains.org.objectweb.asm.tree.analysis.BasicValue
import org.jetbrains.org.objectweb.asm.tree.analysis.Frame
import java.util.*
@@ -29,10 +23,6 @@ class VariableLivenessFrame(val maxLocals: Int) : VarFrame<VariableLivenessFrame
bitSet.set(varIndex, true)
}
fun markAllAlive(bitSet: BitSet) {
this.bitSet.or(bitSet)
}
fun markDead(varIndex: Int) {
bitSet.set(varIndex, false)
}
@@ -45,34 +35,17 @@ class VariableLivenessFrame(val maxLocals: Int) : VarFrame<VariableLivenessFrame
}
override fun hashCode() = bitSet.hashCode()
override fun toString(): String = (0 until maxLocals).map { if (bitSet[it]) '@' else '_' }.joinToString(separator = "")
}
fun analyzeLiveness(node: MethodNode): List<VariableLivenessFrame> {
val typeAnnotatedFrames = MethodTransformer.analyze("fake", node, OptimizationBasicInterpreter())
val visibleByDebuggerVariables = analyzeVisibleByDebuggerVariables(node, typeAnnotatedFrames)
return analyze(node, object : BackwardAnalysisInterpreter<VariableLivenessFrame> {
fun analyzeLiveness(method: MethodNode): List<VariableLivenessFrame> =
analyze(method, object : BackwardAnalysisInterpreter<VariableLivenessFrame> {
override fun newFrame(maxLocals: Int) = VariableLivenessFrame(maxLocals)
override fun def(frame: VariableLivenessFrame, insn: AbstractInsnNode) = defVar(frame, insn)
override fun use(frame: VariableLivenessFrame, insn: AbstractInsnNode) =
useVar(frame, insn, node, visibleByDebuggerVariables[node.instructions.indexOf(insn)])
useVar(frame, insn)
})
}
private fun analyzeVisibleByDebuggerVariables(
node: MethodNode,
typeAnnotatedFrames: TypeAnnotatedFrames
): Array<BitSet> {
val res = Array(node.instructions.size()) { BitSet(node.maxLocals) }
for (local in node.localVariables) {
if (local.name.isInvisibleDebuggerVariable()) continue
for (index in node.instructions.indexOf(local.start) until node.instructions.indexOf(local.end)) {
if (Type.getType(local.desc).sort == typeAnnotatedFrames[index]?.getLocal(local.index)?.type?.sort) {
res[index].set(local.index)
}
}
}
return res
}
private fun defVar(frame: VariableLivenessFrame, insn: AbstractInsnNode) {
if (insn is VarInsnNode && insn.isStoreOperation()) {
@@ -80,22 +53,10 @@ private fun defVar(frame: VariableLivenessFrame, insn: AbstractInsnNode) {
}
}
private fun useVar(
frame: VariableLivenessFrame,
insn: AbstractInsnNode,
node: MethodNode,
visibleByDebuggerVariables: BitSet
) {
frame.markAllAlive(visibleByDebuggerVariables)
private fun useVar(frame: VariableLivenessFrame, insn: AbstractInsnNode) {
if (insn is VarInsnNode && insn.isLoadOperation()) {
frame.markAlive(insn.`var`)
} else if (insn is IincInsnNode) {
frame.markAlive(insn.`var`)
}
}
private fun String.isInvisibleDebuggerVariable(): Boolean =
startsWith(JvmAbi.LOCAL_VARIABLE_NAME_PREFIX_INLINE_ARGUMENT) ||
startsWith(JvmAbi.LOCAL_VARIABLE_NAME_PREFIX_INLINE_FUNCTION) ||
this == SUSPEND_FUNCTION_COMPLETION_PARAMETER_NAME
}

View File

@@ -69,9 +69,10 @@ abstract class PrimitiveNumberRangeIntrinsicRangeValue(
?: throw AssertionError("Floating point intrinsic range value should be a range literal")
InFloatingPointRangeLiteralExpressionGenerator(operatorReference, rangeLiteral, comparisonGenerator, codegen.frameMap)
}
else -> InIntegralContinuousRangeExpressionGenerator(
operatorReference, rangeContainsTypeInfo, getBoundedValue(codegen), comparisonGenerator, codegen.frameMap
)
else ->
InIntegralContinuousRangeExpressionGenerator(
operatorReference, rangeContainsTypeInfo, getBoundedValue(codegen), comparisonGenerator, codegen.frameMap
)
}
}

View File

@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.codegen.range
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.builtins.UnsignedTypes
import org.jetbrains.kotlin.codegen.AsmUtil.isPrimitiveNumberClassDescriptor
import org.jetbrains.kotlin.descriptors.*
@@ -83,10 +84,10 @@ fun getRangeOrProgressionElementType(rangeType: KotlinType): KotlinType? {
COMPARABLE_RANGE_FQN -> rangeType.arguments.singleOrNull()?.type
UINT_RANGE_FQN, UINT_PROGRESSION_FQN ->
rangeClassDescriptor.findTypeInModuleByTopLevelClassFqName(KotlinBuiltIns.FQ_NAMES.uIntFqName)
rangeClassDescriptor.findTypeInModuleByTopLevelClassFqName(StandardNames.FqNames.uIntFqName)
ULONG_RANGE_FQN, ULONG_PROGRESSION_FQN ->
rangeClassDescriptor.findTypeInModuleByTopLevelClassFqName(KotlinBuiltIns.FQ_NAMES.uLongFqName)
rangeClassDescriptor.findTypeInModuleByTopLevelClassFqName(StandardNames.FqNames.uLongFqName)
else -> null
}
@@ -208,17 +209,25 @@ fun isPrimitiveRangeContains(descriptor: CallableDescriptor): Boolean {
}
fun isUnsignedIntegerRangeContains(descriptor: CallableDescriptor): Boolean {
if (descriptor.name.asString() != "contains") return false
val dispatchReceiverType = descriptor.dispatchReceiverParameter?.type
val extensionReceiverType = descriptor.extensionReceiverParameter?.type
return (dispatchReceiverType != null && isUnsignedRange(dispatchReceiverType)) ||
(extensionReceiverType != null && isUnsignedRange(extensionReceiverType))
when {
dispatchReceiverType != null && extensionReceiverType == null -> {
if (descriptor.name.asString() != "contains") return false
return isUnsignedRange(dispatchReceiverType)
}
extensionReceiverType != null && dispatchReceiverType == null -> {
if (!descriptor.isTopLevelInPackage("contains", "kotlin.ranges")) return false
return isUnsignedRange(extensionReceiverType)
}
else ->
return false
}
}
fun isPrimitiveNumberRangeExtensionContainsPrimitiveNumber(descriptor: CallableDescriptor): Boolean {
if (descriptor.name.asString() != "contains") return false
if (!descriptor.isTopLevelInPackage("contains", "kotlin.ranges")) return false
val extensionReceiverType = descriptor.extensionReceiverParameter?.type ?: return false

View File

@@ -74,7 +74,6 @@ fun ExpressionCodegen.createRangeValueForExpression(rangeExpression: KtExpressio
}
}
@Suppress("DEPRECATION")
fun isLocalVarReference(rangeExpression: KtExpression, bindingContext: BindingContext): Boolean {
if (rangeExpression !is KtSimpleNameExpression) return false
val resultingDescriptor = rangeExpression.getResolvedCall(bindingContext)?.resultingDescriptor ?: return false

View File

@@ -87,7 +87,10 @@ fun getComparisonGeneratorForRangeContainsCall(
getComparisonGeneratorForKotlinType(elementType)
KotlinBuiltIns.isUInt(elementType) ->
UIntComparisonGenerator
if (KotlinBuiltIns.isULong(valueParameterType))
null
else
UIntComparisonGenerator
KotlinBuiltIns.isULong(elementType) ->
ULongComparisonGenerator

View File

@@ -94,7 +94,13 @@ class JvmSerializerExtension @JvmOverloads constructor(
writeVersionRequirementForJvmDefaultIfNeeded(descriptor, proto, versionRequirementTable)
if (jvmDefaultMode.forAllMethodsWithBody && isInterface(descriptor)) {
proto.setExtension(JvmProtoBuf.jvmClassFlags, JvmFlags.getClassFlags(true))
proto.setExtension(
JvmProtoBuf.jvmClassFlags,
JvmFlags.getClassFlags(
jvmDefaultMode.forAllMethodsWithBody,
JvmDefaultMode.ALL_COMPATIBILITY == jvmDefaultMode
)
)
}
}
@@ -295,7 +301,7 @@ class JvmSerializerExtension @JvmOverloads constructor(
super.serializeErrorType(type, builder)
}
private fun <K, V> getBinding(slice: SerializationMappingSlice<K, V>, key: K): V? =
private fun <K : Any, V> getBinding(slice: SerializationMappingSlice<K, V>, key: K): V? =
bindings.get(slice, key) ?: globalBindings.get(slice, key)
private inner class SignatureSerializer {

View File

@@ -16,16 +16,27 @@
package org.jetbrains.kotlin.codegen.signature
import org.jetbrains.kotlin.builtins.PrimitiveType
import org.jetbrains.kotlin.codegen.AsmUtil
import org.jetbrains.kotlin.load.kotlin.JvmTypeFactory
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.org.objectweb.asm.Type
object AsmTypeFactory : JvmTypeFactory<Type> {
override fun boxType(possiblyPrimitiveType: Type) = AsmUtil.boxType(possiblyPrimitiveType)
override fun createFromString(representation: String) = Type.getType(representation)
override fun createObjectType(internalName: String) = Type.getObjectType(internalName)
override fun toString(type: Type) = type.descriptor
override fun boxType(possiblyPrimitiveType: Type): Type =
AsmUtil.boxType(possiblyPrimitiveType)
override fun createFromString(representation: String): Type =
Type.getType(representation)
override fun createPrimitiveType(primitiveType: PrimitiveType): Type =
AsmTypes.valueTypeForPrimitive(primitiveType)
override fun createObjectType(internalName: String): Type =
Type.getObjectType(internalName)
override fun toString(type: Type): String =
type.descriptor
override val javaLangClassType: Type
get() = AsmTypes.JAVA_CLASS_TYPE

View File

@@ -51,14 +51,12 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
moduleName: String,
languageVersionSettings: LanguageVersionSettings,
shouldGenerate: (JvmDeclarationOrigin) -> Boolean,
mapAsmMethod: ((FunctionDescriptor) -> Method)?
) : SignatureCollectingClassBuilderFactory(builderFactory, shouldGenerate) {
private val mapAsmMethod = mapAsmMethod
?: KotlinTypeMapper(
// Avoid errors when some classes are not loaded for some reason
bindingContext, ClassBuilderMode.LIGHT_CLASSES, moduleName, languageVersionSettings, isIrBackend = false
)::mapAsmMethod
private val mapAsmMethod: (FunctionDescriptor) -> Method = KotlinTypeMapper(
// Avoid errors when some classes are not loaded for some reason
bindingContext, ClassBuilderMode.LIGHT_CLASSES, moduleName, languageVersionSettings, isIrBackend = false
)::mapAsmMethod
private val reportDiagnosticsTasks = ArrayList<() -> Unit>()

View File

@@ -21,7 +21,6 @@ import org.jetbrains.kotlin.codegen.optimization.OptimizationClassBuilderFactory
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings
import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.descriptors.ScriptDescriptor
import org.jetbrains.kotlin.diagnostics.Diagnostic
@@ -48,7 +47,6 @@ import org.jetbrains.kotlin.storage.LockBasedStorageManager
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeApproximator
import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.commons.Method
import java.io.File
class GenerationState private constructor(
@@ -283,7 +281,6 @@ class GenerationState private constructor(
val isIrWithStableAbi = configuration.getBoolean(JVMConfigurationKeys.IS_IR_WITH_STABLE_ABI)
val globalSerializationBindings = JvmSerializationBindings()
lateinit var irBasedMapAsmMethod: (FunctionDescriptor) -> Method
var mapInlineClass: (ClassDescriptor) -> Type = { descriptor -> typeMapper.mapType(descriptor.defaultType) }
val typeApproximator: TypeApproximator? =
@@ -310,7 +307,6 @@ class GenerationState private constructor(
BuilderFactoryForDuplicateSignatureDiagnostics(
it, this.bindingContext, diagnostics, this.moduleName, this.languageVersionSettings,
shouldGenerate = { origin -> !shouldOnlyCollectSignatures(origin) },
mapAsmMethod = if (isIrBackend) { descriptor: FunctionDescriptor -> irBasedMapAsmMethod(descriptor) } else null
).apply { duplicateSignatureFactory = this }
},
{ BuilderFactoryForDuplicateClassNameDiagnostics(it, diagnostics) },

View File

@@ -8,7 +8,9 @@ package org.jetbrains.kotlin.codegen.state
import com.intellij.openapi.util.text.StringUtil
import org.jetbrains.kotlin.builtins.BuiltInsPackageFragment
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.StandardNames.RESULT_FQ_NAME
import org.jetbrains.kotlin.builtins.functions.FunctionClassDescriptor
import org.jetbrains.kotlin.builtins.functions.FunctionClassKind
import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap
import org.jetbrains.kotlin.codegen.*
import org.jetbrains.kotlin.codegen.AsmUtil.isStaticMethod
@@ -23,7 +25,9 @@ import org.jetbrains.kotlin.codegen.signature.BothSignatureWriter
import org.jetbrains.kotlin.codegen.signature.JvmSignatureWriter
import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.impl.*
import org.jetbrains.kotlin.descriptors.impl.LocalVariableAccessorDescriptor
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor
import org.jetbrains.kotlin.descriptors.impl.TypeAliasConstructorDescriptor
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil
import org.jetbrains.kotlin.load.java.BuiltinMethodsWithSpecialGenericSignature
import org.jetbrains.kotlin.load.java.JvmAbi
@@ -50,10 +54,7 @@ import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsExpression
import org.jetbrains.kotlin.resolve.calls.model.DefaultValueArgument
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
import org.jetbrains.kotlin.resolve.calls.model.VarargValueArgument
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
import org.jetbrains.kotlin.resolve.descriptorUtil.classId
import org.jetbrains.kotlin.resolve.descriptorUtil.isPublishedApi
import org.jetbrains.kotlin.resolve.descriptorUtil.module
import org.jetbrains.kotlin.resolve.descriptorUtil.*
import org.jetbrains.kotlin.resolve.jvm.AsmTypes.DEFAULT_CONSTRUCTOR_MARKER
import org.jetbrains.kotlin.resolve.jvm.AsmTypes.OBJECT_TYPE
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
@@ -328,8 +329,8 @@ class KotlinTypeMapper @JvmOverloads constructor(
if (classDescriptor is FunctionClassDescriptor) {
if (classDescriptor.hasBigArity ||
classDescriptor.functionKind == FunctionClassDescriptor.Kind.KFunction ||
classDescriptor.functionKind == FunctionClassDescriptor.Kind.KSuspendFunction
classDescriptor.functionKind == FunctionClassKind.KFunction ||
classDescriptor.functionKind == FunctionClassKind.KSuspendFunction
) {
// kotlin.reflect.KFunction{n}<P1, ..., Pn, R> is mapped to kotlin.reflect.KFunction<R> (for all n), and
// kotlin.Function{n}<P1, ..., Pn, R> is mapped to kotlin.jvm.functions.FunctionN<R> (for n > 22).
@@ -383,6 +384,11 @@ class KotlinTypeMapper @JvmOverloads constructor(
return functionDescriptor.builtIns.nullableAnyType
}
// Force boxing for Result type, otherwise, the coroutines machinery will break
if (originalReturnType.constructor.declarationDescriptor?.fqNameSafe == RESULT_FQ_NAME) {
return functionDescriptor.builtIns.nullableAnyType
}
// Don't box other inline classes
return originalReturnType
}
@@ -1208,7 +1214,7 @@ class KotlinTypeMapper @JvmOverloads constructor(
return StackValue.sharedTypeForType(mapType(receiverParameter.type))
}
if (descriptor is LocalVariableDescriptor && @Suppress("DEPRECATION") descriptor.isDelegated) {
if (descriptor is LocalVariableDescriptor && descriptor.isDelegated) {
return null
}

View File

@@ -18,6 +18,7 @@
package org.jetbrains.kotlin.codegen.state
import org.jetbrains.kotlin.builtins.StandardNames.FqNames
import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
@@ -37,7 +38,6 @@ import org.jetbrains.kotlin.types.checker.convertVariance
import org.jetbrains.kotlin.types.getEffectiveVariance
import org.jetbrains.kotlin.types.model.KotlinTypeMarker
import org.jetbrains.kotlin.types.model.TypeParameterMarker
import org.jetbrains.kotlin.builtins.KotlinBuiltIns.FQ_NAMES as BUILTIN_NAMES
// TODO: probably class upper bound should be used
@Suppress("UNUSED_PARAMETER")
@@ -81,9 +81,9 @@ val FqName?.isMethodWithDeclarationSiteWildcardsFqName: Boolean
private fun FqName.child(name: String): FqName = child(Name.identifier(name))
private val METHODS_WITH_DECLARATION_SITE_WILDCARDS = setOf(
BUILTIN_NAMES.mutableCollection.child("addAll"),
BUILTIN_NAMES.mutableList.child("addAll"),
BUILTIN_NAMES.mutableMap.child("putAll")
FqNames.mutableCollection.child("addAll"),
FqNames.mutableList.child("addAll"),
FqNames.mutableMap.child("putAll")
)
fun TypeMappingMode.updateArgumentModeFromAnnotations(

View File

@@ -35,7 +35,7 @@ private class State<T>(val path: MutableList<String>) {
path.add(step)
}
fun removeStep(step: String) {
fun removeStep() {
path.removeAt(path.lastIndex)
}
@@ -93,7 +93,7 @@ abstract class TypeAnnotationCollector<T>(val context: TypeSystemCommonBackendCo
fun KotlinTypeMarker.process(step: String) {
state.addStep(step)
this.gatherTypeAnnotations()
state.removeStep(step)
state.removeStep()
}

View File

@@ -6,7 +6,7 @@
package org.jetbrains.kotlin.serialization.builtins
import com.intellij.openapi.util.Disposer
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.builtins.jvm.JvmBuiltInClassDescriptorFactory
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
import org.jetbrains.kotlin.cli.common.config.addKotlinSourceRoots
@@ -51,7 +51,7 @@ class BuiltInsSerializer(dependOnOldBuiltIns: Boolean) : MetadataSerializer(Buil
put(CommonConfigurationKeys.MODULE_NAME, "module for built-ins serialization")
}
val environment = KotlinCoreEnvironment.createForTests(rootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES)
val environment = KotlinCoreEnvironment.createForProduction(rootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES)
serialize(environment)
@@ -100,9 +100,9 @@ class BuiltInsSerializer(dependOnOldBuiltIns: Boolean) : MetadataSerializer(Buil
// Since Kotlin 1.1, we always discard this class during deserialization (see ClassDeserializer.kt).
private fun createCloneable(module: ModuleDescriptor): ClassDescriptor {
val factory = JvmBuiltInClassDescriptorFactory(LockBasedStorageManager.NO_LOCKS, module) {
EmptyPackageFragmentDescriptor(module, KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME)
EmptyPackageFragmentDescriptor(module, StandardNames.BUILT_INS_PACKAGE_FQ_NAME)
}
return factory.createClass(ClassId.topLevel(KotlinBuiltIns.FQ_NAMES.cloneable.toSafe()))
return factory.createClass(ClassId.topLevel(StandardNames.FqNames.cloneable.toSafe()))
?: error("Could not create kotlin.Cloneable in $module")
}
}

View File

@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.serialization.builtins
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.builtins.BuiltInsBinaryVersion
import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion
import org.jetbrains.kotlin.serialization.AnnotationSerializer
import org.jetbrains.kotlin.serialization.KotlinSerializerExtensionBase
import org.jetbrains.kotlin.serialization.deserialization.builtins.BuiltInSerializerProtocol
import org.jetbrains.kotlin.types.KotlinType
@@ -31,20 +32,29 @@ class BuiltInsSerializerExtension : KotlinSerializerExtensionBase(BuiltInSeriali
"CharRange" to "kotlin/ranges/CharRange"
)
override fun createAnnotationSerializer(): AnnotationSerializer = object : AnnotationSerializer(stringTable) {
override fun ignoreAnnotation(type: KotlinType): Boolean =
type.presentableName == "JvmStatic" || type.presentableName == "JvmField" || super.ignoreAnnotation(type)
}
override val metadataVersion: BinaryVersion
get() = BuiltInsBinaryVersion.INSTANCE
override fun shouldUseTypeTable(): Boolean = true
override fun serializeErrorType(type: KotlinType, builder: ProtoBuf.Type.Builder) {
val unwrapped = type.unwrap()
if (unwrapped !is UnresolvedType) {
throw UnsupportedOperationException("Error types which are not UnresolvedType instances are not supported here: $unwrapped")
}
val className = shortNameToClassId[unwrapped.presentableName]
?: throw UnsupportedOperationException("Unsupported unresolved type: $unwrapped")
val className = shortNameToClassId[type.presentableName]
?: throw UnsupportedOperationException("Unsupported unresolved type: ${type.unwrap()}")
builder.className = stringTable.getQualifiedClassNameIndex(className, false)
}
private val KotlinType.presentableName: String
get() {
val unwrapped = unwrap()
if (unwrapped !is UnresolvedType) {
throw UnsupportedOperationException("Error types which are not UnresolvedType instances are not supported here: $unwrapped")
}
return unwrapped.presentableName
}
}

View File

@@ -31,6 +31,9 @@ dependencies {
compile(project(":kotlin-util-io"))
compile(project(":compiler:ir.serialization.common"))
// TODO: as soon as cli-jvm is extracted out of this module, move this dependency there
compileOnly(project(":compiler:ir.tree.impl"))
compileOnly(toolsJarApi())
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
compileOnly(intellijDep()) { includeIntellijCoreJarDependencies(project) }

View File

@@ -317,6 +317,12 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
)
var useFir: Boolean by FreezableVar(false)
@Argument(
value = "-Xuse-fir-extended-checkers",
description = "Use extended analysis mode based on Front-end IR. Warning: this feature is far from being production-ready"
)
var useFirExtendedCheckers: Boolean by FreezableVar(false)
@Argument(
value = "-Xuse-mixed-named-arguments",
description = "Enable Support named arguments in their own position even if the result appears as mixed"
@@ -340,6 +346,12 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
)
var explicitApi: String by FreezableVar(ExplicitApiMode.DISABLED.state)
@Argument(
value = "-Xdeserialize-fake-overrides",
description = "Fallback to deserializing fake overrides"
)
var deserializeFakeOverrides: Boolean by FreezableVar(false)
open fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
return HashMap<AnalysisFlag<*>, Any>().apply {
put(AnalysisFlags.skipMetadataVersionCheck, skipMetadataVersionCheck)
@@ -382,6 +394,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
put(LanguageFeature.NewInference, LanguageFeature.State.ENABLED)
put(LanguageFeature.SamConversionPerArgument, LanguageFeature.State.ENABLED)
put(LanguageFeature.FunctionReferenceWithDefaultValueAsOtherType, LanguageFeature.State.ENABLED)
put(LanguageFeature.DisableCompatibilityModeForNewInference, LanguageFeature.State.ENABLED)
}
if (inlineClasses) {
@@ -461,6 +474,8 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
if (!functionReferenceWithDefaultValueFeaturePassedExplicitly)
put(LanguageFeature.FunctionReferenceWithDefaultValueAsOtherType, LanguageFeature.State.ENABLED)
put(LanguageFeature.DisableCompatibilityModeForNewInference, LanguageFeature.State.ENABLED)
}
if (featuresThatForcePreReleaseBinaries.isNotEmpty()) {

View File

@@ -135,6 +135,9 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
)
var irModuleName: String? by NullableStringFreezableVar(null)
@Argument(value = "-Xir-per-module", description = "Splits generated .js per-module")
var irPerModule: Boolean by FreezableVar(false)
@Argument(
value = "-Xinclude",
valueDescription = "<path>",
@@ -169,6 +172,9 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-Xenable-js-scripting", description = "Enable experimental support of .kts files using K/JS (with -Xir only)")
var enableJsScripting: Boolean by FreezableVar(false)
@Argument(value = "-Xdisable-fake-override-validator", description = "Disable IR fake override validator")
var disableFakeOverrideValidator: Boolean by FreezableVar(false)
override fun checkIrSupport(languageVersionSettings: LanguageVersionSettings, collector: MessageCollector) {
if (!isIrBackendEnabled()) return

View File

@@ -369,6 +369,12 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
)
var repeatCompileModules: String? by NullableStringFreezableVar(null)
@Argument(
value = "-Xuse-old-spilled-var-type-analysis",
description = "Use old, SourceInterpreter-based analysis for fields, used for spilled variables in coroutines"
)
var useOldSpilledVarTypeAnalysis: Boolean by FreezableVar(false)
override fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
val result = super.configureAnalysisFlags(collector)
result[JvmAnalysisFlags.strictMetadataVersionSemantics] = strictMetadataVersionSemantics

View File

@@ -17,7 +17,6 @@
package org.jetbrains.kotlin.cli.common.messages;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -25,6 +24,7 @@ import java.io.File;
import java.io.PrintWriter;
import java.io.Serializable;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collection;
public class OutputMessageUtil {
@@ -69,7 +69,7 @@ public class OutputMessageUtil {
}
private static Collection<File> parseSourceFiles(String[] strings, int start) {
Collection<File> sourceFiles = ContainerUtil.newArrayList();
Collection<File> sourceFiles = new ArrayList<>();
for (int i = start; i < strings.length; i++) {
sourceFiles.add(new File(strings[i]));
}

View File

@@ -89,6 +89,9 @@ open class GenericReplEvaluator(
historyActor.addPlaceholder(compileResult.lineId, EvalClassWithInstanceAndLoader(scriptClass.kotlin, null, classLoader, invokeWrapper))
val savedClassLoader = Thread.currentThread().contextClassLoader
Thread.currentThread().contextClassLoader = classLoader
val scriptInstance =
try {
if (invokeWrapper != null) invokeWrapper.invoke { scriptInstanceConstructor.newInstance(*constructorArgs) }
@@ -104,6 +107,7 @@ open class GenericReplEvaluator(
}
finally {
historyActor.removePlaceholder(compileResult.lineId)
Thread.currentThread().contextClassLoader = savedClassLoader
}
historyActor.addFinal(compileResult.lineId, EvalClassWithInstanceAndLoader(scriptClass.kotlin, scriptInstance, classLoader, invokeWrapper))

View File

@@ -34,12 +34,12 @@ fun String.replUnescapeLineBreaks() = StringUtil.replace(this, XML_REPLACEMENTS,
fun String.replEscapeLineBreaks() = StringUtil.replace(this, SOURCE_CHARS, XML_REPLACEMENTS)
fun String.replOutputAsXml(escapeType: ReplEscapeType): String {
val escapedXml = StringUtil.escapeXml(replEscapeLineBreaks())
val escapedXml = StringUtil.escapeXmlEntities(replEscapeLineBreaks())
return "$XML_PREAMBLE<output type=\"$escapeType\">$escapedXml</output>"
}
fun String.replInputAsXml(): String {
val escapedXml = StringUtil.escapeXml(replEscapeLineBreaks())
val escapedXml = StringUtil.escapeXmlEntities(replEscapeLineBreaks())
return "$XML_PREAMBLE<input>$escapedXml</input>"
}
@@ -86,4 +86,4 @@ internal fun URLClassLoader.listLocalUrlsAsFiles(): List<File> {
internal fun <T : Any> List<T>.ensureNotEmpty(error: String): List<T> {
if (this.isEmpty()) throw IllegalStateException(error)
return this
}
}

View File

@@ -63,8 +63,8 @@ private interface ArgsConverter<T> {
}
fun tryConvertSingle(parameter: KParameter, arg: NamedArgument<T>): Result
fun tryConvertVararg(parameter: KParameter, firstArg: NamedArgument<T>, restArgsIt: Iterator<NamedArgument<T>>): Result
fun tryConvertTail(parameter: KParameter, firstArg: NamedArgument<T>, restArgsIt: Iterator<NamedArgument<T>>): Result
fun tryConvertVararg(parameter: KParameter, firstArg: NamedArgument<T>, restArgs: Sequence<NamedArgument<T>>): Result
fun tryConvertTail(parameter: KParameter, firstArg: NamedArgument<T>, restArgs: Sequence<NamedArgument<T>>): Result
}
private enum class ArgsTraversalState { UNNAMED, NAMED, TAIL }
@@ -77,7 +77,7 @@ private fun <T> tryCreateCallableMapping(
val res = mutableMapOf<KParameter, Any?>()
var state = ArgsTraversalState.UNNAMED
val unboundParams = callable.parameters.toMutableList()
val argIt = args.iterator()
val argIt = LookAheadIterator(args.iterator())
while (argIt.hasNext()) {
if (unboundParams.isEmpty()) return null // failed to match: no param left for the arg
val arg = argIt.next()
@@ -102,7 +102,11 @@ private fun <T> tryCreateCallableMapping(
res[par] = cvtRes.v
} else if (par.type.jvmErasure.java.isArray) {
// try vararg
val cvtVRes = converter.tryConvertVararg(par, arg, argIt)
// Collect all the arguments that do not have a name
val unnamed = argIt.sequenceUntil { it.name != null }
val cvtVRes = converter.tryConvertVararg(par, arg, unnamed)
if (cvtVRes is ArgsConverter.Result.Success) {
res[par] = cvtVRes.v
} else return null // failed to match: no suitable param for unnamed arg
@@ -121,7 +125,7 @@ private fun <T> tryCreateCallableMapping(
ArgsTraversalState.TAIL -> {
assert(arg.name == null)
val par = unboundParams.removeAt(unboundParams.lastIndex)
val cvtVRes = converter.tryConvertTail(par, arg, argIt)
val cvtVRes = converter.tryConvertTail(par, arg, argIt.asSequence())
if (cvtVRes is ArgsConverter.Result.Success) {
if (argIt.hasNext()) return null // failed to match: not all tail args are consumed
res[par] = cvtVRes.v
@@ -162,7 +166,7 @@ private class StringArgsConverter : ArgsConverter<String> {
override fun tryConvertVararg(
parameter: KParameter,
firstArg: NamedArgument<String>,
restArgsIt: Iterator<NamedArgument<String>>
restArgs: Sequence<NamedArgument<String>>
): ArgsConverter.Result {
fun convertPrimitivesArray(type: KType, args: Sequence<String?>): Any? =
when (type.classifier) {
@@ -179,7 +183,7 @@ private class StringArgsConverter : ArgsConverter<String> {
val parameterType = parameter.type
if (parameterType.jvmErasure.java.isArray) {
val argsSequence = sequenceOf(firstArg.value) + restArgsIt.asSequence().map { it.value }
val argsSequence = sequenceOf(firstArg.value) + restArgs.map { it.value }
val primArrayArgCandidate = convertPrimitivesArray(parameterType, argsSequence)
if (primArrayArgCandidate != null)
return ArgsConverter.Result.Success(primArrayArgCandidate)
@@ -195,9 +199,9 @@ private class StringArgsConverter : ArgsConverter<String> {
override fun tryConvertTail(
parameter: KParameter,
firstArg: NamedArgument<String>,
restArgsIt: Iterator<NamedArgument<String>>
restArgs: Sequence<NamedArgument<String>>
): ArgsConverter.Result =
tryConvertVararg(parameter, firstArg, restArgsIt)
tryConvertVararg(parameter, firstArg, restArgs)
}
private class AnyArgsConverter : ArgsConverter<Any> {
@@ -218,18 +222,33 @@ private class AnyArgsConverter : ArgsConverter<Any> {
else -> null
}
if (value::class.isSubclassOf(parameter.type.jvmErasure)) return ArgsConverter.Result.Success(value)
fun evaluateValue(arg: Any): Any? {
if (arg::class.isSubclassOf(parameter.type.jvmErasure)) return arg
return convertPrimitivesArray(parameter.type, arg)
}
return convertPrimitivesArray(parameter.type, value)?.let { ArgsConverter.Result.Success(it) }
?: ArgsConverter.Result.Failure
evaluateValue(value)?.let { return ArgsConverter.Result.Success(it) }
// Handle the scenario where [arg::class] is an Array<Any>
// but it's values could all still be valid
val parameterKClass = parameter.type.classifier as? KClass<*>
val arrayComponentType = parameterKClass?.java?.takeIf { it.isArray}?.componentType?.kotlin
if (value is Array<*> && arrayComponentType != null) {
// TODO: Idea! Maybe we should check if the values in the array are compatible with [arrayComponentType]
// if they aren't perhaps we should fail silently
convertAnyArray(arrayComponentType, value.asSequence())?.let(::evaluateValue)?.let { return ArgsConverter.Result.Success(it) }
}
return ArgsConverter.Result.Failure
}
override fun tryConvertVararg(
parameter: KParameter, firstArg: NamedArgument<Any>, restArgsIt: Iterator<NamedArgument<Any>>
parameter: KParameter, firstArg: NamedArgument<Any>, restArgs: Sequence<NamedArgument<Any>>
): ArgsConverter.Result {
val parameterType = parameter.type
if (parameterType.jvmErasure.java.isArray) {
val argsSequence = sequenceOf(firstArg.value) + restArgsIt.asSequence().map { it.value }
val argsSequence = sequenceOf(firstArg.value) + restArgs.map { it.value }
val arrayElementType = parameterType.arguments.firstOrNull()?.type
val arrayArgCandidate = convertAnyArray(arrayElementType?.classifier, argsSequence)
if (arrayArgCandidate != null)
@@ -242,7 +261,7 @@ private class AnyArgsConverter : ArgsConverter<Any> {
override fun tryConvertTail(
parameter: KParameter,
firstArg: NamedArgument<Any>,
restArgsIt: Iterator<NamedArgument<Any>>
restArgs: Sequence<NamedArgument<Any>>
): ArgsConverter.Result =
tryConvertSingle(parameter, firstArg)
}
@@ -266,3 +285,38 @@ private fun <T> convertAnyArrayImpl(classifier: KClassifier?, args: Sequence<T?>
}
return result
}
/*
An iterator that allows us to read the next value without consuming it.
*/
private class LookAheadIterator<T>(private val iterator: Iterator<T>) : Iterator<T> {
private var currentLookAhead: T? = null
override fun hasNext(): Boolean {
return currentLookAhead != null || iterator.hasNext()
}
override fun next(): T {
currentLookAhead?.let { value ->
currentLookAhead = null
return value
}
return iterator.next()
}
fun nextWithoutConsuming(): T {
return currentLookAhead ?: iterator.next().also { currentLookAhead = it }
}
}
/*
Will return a sequence with the values of the iterator until the predicate evaluates to true.
*/
private fun <T> LookAheadIterator<T>.sequenceUntil(predicate: (T) -> Boolean): Sequence<T> = sequence {
while (hasNext()) {
if (predicate(nextWithoutConsuming()))
break
yield(next())
}
}

View File

@@ -6,6 +6,7 @@ plugins {
dependencies {
compile(project(":compiler:cli"))
compile(project(":compiler:ir.serialization.js"))
compileOnly(project(":compiler:ir.tree.persistent"))
runtimeOnly(project(":kotlin-reflect"))
if (Platform[193].orLower()) {
compile(intellijDep()) { includeJars("picocontainer", rootProject = rootProject) }

Some files were not shown because too many files have changed in this diff Show More