Compare commits

...

222 Commits

Author SHA1 Message Date
Nicolay Mitropolsky
4a4eee7b36 JavaClassifierTypeImpl.resolutionResult dropped 2020-06-18 10:34:22 +03:00
Ilya Gorbunov
e13a38a758 Fix OnlyInputType usage in tests where it can be invisible 2020-06-18 09:34:13 +03:00
Jinseong Jeon
9e9ca4953f FIR2IR: coerce to Unit when "when" expr is not effectively exhaustive 2020-06-18 09:23:32 +03:00
Vladimir Ilmov
62dcfcde79 (CoroutineDebugger) -core jar has precedence over -debug
#KT-39412 fixed
 #KT-39648 fixed
2020-06-17 23:48:09 +02:00
Dmitry Petrov
4739adb6dc KT-36992 Do not generate annotations on synthetic accessors
Also, do not generate nullability annotations on synthetic methods.
2020-06-17 23:54:51 +03:00
Steven Schäfer
03651f1dd4 IR: Fix inner class type parameters in IrTypeSystemContext 2020-06-17 22:10:00 +03:00
Alexander Udalov
650469024e Fix expected FQ name in JavaTypeTest.nestedTypes 2020-06-17 19:47:45 +02:00
Alexander Udalov
2be94d9d2f Fix compilation of stdlib when JDK_16 points to JDK 8+ 2020-06-17 19:46:18 +02:00
Georgy Bronnikov
c015463926 IR: remove field fake overrides 2020-06-17 20:02:26 +03:00
Georgy Bronnikov
1bb3f60bad IR: use super qualifier in Java field accesses 2020-06-17 20:02:26 +03:00
Georgy Bronnikov
36f22dafc5 IR: remove field fake override usage
Still a problem: Java static fields.
2020-06-17 20:02:26 +03:00
Ilya Gorbunov
41131e46d7 Shadow addSuppressed member with an extension
#KT-38777
2020-06-17 19:45:15 +03:00
Ilya Gorbunov
95625d0fae Do not place copyrights in stdlib api dump .kt files 2020-06-17 19:45:15 +03:00
Ilya Gorbunov
2fe222e8e7 Add SKIP_DCE_DRIVEN directive in JS-IR tests
Otherwise they fail with a compiler exception:
"An operation is not implemented: SAM conversion"
2020-06-17 19:45:15 +03:00
Ilya Gorbunov
de6154980d Make ReadOnlyProperty and PropertyDelegateProvider fun interfaces 2020-06-17 19:45:15 +03:00
Ilya Gorbunov
d2ea108123 Make Comparator fun interface in Common and JS 2020-06-17 19:45:15 +03:00
Ilya Gorbunov
388e619d90 Increase memory for Kotlin compile daemon to 2200M 2020-06-17 19:37:03 +03:00
Ilya Gorbunov
f3a2ff8646 Advance bootstrap to 1.4.20-dev-710 2020-06-17 19:37:03 +03:00
Alexander Udalov
117aae8a6b Use experimental javaType in full reflect where it's not supported yet
#KT-22936 Fixed
 #KT-34344 Fixed
2020-06-17 18:33:08 +02:00
Alexander Udalov
9e37b62f62 Support KType.javaType in stdlib
#KT-32241 Fixed
2020-06-17 18:33:08 +02:00
Dmitry Savvinov
55595fe2c6 Make sure that commonizer is enabled before adding -no-default-libs argument
^KT-39632 Fixed
2020-06-17 17:51:29 +03:00
Vladimir Ilmov
db127bb414 (CoroutineDebugger) fails to start in gradle mode
#KT-39634 fixed
2020-06-17 15:35:10 +02:00
Sergey Rostov
3d86e92bf5 gradle.kts standalone scripts: show actions inside single notification 2020-06-17 14:30:18 +03:00
Sergey Rostov
64b1cc7fd4 gradle.kts legacy: out of project script notification 2020-06-17 14:30:18 +03:00
Sergey Rostov
cc95c16ac2 minor: rename GradleScriptNotificationProvider 2020-06-17 14:30:18 +03:00
Sergey Rostov
bc16fbf438 gradle.kts: check gradle version before loading from fs cache 2020-06-17 14:30:18 +03:00
Sergey Rostov
7d31d7f20c default scripting support: remove notifications after script definitions update 2020-06-17 14:30:18 +03:00
Sergey Rostov
b9fda902fb gradle.kts: update notification only after caches updated 2020-06-17 14:30:17 +03:00
Sergey Rostov
ce20196006 GradleScriptConfigurationsImportingFeature 2020-06-17 14:30:17 +03:00
Sergey Rostov
631e68c99a gradle.kts postponed loading: hide notifaction right after click on action 2020-06-17 14:30:17 +03:00
Sergey Rostov
ace7ae19b4 gradle.kts standalone scripts: load configuration after switching without prompt 2020-06-17 14:30:17 +03:00
Sergey Rostov
07654b4c0e gradle.kts, minor: cleanup & simplify code 2020-06-17 14:30:17 +03:00
Sergey Rostov
b2e629dceb gradle.kts legacy: don't start loading without prompt on first opening 2020-06-17 14:30:17 +03:00
Sergey Rostov
0234678804 gradle.kts: update notifications when scripting support was changed 2020-06-17 14:30:17 +03:00
Sergey Rostov
caa5aadc98 GradleBuildRootsManager: check gradle version change in gradle-wrapper.properties 2020-06-17 14:30:17 +03:00
Sergey Rostov
463908f6f4 scriptConfigurationsNeedToBeUpdatedBalloon registry key 2020-06-17 14:30:17 +03:00
Sergey Rostov
cc67ac631f GradleBuildRootsManager: update notifications in corner cases
- notification for all visible editors should be updates on each change,
since it may depend on last modified ts.
- notifications should be updated only for active editors, not all opened
- we should recheck it on editor activation too
- analyzer should be restarted on roots update only
2020-06-17 14:30:16 +03:00
Sergey Rostov
a150014e74 GradleBuildRootsManager: implement getScriptFirstSeenTs 2020-06-17 14:30:16 +03:00
Sergey Rostov
b543588ccd GradleScriptNotifications: suggest to import and link gradle project 2020-06-17 14:30:16 +03:00
Sergey Rostov
9096d21fcd GradleScriptNotifications: extract and fix i18n strings 2020-06-17 14:30:16 +03:00
Sergey Rostov
632e88459e GradleBuildRootsManager: fix for autoload 2020-06-17 14:30:16 +03:00
Sergey Rostov
de7d82e42b GradleScriptNotifications: typo in code 2020-06-17 14:30:16 +03:00
Sergey Rostov
6f0bd6c122 GradleBuildRoot: ability to detect if file was existed before import 2020-06-17 14:30:16 +03:00
Sergey Rostov
7384c89ddd GradleBuildRootsManager, minor: fix notifications 2020-06-17 14:30:16 +03:00
Sergey Rostov
fd9b14ed29 GradleBuildRoot: require LastModifiedFiles explicitly 2020-06-17 14:30:16 +03:00
Sergey Rostov
2ed68643cb GradleBuildRoot: remove classes nesting 2020-06-17 14:30:15 +03:00
Sergey Rostov
d8892ced9d gradle.kts: standalone scripts support (without ui and persistence) 2020-06-17 14:30:15 +03:00
Sergey Rostov
5ed7abd15d scripting: drop ManualConfigurationLoading and kotlin.gradle.scripts.useIdeaProjectImport registry flag 2020-06-17 14:30:15 +03:00
Sergey Rostov
69dc963f97 LastModifiedFiles: fix concurrency 2020-06-17 14:30:15 +03:00
Sergey Rostov
19cc9c81dc GradleBuildRoot: std scripts under project roots should be treated as new 2020-06-17 14:30:15 +03:00
Sergey Rostov
7b1b50499d GradleBuildRoot: add projects from settings
Fir the cases when they are missed absent in imported data
2020-06-17 14:30:15 +03:00
Sergey Rostov
a3750b6419 GradleBuildRoot: extract GradleBuildRootsLocator for testing 2020-06-17 14:30:15 +03:00
Victor Petukhov
c0f4ee7dc9 Revert "Add missing definitelyDoesNotContainName methods"
This reverts commit b74692e9
2020-06-17 13:16:16 +03:00
Victor Petukhov
447308dcfc Revert "Revert "Revert "Completely rewrite reifiedIntTypeAnalysis, making it more streamline"""
This reverts commit 5567033b
2020-06-17 13:02:40 +03:00
Ilmir Usmanov
1cccceabb9 Revert "Fix merging two reference values"
This reverts commit 85e2392f
2020-06-17 13:02:40 +03:00
Ilmir Usmanov
d9821412d0 Do not generate fields for unused suspend lambda parameters
This also allows us to not spill them in the lambda.
But, disable this optimization for local named functions.

 #KT-16222 In progress
2020-06-17 12:00:25 +02:00
Ilya Chernikov
a292eb865b Add script definition for extension scripts and...
IDE consoles.
2020-06-17 09:37:24 +02:00
Dmitriy Dolovov
1329030281 IDE perf tests for K/N: Re-enable PerformanceNativeProjectsTest 2020-06-17 12:03:39 +07:00
Dmitriy Dolovov
10e5dc1f63 IDE perf tests for K/N: Add assertion on failed Gradle project import 2020-06-17 12:03:33 +07:00
Dmitriy Dolovov
d9e5407ecb IDE perf tests for K/N: Switch to 1.4-M2 2020-06-17 12:03:27 +07:00
Dmitriy Dolovov
439808952d [Commonizer] Fix incorrect merging KLIB dependencies
^KT-39609
2020-06-17 11:38:27 +07:00
Victor Petukhov
901b794af3 Use lexical scope from trace during checking suspend context if the analysis of engaged parent function isn't completed
^KT-39461 Fixed
2020-06-16 22:00:04 +03:00
Dmitry Petrov
02f6a03ff7 JVM_IR: fix nullability annotations on synthetic marker parameters
Synthetic marker parameters (of type
Lkotlin/jvm/internal/DefaultConstructorMarker;) don't have annotations
(including nullability annotations).

Also, for constructor accessors corresponding parameter should be
nullable (since we pass 'null' as an argument there).

KT-36966
2020-06-16 21:29:52 +03:00
Ilya Chernikov
2656eeb164 NI: Optimize some potential hot places 2020-06-16 20:13:58 +03:00
Mikhail Glukhikh
d385a9b29e Add more detailed exception message in KtExpression.isUsedAsExpression 2020-06-16 19:17:29 +03:00
Jinseong Jeon
f64f9c2144 FIR: inherit property accessor modifiers from property and vice versa 2020-06-16 19:17:27 +03:00
Mikhail Glukhikh
6f957c7b31 Provide more accurate clash check in JsDeclarationTable 2020-06-16 19:17:26 +03:00
Mikhail Glukhikh
aaacbaaaec Add KDoc to ObsoleteDescriptorBasedAPI 2020-06-16 19:17:24 +03:00
Mikhail Glukhikh
a035404c96 Mark IrSymbolBase/IrPublicSymbolBase.descriptor as obsolete API 2020-06-16 19:17:22 +03:00
Mikhail Glukhikh
3297237f3d Drop ObsoleteDescriptorBasedAPI in ClassGenerator (module-wide) 2020-06-16 19:17:20 +03:00
Mikhail Glukhikh
175e94c0aa Revert kotlinx-serialization-compiler-plugin OptIn dependency 2020-06-16 19:17:18 +03:00
Mikhail Glukhikh
fe61530357 Declare IrGeneratorContext.builtIns as obsolete descriptor-based API 2020-06-16 19:17:16 +03:00
Mikhail Glukhikh
ab5cb13dae Rename: DescriptorBasedIr -> ObsoleteDescriptorBasedAPI 2020-06-16 19:17:14 +03:00
Mikhail Glukhikh
cbbb497edf Make descriptor-based API in ir:tree more granular 2020-06-16 19:17:12 +03:00
Mikhail Glukhikh
c4b24548cb IrValidator: report errors without rendering descriptors 2020-06-16 19:17:11 +03:00
Mikhail Glukhikh
293df7bd50 [IR BE common] Use Descriptor-based IR only in CheckIrElementVisitor 2020-06-16 19:17:10 +03:00
Mikhail Glukhikh
63394858ac Minor typo fix 2020-06-16 19:17:08 +03:00
Mikhail Glukhikh
e787dbf374 [IR.serialization.jvm] Use Descriptor-based IR in JvmIrLinker only 2020-06-16 19:17:06 +03:00
Mikhail Glukhikh
1c2fbb61fe [IR] Introduce & use declaration-based SymbolTable.withReferenceScope 2020-06-16 19:17:04 +03:00
Mikhail Glukhikh
7a0f986823 [IR] Introduce & use DescriptorBasedIr OptIn 2020-06-16 19:17:03 +03:00
Mikhail Glukhikh
67158caf73 FunctionGenerator: use owner instead of descriptor 2020-06-16 19:17:01 +03:00
Mikhail Glukhikh
41306d25fd JsDeclarationTable: drop descriptors in assertion 2020-06-16 19:16:59 +03:00
Nikolay Krasko
8e8710efec Minor: replace println() with logger 2020-06-16 18:34:40 +03:00
Victor Petukhov
982cbf1148 NI: clear calls info in coroutine inference before the second analysis of += right side
^KT-39376 Fixed
2020-06-16 18:26:59 +03:00
Nikolay Krasko
d3d3b41dea Disable all verification tasks if special option is passed 2020-06-16 18:16:27 +03:00
Ilya Chernikov
74c697af92 Fix SamWithReceiver tests for scripts, add tests...
that use new script definition and ability to load
annotations from script definition
2020-06-16 17:11:33 +02:00
Ilya Chernikov
8fb41e4562 Process compiler plugins and options in scripting compiler
#KT-37766 fixed
2020-06-16 17:11:33 +02:00
Ilya Chernikov
a72eeb800d [minor] Add serialization plugin to kotlin paths 2020-06-16 17:11:33 +02:00
Dmitry Gridin
060b2eaf27 Increase warm-up, test iterations in PerformanceTypingIndentationTest 2020-06-16 20:50:43 +07:00
Mikhail Glukhikh
ca15c33a62 [FIR] Make light tree consistent with raw FIR for empty init case 2020-06-16 15:07:01 +03:00
Ilya Muradyan
9db9e2ad57 Fix build error messages 2020-06-16 13:34:40 +02:00
Yunir Salimzyanov
71f53d49ca Revert: Bootstrap: 1.4.20-dev-498 2020-06-16 13:14:15 +03:00
Mikhail Glukhikh
d9b4e24b29 Exclude JS API dumps from FIR consistency tests 2020-06-16 12:39:26 +03:00
Ilya Goncharov
7b89717092 [Gradle, JS] Add task requirements only after evaluated 2020-06-16 11:57:33 +03:00
Ilya Goncharov
aaf3410708 [Gradle, JS] Break Task Configuration Avoidance to get all required NPM dependencies 2020-06-16 11:57:33 +03:00
Ilya Goncharov
48ec104a34 [Gradle, JS] Store npm dependencies by compilation 2020-06-16 11:57:33 +03:00
Ilya Goncharov
4080bd1325 [Gradle, JS] Move tranform from requiredNpmDependencies to TasksRequirements 2020-06-16 11:57:33 +03:00
Ilya Goncharov
8f156f3609 [Gradle, JS] Extract TasksRequirements.kt 2020-06-16 11:57:33 +03:00
Ilya Goncharov
e51874d46a [Gradle, JS] Use set in task requirements 2020-06-16 11:57:33 +03:00
Ilya Goncharov
464c8eb77a [Gradle, JS] Add kotlin-js-test-runner to dependencies by default 2020-06-16 11:57:33 +03:00
Ilya Goncharov
4a52596344 [Gradle, JS] Remove devServer from common part of legacy 2020-06-16 11:57:32 +03:00
Ilya Goncharov
1f5012684b [Gradle, JS] Force full configuring of NPM tasks in idea import 2020-06-16 11:57:32 +03:00
Ilya Goncharov
aab4fd7225 [Gradle, JS] Use unique representation for npm dependency 2020-06-16 11:57:32 +03:00
Ilya Goncharov
92c224b616 [Gradle, JS] Fix NpmDependency toString 2020-06-16 11:57:32 +03:00
Ilya Goncharov
1a81f02377 [Gradle, JS] Add tools npm dependencies as input to package json task 2020-06-16 11:57:32 +03:00
Ilya Goncharov
d0c0ddd7e5 [Gradle, JS] Move initialization of RequiresNpmDepends in project resolver 2020-06-16 11:57:32 +03:00
Ilya Goncharov
3283a10561 [Gradle, JS] Define compilation on constructor of RequiresNpmDepends 2020-06-16 11:57:32 +03:00
Ilya Goncharov
db42b5b062 [Gradle, JS] Get npm dependencies in compilation npm resolver 2020-06-16 11:57:32 +03:00
Ilya Goncharov
49710c9509 [Gradle, JS] Remove task oriented taskRequirements 2020-06-16 11:57:31 +03:00
Ilya Goncharov
8f679bf1d3 [Gradle, JS] Tools npm dependencies resolved in task execution 2020-06-16 11:57:31 +03:00
Ilya Goncharov
1ab6a9bc84 [Gradle, JS] No NPM tools configuration 2020-06-16 11:57:31 +03:00
Ilya Goncharov
34aff5953f [Gradle, JS] TaskRequirements inside NodeJsRootExtension 2020-06-16 11:57:31 +03:00
Ilya Goncharov
791dfb78ab [Gradle, JS] Dukat only for main compilation 2020-06-16 11:57:31 +03:00
Ilya Goncharov
99e05b777a [Gradle, JS] PackageJsonDukatExecutor -> DukatExecutor 2020-06-16 11:57:31 +03:00
Ilya Goncharov
10c501d474 [Gradle, JS] DukatExecutor -> DukatRunner 2020-06-16 11:57:31 +03:00
Ilya Goncharov
f5db4b12ba [Gradle, JS] Rename of DukatTaskss 2020-06-16 11:57:31 +03:00
Ilya Goncharov
cf65b1f87a [Gradle, JS] Rename on AbstractDukatTask 2020-06-16 11:57:31 +03:00
Ilya Goncharov
9f45ef8df5 [Gradle, JS] Rename DEFAULT_GENERATE_EXTERNALS 2020-06-16 11:57:30 +03:00
Ilya Goncharov
0f47a38042 [Gradle, JS] Enable Dukat by default with false generateExternals 2020-06-16 11:57:30 +03:00
Ilya Goncharov
f285a31a5a [Gradle, JS] Make default generate kotlin externals as false 2020-06-16 11:57:30 +03:00
Ilya Goncharov
2ca0e37be7 [Gradle, JS] Use default generate externals from property 2020-06-16 11:57:30 +03:00
Ilya Goncharov
eb6e797001 [Gradle, JS] In npm dependency extension use default generate value from properties 2020-06-16 11:57:30 +03:00
Ilya Goncharov
6316949e36 [Gradle, JS] Rename generateKotlinExternals on generateExternals 2020-06-16 11:57:30 +03:00
Dmitry Gridin
85840578ad Increase warm-up, test iterations in PerformanceTypingIndentationTest 2020-06-16 15:20:38 +07:00
Dmitriy Dolovov
af1dd6251e [Commonizer] Fallback for const val properties with different values 2020-06-16 15:04:08 +07:00
Yunir Salimzyanov
ee455abe52 Bootstrap: 1.4.20-dev-498
(cherry picked from commit 51d74d78c6)
2020-06-16 10:30:35 +03:00
Yunir Salimzyanov
3766dbff69 Revert "Bootstrap: 1.4.20-dev-498" 2020-06-16 10:01:58 +03:00
Steven Schäfer
846fc13519 JVM IR: Fix inline class constructor ABI (KT-37013, KT-37015) 2020-06-16 09:23:58 +03:00
Abduqodiri Qurbonzoda
b93c49afae Promote ArrayDeque and MutableList.removeFirst/LastOrNull to stable 2020-06-16 04:13:05 +03:00
Alexander Gorshenev
99c5585790 Allow dynamic types in ir fake override substitution arguments 2020-06-16 02:56:46 +03:00
simon.ogorodnik
1a7b30c13a [FIR] Fix incorrect name in anonymous object class id 2020-06-16 00:01:06 +03:00
simon.ogorodnik
2f89ba9499 [FIR] Fix incorrect referential equals on Name instance 2020-06-16 00:01:06 +03:00
Nikita Bobko
cb8addc4cd 202: Fix NPE in BaseKotlinJpsBuildTestCase.tearDown() 2020-06-15 23:22:20 +03:00
Nikolay Krasko
9cac2e1945 Minor: fix splitting the line 2020-06-15 23:22:20 +03:00
Andrei Klunnyi
1b47d538ae Flaky test fix: MultiFileHighlightingTestGenerated
This commit fixes an issue introduced in
AbstractKotlinCodeVisionProviderTest under a3c881da. Global Registry was
mistakenly used to manipulate the state of KotlinCodeVisionProvider. As
a result MultiFileHighlightingTestGenerated became unstable during the
parallel execution.
2020-06-15 19:15:54 +02:00
Yunir Salimzyanov
51d74d78c6 Bootstrap: 1.4.20-dev-498 2020-06-15 17:36:13 +03:00
Ilya Gorbunov
d5ae06e7ed Add run configuration for stdlib-js ApiTest 2020-06-15 17:18:10 +03:00
Ilya Gorbunov
05f9154bdd Use fixed versions of node.js and npm packages in tests 2020-06-15 17:18:10 +03:00
Ilya Chernikov
d7df249480 Convert contributed descriptors to list...
without this `KDocCompletionTestGenerated,testExtensionsFQLink`, which
most likely point to some broken contract in the test.
2020-06-15 16:08:41 +02:00
Kirill Shmakov
a6feae0fbb Add test for KMM Wizard 2020-06-15 16:21:41 +03:00
Kirill Shmakov
a22fb2c1ba Mention downstream usage of new wizard backend 2020-06-15 16:21:41 +03:00
Mikhail Bogdanov
fe4bb24a3e Don't use labels for caching
Avoid new objects creation
2020-06-15 15:13:10 +02:00
Mikhail Bogdanov
db50afeafe Fix compilation with ASM 8
General rule to use linkedLabel or linkWithLabel
  when label from node is reused in other instructions.
  If label is not linked then it will point to another labelNode when visited

  #KT-39013 Fixed
2020-06-15 15:13:10 +02:00
Dmitriy Novozhilov
1186d1affd [FIR-TEST] Count all ConeKotlinErrorType as error types 2020-06-15 15:32:25 +03:00
Dmitriy Novozhilov
d7ee168dff [FIR] Create error candidate for completion instead of simple error reference 2020-06-15 15:32:25 +03:00
Dmitriy Novozhilov
7c57c4a2fb [FIR] Add FirErrorProperty node 2020-06-15 15:32:24 +03:00
Ilya Gorbunov
535534cf66 Allow shadowing member addSuppressed with extension
#KT-38777
2020-06-15 14:41:48 +03:00
Kristoffer Andersen
f0ff8f202c [JVM IR] Use JVM8 support for unsigned int operations
- unmute tests
- add test to ensure JVM target is respected
- add test to cover smart-casted cases
- implement function matching and replacement
- Switching on uint constants
- introduce lowering for standard library replacements
2020-06-15 14:26:28 +03:00
Dmitry Gridin
c95216dc5d KotlinLikeLangLineIndentProvider: cleanup code
Part of #KT-22211
2020-06-15 16:25:58 +07:00
Dmitry Gridin
01707800c1 KotlinLikeLangLineIndentProvider: improve indent for braces
Part of #KT-22211
Part of #KT-39353
2020-06-15 16:25:58 +07:00
Dmitry Gridin
9d6ea3c073 KotlinLikeLangLineIndentProvider: fix options for parentheses
Part of #KT-22211
Part of #KT-39353
2020-06-15 16:25:57 +07:00
Dmitry Gridin
306abc79ed LineIndentProvider: support empty brackets
Part of #KT-22211
Part of #KT-39353
2020-06-15 16:25:57 +07:00
Dmitry Gridin
d69ce74ca5 KotlinLikeLangLineIndentProvider: remove debug function
Part of #KT-22211
2020-06-15 16:25:57 +07:00
Dmitry Gridin
da5b2cfb64 LineIndentProvider: support inside block body between { and first statement/expression
Part of #KT-22211
2020-06-15 16:25:57 +07:00
Dmitry Gridin
63a0b5bfde KotlinLikeLangLineIndentProvider: support braces in blocks
Part of #KT-22211
Part of #KT-39353
2020-06-15 16:25:57 +07:00
Dmitry Gridin
447549f20d LineIndentProvider: support declarations with body expression
Part of #KT-22211
2020-06-15 16:25:56 +07:00
Dmitry Gridin
145b2c260b indentationOnNewLine: sort tests
Part of #KT-22211
2020-06-15 16:25:56 +07:00
Dmitry Gridin
f833b4fe63 LineIndentProvider: support elvis operator
Part of #KT-22211
2020-06-15 16:25:55 +07:00
Dmitry Gridin
cf655a829c KotlinLikeLangLineIndentProvider: support options for parentheses
Part of #KT-22211
Part of #KT-39353
2020-06-15 16:25:55 +07:00
Dmitry Gridin
a8cb6b2ede LineIndentProvider: add options for parentheses
Part of #KT-22211
Part of #KT-39353
2020-06-15 16:25:55 +07:00
Dmitry Gridin
7c99a6fef4 LineIndentProvider: support catch and finally
Part of #KT-22211
2020-06-15 16:25:54 +07:00
Dmitry Gridin
acc15e5fad LineIndentProvider: fix for do-while
Part of #KT-22211
2020-06-15 16:25:54 +07:00
Dmitry Gridin
7a58a59114 Implement EnterBetweenBracesAndBracketsNoCommitDelegate
Part of #KT-22211
Part of #KT-39353
2020-06-15 16:25:54 +07:00
Dmitry Gridin
e72fb755a0 LineIndentProvider: support control flow constructions
Part of #KT-22211
2020-06-15 16:25:54 +07:00
Dmitry Gridin
201b115ee0 Add hack for KotlinMultilineStringEnterHandler
#KT-34566 Fixed
Part of #KT-22211
2020-06-15 16:25:53 +07:00
Dmitry Gridin
8e7bbf1780 LineIndentProvider: add restriction on position
Part of #KT-22211
2020-06-15 16:25:53 +07:00
Dmitry Gridin
c0d7e565bc add debug info
Part of #KT-22211
2020-06-15 16:25:52 +07:00
Dmitry Gridin
29ceb25f5c LineIndentProvider: support string templates
Part of #KT-22211
Relates to #KT-38248
Relates to #KT-35244
2020-06-15 16:25:17 +07:00
Dmitry Gridin
3a6b9c8d08 init line-indent-provider module
Part of #KT-22211
2020-06-15 16:25:16 +07:00
Dmitry Gridin
9d98240272 Create KotlinLineIndentProvider and delegate it to formatter
#KT-22211
2020-06-15 16:24:31 +07:00
Dmitriy Dolovov
0f10faabbf [Commonizer] More precise approximation of callables 2020-06-15 16:11:49 +07:00
Dmitriy Dolovov
205510863a [Commonizer] Stats collector: support aggregated stats 2020-06-15 16:11:34 +07:00
Dmitriy Dolovov
f7ceacb15c [Commonizer] Update stats collector: report receivers & parameters 2020-06-15 16:11:23 +07:00
Dmitriy Dolovov
077853d2ad Minor. Add words to project dictionary 2020-06-15 16:11:15 +07:00
Dmitriy Dolovov
3b4cef1b56 Minor. Rename excludes list 2020-06-15 16:11:06 +07:00
Anton Bannykh
cbabb4f76a JS stdlib api test: various changes
- Setting -Doverwrite.output=true updates gold data
- Big packages don't get split into chunks
- Unique lines in the API are marked with /*∆*/ and diff test is removed
- Annotations on separate lines and other dump format tweaks
- Test data moved to libraries/stdlib/api/
- Minor visibility fix to Enum members
2020-06-15 11:49:15 +03:00
Denis Zharkov
7b61bf9178 FIR: Add nullability smartcast after !is check
^KT-39072 Fixed
2020-06-15 11:33:42 +03:00
Denis Zharkov
24948a8b3f FIR: Fix incorrect handling bare types when subject is type alias
^KT-39043 Fixed
2020-06-15 11:33:42 +03:00
Vyacheslav Gerasimov
063c973eaa Build: Rename empty marker jar to avoid collision with main jar 2020-06-15 00:32:04 +03:00
Vyacheslav Gerasimov
852dcedb86 Build: Remove marker task dependencies from gradle integration tests 2020-06-14 21:04:34 +03:00
Vyacheslav Gerasimov
5689a2c67a Build: Fix kotlin-jsr223-daemon-local-eval-example test runtime 2020-06-14 20:31:29 +03:00
Vyacheslav Gerasimov
38416e7e30 Build: Fix kotlin-compiler-embeddable test runtime 2020-06-14 20:31:29 +03:00
Vyacheslav Gerasimov
ef48c38eb4 Build: Fix kotlin.kotlin-scripting-jsr223-tes test runtime 2020-06-14 20:31:29 +03:00
Vyacheslav Gerasimov
07e18654d9 Build: Fix tests compilation in kotlin.idea.idea-frontend-fir 2020-06-14 20:31:28 +03:00
Vyacheslav Gerasimov
3e3afac407 Build: Fix pom runtime scope for kotlin-klib-commonizer 2020-06-14 20:31:28 +03:00
Vyacheslav Gerasimov
a5e9e1e9be Build: Specify Locale.ROOT for humanReadableName generation 2020-06-14 20:31:28 +03:00
Vyacheslav Gerasimov
567aabeced Build: Fix kotlin-reflect publication 2020-06-14 20:31:28 +03:00
Vyacheslav Gerasimov
b0c9b88485 Build: Disable sha512 checksums generated by maven-publish
They are not handled properly by bintray
https://github.com/gradle/gradle/issues/11412

#KTI-222
2020-06-14 20:31:28 +03:00
Vyacheslav Gerasimov
f9ec4f7d5c Build: Generate human readable project name from gradle project id 2020-06-14 20:31:27 +03:00
Vyacheslav Gerasimov
b4df4e5525 Build: Fix variant resolution ambiguity 2020-06-14 20:31:27 +03:00
Vyacheslav Gerasimov
eeb2f7d3d1 Build: Migrate plugin markers to maven-publish publication 2020-06-14 20:31:27 +03:00
Vyacheslav Gerasimov
da6c2ddb2f Build: Migrate stdlib & kotlin-test to maven-publish publication 2020-06-14 20:31:27 +03:00
Vyacheslav Gerasimov
f4e8c21309 Build: Introduce new software component for publishing
Some of our published modules don't have javaComponent
2020-06-14 20:31:27 +03:00
Vyacheslav Gerasimov
e3111730ac Build: Extract publishing logic to the KotlinBuildPublishingPlugin 2020-06-14 20:31:27 +03:00
Vyacheslav Gerasimov
40dfb2a438 Build: Add additional configuration lambda to the publish helper 2020-06-14 20:31:26 +03:00
Vyacheslav Gerasimov
e3f1ddefd0 Build: Add modularJar helper 2020-06-14 20:31:26 +03:00
Vyacheslav Gerasimov
4925ca2c9a Build: Fix receiver for configure* helpers in commonConfiguration.gradle 2020-06-14 20:31:26 +03:00
Vyacheslav Gerasimov
9faf088c96 Build: Disable automated publishing setup for kotlin-gradle-plugin
We have our own publishing configured in the `publish` helper which
conflicts with automated publishing of `java-gradle-plugin`
2020-06-14 20:31:26 +03:00
Vyacheslav Gerasimov
4aa3040550 Build: Use runtimeOnly instead of deprecated runtime
maven-publish plugin uses `runtimeOnly` for runtime scope instead of
`runtime`
2020-06-14 20:31:26 +03:00
Vyacheslav Gerasimov
8737168d41 Build: Use maven-publish in configurePublishing helper 2020-06-14 20:31:26 +03:00
Vyacheslav Gerasimov
94b4f4a91a Build: Remove configureJvmProject helper for groovy script
It duplicates allprojects configuration done in root project
2020-06-14 20:31:26 +03:00
Vyacheslav Gerasimov
c2589c7d6d Build: Rename javadocJar for groovy to configureJavadocJar
So it doesn't interfere with javadocJar task accessor
2020-06-14 20:31:25 +03:00
Vyacheslav Gerasimov
d711086be2 Build: Publish Kotlin artifacts with maven-publish plugin 2020-06-14 20:31:25 +03:00
Vyacheslav Gerasimov
b85b733e42 Build: Remove explicit legacy maven plugin application 2020-06-14 20:31:25 +03:00
Vyacheslav Gerasimov
410c5f3e69 Build: Remove artifact configuration out of lazy lambda
It may not be executed leading to misconfiguration
2020-06-14 20:31:25 +03:00
Nikita Bobko
b43ff7fbf9 Don't show KDoc references in Call Hierarchy
^KT-39558 Fixed
2020-06-13 17:52:17 +03:00
Alexey Kudravtsev
a79efd0768 filter out references in javadoc to fix IDEA-185139 A method's call hierarchy shows also references 2020-06-13 17:52:16 +03:00
Georgy Bronnikov
89aa15c419 JVM_IR: implement isCompiledToJvm8OrHigher on IrClass 2020-06-13 12:45:00 +03:00
Georgy Bronnikov
8037baf307 IR: add SourceElement reference to IrClass 2020-06-13 12:44:59 +03:00
Georgy Bronnikov
811e8d0f24 JVM_IR: remove one usage of descriptors from AnnotationCodegen 2020-06-13 12:44:59 +03:00
Georgy Bronnikov
58a9c0c996 JVM_IR: remove descriptor usage from IrTypeMapper 2020-06-13 12:44:59 +03:00
Lilia
c875c30f2c Add changelog for 1.4-M2 2020-06-12 14:17:22 +02:00
Alexander Udalov
2bf31ae3c3 IR: minor reformat of IdSignature 2020-06-11 21:42:45 +02:00
Alexander Udalov
d8aee421ac IR: don't store isPublic as field in IdSignature 2020-06-11 21:42:44 +02:00
Alexander Udalov
3154eca218 IR: use String instead of FqName in IdSignature.PublicSignature
FqName/FqNameUnsafe tend to eagerly compute things like
safe/parent/shortName which take a lot of space.

This change helps to lower strongly reachable memory just before codegen
in JVM IR by about 5% on a relatively big project.
2020-06-11 21:42:44 +02:00
Alexander Udalov
d24e136ba8 Minor, make IdSignature.PublicSignature not a data class 2020-06-11 21:42:44 +02:00
Igor Chevdar
8b37a094fe Added a test on possible name clash for SAM wrappers 2020-06-11 23:00:36 +05:00
Igor Chevdar
66bbd3e102 [IR] Improved tuning of SAM wrapper visibility 2020-06-11 23:00:32 +05:00
Nicolay Mitropolsky
1b1e579cbf 201: Uast: fixing KotlinUastGenerationTest by using system-independent inline unaware asRecursiveLogString 2020-06-11 19:34:55 +03:00
Yunir Salimzyanov
b8597b48f1 Fix removed negation in 9b77c2d
KTI-267
2020-06-11 19:06:49 +03:00
Alexander Udalov
01b6142500 Revert changes from 6e67e1e78d in Gradle integration tests
To fix the JPS build.
2020-06-11 17:26:10 +02:00
Nikolay Krasko
5d827d9b5c AS41: Disable all tests in idea-gradle and idea-gradle-native (KTI-281)
There's some problem with searching for Android SDK

junit.framework.AssertionFailedError: Import failed: The showAndGet() method is for modal dialogs only
java.lang.IllegalStateException: The showAndGet() method is for modal dialogs only
	at com.intellij.openapi.ui.DialogWrapper.showAndGet(DialogWrapper.java:1656)
	at com.android.tools.idea.gradle.project.sync.SdkSync$FindValidSdkPathTask.findValidSdkPath(SdkSync.java:263)
	at com.android.tools.idea.gradle.project.sync.SdkSync$FindValidSdkPathTask.lambda$selectValidSdkPath$0(SdkSync.java:254)
	at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:201)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
	at com.intellij.openapi.application.impl.ApplicationImpl.lambda$invokeAndWait$8(ApplicationImpl.java:480)
	at com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvocator.java:124)
	at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:80)
	at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:128)
	at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:46)
	at com.intellij.openapi.application.impl.FlushQueue$FlushNow.run(FlushQueue.java:184)
	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:974)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:847)
	at com.intellij.ide.IdeEventQueue.lambda$null$8(IdeEventQueue.java:449)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:741)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:448)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:496)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

	at junit.framework.Assert.fail(Assert.java:57)
	at junit.framework.TestCase.fail(TestCase.java:227)
	at org.jetbrains.kotlin.idea.codeInsight.gradle.ExternalSystemImportingTestCase.handleImportFailure(ExternalSystemImportingTestCase.java:648)
	at org.jetbrains.kotlin.idea.codeInsight.gradle.ExternalSystemImportingTestCase.doImportProject(ExternalSystemImportingTestCase.java:639)
	at org.jetbrains.kotlin.idea.codeInsight.gradle.ExternalSystemImportingTestCase.importProject(ExternalSystemImportingTestCase.java:465)
	at org.jetbrains.kotlin.idea.codeInsight.gradle.GradleImportingTestCase.importProject(GradleImportingTestCase.kt:234)
	at org.jetbrains.kotlin.ide.konan.gradle.GradleNativeLibrariesInIDENamingTest.testLibrariesNaming(GradleNativeLibrariesInIDENamingTest.kt:35)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.jetbrains.kotlin.test.RunnerFactoryWithMuteInDatabase$createRunnerForTestWithParameters$1$methodInvoker$1.evaluate(muteWithDatabase.kt:236)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.jetbrains.kotlin.test.RunnerFactoryWithMuteInDatabase$createRunnerForTestWithParameters$1.access$runChild$s-1623866647(muteWithDatabase.kt:214)
	at org.jetbrains.kotlin.test.RunnerFactoryWithMuteInDatabase$createRunnerForTestWithParameters$1.runChild(muteWithDatabase.kt:221)
	at org.jetbrains.kotlin.test.RunnerFactoryWithMuteInDatabase$createRunnerForTestWithParameters$1.runChild(muteWithDatabase.kt:214)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
	at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
	at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:118)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
	at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
	at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:412)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
	at java.lang.Thread.run(Thread.java:748)
2020-06-11 17:44:50 +03:00
1367 changed files with 73926 additions and 38562 deletions

View File

@@ -13,6 +13,21 @@
</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>

View File

@@ -11,6 +11,7 @@
<w>protobuf</w>
<w>redirector</w>
<w>remapper</w>
<w>sonatype</w>
<w>unpresent</w>
</words>
</dictionary>

View File

@@ -9,9 +9,11 @@
<w>commonizer</w>
<w>commonizers</w>
<w>commonizes</w>
<w>commonizing</w>
<w>jetbrains</w>
<w>konan</w>
<w>kotlinx</w>
<w>macos</w>
</words>
</dictionary>
</component>

View File

@@ -0,0 +1,21 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test: stdlib-js public kotlin api test, overwrite results" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<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="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":js:js.tests:test" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<GradleScriptDebugEnabled>false</GradleScriptDebugEnabled>
<method v="2" />
</configuration>
</component>

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.*]:*/" />
<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//*" />
</component>

View File

@@ -1,5 +1,466 @@
# CHANGELOG
## 1.4-M2
### Compiler
#### New Features
- [`KT-37432`](https://youtrack.jetbrains.com/issue/KT-37432) Do not include annotations fields into 'visibility must be explicitly specified' check in api mode
#### Performance Improvements
- [`KT-27362`](https://youtrack.jetbrains.com/issue/KT-27362) Anonymous classes representing function/property references contain rarely used methods
- [`KT-35626`](https://youtrack.jetbrains.com/issue/KT-35626) NI: Performance problem with many type parameters
- [`KT-36047`](https://youtrack.jetbrains.com/issue/KT-36047) Compiler produces if-chain instead of switch when when subject captured as variable
- [`KT-36638`](https://youtrack.jetbrains.com/issue/KT-36638) Use 'java/lang/StringBuilder.append (C)Ljava/lang/StringBuilder;' when appending single character in JVM_IR
- [`KT-37389`](https://youtrack.jetbrains.com/issue/KT-37389) Avoid type approximation during generation constraints with EQUALITY kind
- [`KT-37392`](https://youtrack.jetbrains.com/issue/KT-37392) Avoid substitution and type approximation for simple calls
- [`KT-37546`](https://youtrack.jetbrains.com/issue/KT-37546) NI: high memory and CPU consumption due to creating useless captured types (storing in approximated types cache, unneeded computations)
#### Fixes
- [`KT-11265`](https://youtrack.jetbrains.com/issue/KT-11265) Factory pattern and overload resolution ambiguity
- [`KT-27524`](https://youtrack.jetbrains.com/issue/KT-27524) Inline class is boxed when used with suspend modifier
- [`KT-27586`](https://youtrack.jetbrains.com/issue/KT-27586) ClassCastException occurs if the Result (or any other inline class) is returned from a lambda
- [`KT-30419`](https://youtrack.jetbrains.com/issue/KT-30419) Use boxed version of an inline class in return type position for covariant and generic-specialized overrides
- [`KT-31163`](https://youtrack.jetbrains.com/issue/KT-31163) FIR: consider replacing comparisons with compareTo calls and some additional intrinsics
- [`KT-31585`](https://youtrack.jetbrains.com/issue/KT-31585) ClassCastException with derived class delegated to generic class with inline class type argument
- [`KT-31823`](https://youtrack.jetbrains.com/issue/KT-31823) NI: Type mismatch with a star projection and `UnsafeVariance`
- [`KT-33119`](https://youtrack.jetbrains.com/issue/KT-33119) Pre-increment for inline class wrapping Int compiles to direct increment instead of inc-impl
- [`KT-33715`](https://youtrack.jetbrains.com/issue/KT-33715) Kotlin/Native: metadata compiler
- [`KT-34048`](https://youtrack.jetbrains.com/issue/KT-34048) IllegalAccessError when initializing val property in EXACTLY_ONCE lambda
- [`KT-34433`](https://youtrack.jetbrains.com/issue/KT-34433) NI: Type mismatch with a star projection and `UnsafeVariance`
- [`KT-35133`](https://youtrack.jetbrains.com/issue/KT-35133) FIR Java: don't set 'isOperator' for methods with non-operator names
- [`KT-35234`](https://youtrack.jetbrains.com/issue/KT-35234) ClassCastException with creating an inline class from a function reference of covariant or generic-specialized override
- [`KT-35406`](https://youtrack.jetbrains.com/issue/KT-35406) Generic type implicitly inferred as Nothing with no warning
- [`KT-35587`](https://youtrack.jetbrains.com/issue/KT-35587) Plain namespace strings in JvmNameResolver.PREDEFINED_STRINGS are prone to namespace changes during jar relocation.
- [`KT-36044`](https://youtrack.jetbrains.com/issue/KT-36044) NI: premature fixation a type variable if there were nested lambdas (constraint source was the deepest lambda)
- [`KT-36057`](https://youtrack.jetbrains.com/issue/KT-36057) [FIR] Incorrect smartcast
- [`KT-36069`](https://youtrack.jetbrains.com/issue/KT-36069) NI: TYPE_MISMATCH caused by incorrect inference to Nothing
- [`KT-36125`](https://youtrack.jetbrains.com/issue/KT-36125) Callable reference resolution ambiguity error is not displayed properly in the IDE
- [`KT-36191`](https://youtrack.jetbrains.com/issue/KT-36191) IDE locks loading packages and editing file containing `try` keyword inside string template
- [`KT-36222`](https://youtrack.jetbrains.com/issue/KT-36222) NI: Improve error message about nullability mismatch for a generic call
- [`KT-36249`](https://youtrack.jetbrains.com/issue/KT-36249) NI doesn't use upper bound for T of called function during infer return type and as a result infer it to `Any?` if the resulting type was intersection type
- [`KT-36345`](https://youtrack.jetbrains.com/issue/KT-36345) FIR: record argument mapping for use in back-end
- [`KT-36446`](https://youtrack.jetbrains.com/issue/KT-36446) NI: "UnsupportedOperationException no descriptor for type constructor of IntegerLiteralType[Int,Long,Byte,Short]" with BuilderInference and delegate
- [`KT-36758`](https://youtrack.jetbrains.com/issue/KT-36758) [FIR] Unresolved callable reference to member of local class
- [`KT-36759`](https://youtrack.jetbrains.com/issue/KT-36759) [FIR] Unsupported callable reference resolution for methods with default parameters
- [`KT-36762`](https://youtrack.jetbrains.com/issue/KT-36762) [FIR] Unresolved `array.clone()`
- [`KT-36764`](https://youtrack.jetbrains.com/issue/KT-36764) [FIR] Bug in inference with DefinitelyNotNull types
- [`KT-36816`](https://youtrack.jetbrains.com/issue/KT-36816) NI: definitely not-null (T!!) types in invariant positions don't approximate to T inside inference process
- [`KT-36819`](https://youtrack.jetbrains.com/issue/KT-36819) NI: premature completion of lambdas, which are passed somewhere
- [`KT-36850`](https://youtrack.jetbrains.com/issue/KT-36850) Incorrect private visibility of sealed class constructors
- [`KT-36856`](https://youtrack.jetbrains.com/issue/KT-36856) Throwing exception when there is inheritance in Kotlin from Java class, which contains methods with the same JVM descriptors
- [`KT-36879`](https://youtrack.jetbrains.com/issue/KT-36879) Introduce FIR_IDENTICAL in diagnostic tests
- [`KT-36881`](https://youtrack.jetbrains.com/issue/KT-36881) FIR: completion don't runs for return expressions
- [`KT-36887`](https://youtrack.jetbrains.com/issue/KT-36887) [FIR] Unresolved member in nested lambda in initializer
- [`KT-36905`](https://youtrack.jetbrains.com/issue/KT-36905) [FIR] Unresolved in lambda in default argument position
- [`KT-36953`](https://youtrack.jetbrains.com/issue/KT-36953) AssertionError: "Unsigned type expected: null" when there is a range with an unsigned type
- [`KT-37009`](https://youtrack.jetbrains.com/issue/KT-37009) FIR: Bound smart-cast lost
- [`KT-37027`](https://youtrack.jetbrains.com/issue/KT-37027) FIR: Wrong projection on spread + varargs on non-final types
- [`KT-37038`](https://youtrack.jetbrains.com/issue/KT-37038) NI: redundant lambda's arrow breaks CST calculation for extension lambdas
- [`KT-37043`](https://youtrack.jetbrains.com/issue/KT-37043) NI: inference T to Any? if there was elvis between Java out-type and reified `materialize` for this type without out projection
- [`KT-37066`](https://youtrack.jetbrains.com/issue/KT-37066) [FIR] Wrong type inference for lambdas
- [`KT-37070`](https://youtrack.jetbrains.com/issue/KT-37070) [FIR] Unresolved parameters of outer lambda in scope of inner lambda
- [`KT-37087`](https://youtrack.jetbrains.com/issue/KT-37087) "IllegalStateException: Can't find method 'invoke()'" for mutable property reference in default value of an inline function parameter
- [`KT-37091`](https://youtrack.jetbrains.com/issue/KT-37091) [FIR] Wrong inferred type of when-expression if when-argument is not-null-asserted and type is not specifies explicitly
- [`KT-37176`](https://youtrack.jetbrains.com/issue/KT-37176) [FIR] Incorrect resolution mode for statements of block
- [`KT-37302`](https://youtrack.jetbrains.com/issue/KT-37302) Unexpected conversion:`Int` constant inferred to `Long` in when expression
- [`KT-37327`](https://youtrack.jetbrains.com/issue/KT-37327) FIR: Smartcast problem
- [`KT-37343`](https://youtrack.jetbrains.com/issue/KT-37343) NI: definitely not null types pre-approximation is inconsistent with OI
- [`KT-37380`](https://youtrack.jetbrains.com/issue/KT-37380) NI: broken some code with def not null types due to skip needed constraints
- [`KT-37419`](https://youtrack.jetbrains.com/issue/KT-37419) NI: UNRESOLVED_REFERENCE_WRONG_RECEIVER is reported in case lambda with receiver is returned from `when` expression
- [`KT-37434`](https://youtrack.jetbrains.com/issue/KT-37434) Kotlin/JS, Kotlin/Native: fun interfaces: SAM conversion to Kotlin interface is not compiled with RESOLUTION_TO_CLASSIFIER
- [`KT-37447`](https://youtrack.jetbrains.com/issue/KT-37447) Expression from annotation entry in value parameter inside value parameter should be marked as USED_AS_EXPRESSION
- [`KT-37453`](https://youtrack.jetbrains.com/issue/KT-37453) Type arguments not checked to be empty for candidates with no declared parameters
- [`KT-37488`](https://youtrack.jetbrains.com/issue/KT-37488) [FIR] Incorrect exhaustiveness checking for branches with equals to object that implements sealed class
- [`KT-37497`](https://youtrack.jetbrains.com/issue/KT-37497) NI: 'super' is not an expression, it can not be used as a receiver for extension functions
- [`KT-37530`](https://youtrack.jetbrains.com/issue/KT-37530) NI: instantiation of abstract class via callable reference argument causes run time InstantiationError
- [`KT-37531`](https://youtrack.jetbrains.com/issue/KT-37531) NI: callable reference argument with left hand side type parameter causes frontend exception
- [`KT-37554`](https://youtrack.jetbrains.com/issue/KT-37554) NI: Nothing is inferred incorrectly with elvis return
- [`KT-37579`](https://youtrack.jetbrains.com/issue/KT-37579) NI: inconsistent behaviour with OI around implicit invoke convention after safe call with additional implicit receiver
- [`KT-37604`](https://youtrack.jetbrains.com/issue/KT-37604) "VerifyError: Call to wrong <init> method" in 'invoke' for adapted callable reference to constructor with coercion to Unit
- [`KT-37621`](https://youtrack.jetbrains.com/issue/KT-37621) NI: type variable is inferred to Nothing if the second branch was Nothing and there was upper bound for a type parameter
- [`KT-37626`](https://youtrack.jetbrains.com/issue/KT-37626) NI: builder inference with expected type breaks class references resolution for a class with parameters
- [`KT-37627`](https://youtrack.jetbrains.com/issue/KT-37627) NI: wrong order of the type variable fixation (Nothing? against a call with lambda)
- [`KT-37628`](https://youtrack.jetbrains.com/issue/KT-37628) NI: wrong approximation of type argument to star projection during common super type calculation
- [`KT-37644`](https://youtrack.jetbrains.com/issue/KT-37644) NI: appeared exception during incorporation of a captured type into a type variable for elvis resolve
- [`KT-37650`](https://youtrack.jetbrains.com/issue/KT-37650) NI: it's impossible to infer a type variable with the participation of a wrapped covariant type
- [`KT-37718`](https://youtrack.jetbrains.com/issue/KT-37718) False positive unused parameter for @JvmStatic main function in object
- [`KT-37779`](https://youtrack.jetbrains.com/issue/KT-37779) ClassCastException: Named argument without spread operator for vararg parameter causes code to crash on runtime
- [`KT-37832`](https://youtrack.jetbrains.com/issue/KT-37832) In MPP, subtypes of types defined in legacy libraries, like stdlib, cannot properly resolve on the consumer side receviing both
- [`KT-37861`](https://youtrack.jetbrains.com/issue/KT-37861) Capturing an outer class instance in a default parameter of inner class constructor causes VerifyError
- [`KT-37986`](https://youtrack.jetbrains.com/issue/KT-37986) Return value of function reference returning inline class mapped to 'java.lang.Object' is not boxed properly
- [`KT-37998`](https://youtrack.jetbrains.com/issue/KT-37998) '!!' operator on safe call of function returning inline class value causes CCE at runtime
- [`KT-38042`](https://youtrack.jetbrains.com/issue/KT-38042) Allow kotlin.Result as a return type only if one enabled inline classes explicitly
- [`KT-38134`](https://youtrack.jetbrains.com/issue/KT-38134) NI: Type mismatch with a star projection and `UnsafeVariance`
- [`KT-38298`](https://youtrack.jetbrains.com/issue/KT-38298) Inconsistent choice of candidate when both expect/actual are available (affects only `enableGranularSourceSetMetadata`)
- [`KT-38661`](https://youtrack.jetbrains.com/issue/KT-38661) NI: "Cannot infer type variable TypeVariable" with lambda with receiver
- [`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
### Docs & Examples
- [`KT-35231`](https://youtrack.jetbrains.com/issue/KT-35231) toMutableList documentation is vague
### IDE
#### Performance Improvements
- [`KT-30541`](https://youtrack.jetbrains.com/issue/KT-30541) EDT Freeze after new Kotlin Script creation
- [`KT-35050`](https://youtrack.jetbrains.com/issue/KT-35050) Significant freezes due to findSdkAcrossDependencies()
- [`KT-37301`](https://youtrack.jetbrains.com/issue/KT-37301) Freeze when "Optimize Imports" in KotlinImportOptimizer
- [`KT-37466`](https://youtrack.jetbrains.com/issue/KT-37466) Invalidate partialBodyResolveCache on OCB
- [`KT-37467`](https://youtrack.jetbrains.com/issue/KT-37467) PerFileAnalysisCache.fetchAnalysisResults
- [`KT-37993`](https://youtrack.jetbrains.com/issue/KT-37993) Do not resolve references if paste code is located in the same origin
- [`KT-38318`](https://youtrack.jetbrains.com/issue/KT-38318) Freezes in IDEA
#### Fixes
- [`KT-27935`](https://youtrack.jetbrains.com/issue/KT-27935) Functional typealias with typealias in type parameters causes UnsupportedOperationException in TypeSignatureMappingKt (IDEA analysis)
- [`KT-31668`](https://youtrack.jetbrains.com/issue/KT-31668) Complete statement for class declaration: add '()' to supertype
- [`KT-33473`](https://youtrack.jetbrains.com/issue/KT-33473) UAST: References to local variable are resolved to UastKotlinPsiVariable
- [`KT-34564`](https://youtrack.jetbrains.com/issue/KT-34564) Kotlin USimpleNameReferenceExpression for annotation parameter resolves to null for compiled Kotlin classes
- [`KT-34973`](https://youtrack.jetbrains.com/issue/KT-34973) Light class incorrectly claiming ambiguous method call from Java when one overload is synthetic
- [`KT-35801`](https://youtrack.jetbrains.com/issue/KT-35801) UAST: UnknownKotlinExpression for valid Kotlin annotated expression
- [`KT-35804`](https://youtrack.jetbrains.com/issue/KT-35804) UAST: Annotations missing from catch clause parameters
- [`KT-35848`](https://youtrack.jetbrains.com/issue/KT-35848) UAST: ClassCastException when trying to invoke UElement for some wrapped PsiElements
- [`KT-36156`](https://youtrack.jetbrains.com/issue/KT-36156) Kotlin annotation attributes have blue color whereas white in Java
- [`KT-36275`](https://youtrack.jetbrains.com/issue/KT-36275) UAST: UCallExpression::resolve returns null for local function calls
- [`KT-36717`](https://youtrack.jetbrains.com/issue/KT-36717) Fix failing light class tests after switching plugin to language version 1.4
- [`KT-36877`](https://youtrack.jetbrains.com/issue/KT-36877) Message bundles for copy paste are missed in 201
- [`KT-36907`](https://youtrack.jetbrains.com/issue/KT-36907) IDE: `-Xuse-ir` setting on facet level does not affect highlighting
- [`KT-37133`](https://youtrack.jetbrains.com/issue/KT-37133) UAST: Annotating assignment expression sometimes leads to UnknownKotlinExpression
- [`KT-37312`](https://youtrack.jetbrains.com/issue/KT-37312) "Implement members" intention put function in the primary constructor if there are unused brackets in class
- [`KT-37613`](https://youtrack.jetbrains.com/issue/KT-37613) Uast: no parameters in reified method
- [`KT-37933`](https://youtrack.jetbrains.com/issue/KT-37933) Rare NPE in ProjectRootsUtilKt.isKotlinBinary [easy fix]
- [`KT-38081`](https://youtrack.jetbrains.com/issue/KT-38081) Configure kotlin in project produces IDE error "heavy operation and should not be call on AWT thread"
- [`KT-38354`](https://youtrack.jetbrains.com/issue/KT-38354) HMPP. IDE. Dependency leakage from leaf native to shared native module
- [`KT-38634`](https://youtrack.jetbrains.com/issue/KT-38634) IDE: Error on opening MPP project in 1.3.72 after opening it in 1.4-M2
### IDE. Code Style, Formatting
- [`KT-37870`](https://youtrack.jetbrains.com/issue/KT-37870) "Remove trailing comma" action stops working after applying and cancelling it
### IDE. Completion
- [`KT-36808`](https://youtrack.jetbrains.com/issue/KT-36808) Delete Flow.collect from autocompletion list or make it least prioritized
- [`KT-36860`](https://youtrack.jetbrains.com/issue/KT-36860) Provide convenient completion of extension functions from objects
- [`KT-37395`](https://youtrack.jetbrains.com/issue/KT-37395) Invalid callable reference completion of member extension
### IDE. Debugger
- [`KT-34906`](https://youtrack.jetbrains.com/issue/KT-34906) Implement Coroutine Debugger
- [`KT-35392`](https://youtrack.jetbrains.com/issue/KT-35392) Debugger omits meaningful part of the stacktrace even with disabled filter
- [`KT-36215`](https://youtrack.jetbrains.com/issue/KT-36215) Coroutines debugger tab is empty in Android Studio
- [`KT-37238`](https://youtrack.jetbrains.com/issue/KT-37238) Coroutines Debugger: dump creation fails every time
- [`KT-38047`](https://youtrack.jetbrains.com/issue/KT-38047) Coroutines Debugger: Assertion failed: “Should be invoked in manager thread, use DebuggerManagerThreadImpl” on moving to source code from suspended coroutine in project without debugger jar in classpath
- [`KT-38049`](https://youtrack.jetbrains.com/issue/KT-38049) Coroutines Debugger: NPE “null cannot be cast to non-null type com.sun.jdi.ObjectReference” is thrown by calling dumpCoroutines
- [`KT-38487`](https://youtrack.jetbrains.com/issue/KT-38487) Any Field Watch interaction causes a MissingResourceException
### 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-33809`](https://youtrack.jetbrains.com/issue/KT-33809) With `kotlin.mpp.enableGranularSourceSetsMetadata=true`, IDE misses dependsOn-relation between kotlin and android sourceSets, leading to issues with expect/actual matching
- [`KT-36354`](https://youtrack.jetbrains.com/issue/KT-36354) IDE: Gradle import from non-JVM projects: dependency to output artifact is created instead of module dependency
- [`KT-38037`](https://youtrack.jetbrains.com/issue/KT-38037) UnsupportedOperationException on sync gradle Kotlin project with at least two multiplatform modules
### IDE. Gradle. Script
- [`KT-36763`](https://youtrack.jetbrains.com/issue/KT-36763) Drop modification stamp for scripts after project import
- [`KT-37237`](https://youtrack.jetbrains.com/issue/KT-37237) Script configurations should be loaded during project import in case of errors
- [`KT-38041`](https://youtrack.jetbrains.com/issue/KT-38041) Do not request for script configuration after VCS update
### IDE. Inspections and Intentions
#### New Features
- [`KT-3262`](https://youtrack.jetbrains.com/issue/KT-3262) Inspection "Inner class could be nested"
- [`KT-15723`](https://youtrack.jetbrains.com/issue/KT-15723) Add 'Convert to value' quickfix for property containing only getter
- [`KT-34026`](https://youtrack.jetbrains.com/issue/KT-34026) Add "Remove argument" quick fix for redundant argument in constructor call
- [`KT-34332`](https://youtrack.jetbrains.com/issue/KT-34332) Add "Remove argument" quick fix for redundant argument in function call
- [`KT-34450`](https://youtrack.jetbrains.com/issue/KT-34450) `Convert function to property` intention should be also displayed on `fun` keyword
- [`KT-34593`](https://youtrack.jetbrains.com/issue/KT-34593) Invert 'if' condition: Invert `String.isNotEmpty` should be `String.isEmpty`
- [`KT-34819`](https://youtrack.jetbrains.com/issue/KT-34819) Inspection: report useless elvis "?: return null"
- [`KT-37849`](https://youtrack.jetbrains.com/issue/KT-37849) Support `ReplaceWith` for supertypes call
#### Performance Improvements
- [`KT-37515`](https://youtrack.jetbrains.com/issue/KT-37515) Deadlock
#### Fixes
- [`KT-12329`](https://youtrack.jetbrains.com/issue/KT-12329) "invert if" inserts unnecessary 'continue' for statement inside a loop with 'continue'
- [`KT-17615`](https://youtrack.jetbrains.com/issue/KT-17615) "Convert parameter to receiver" changes `this` to `this@ < no name provided >`
- [`KT-20868`](https://youtrack.jetbrains.com/issue/KT-20868) IntelliJ says method from anonymous inner class with inferred interface type is not used even though it is
- [`KT-20907`](https://youtrack.jetbrains.com/issue/KT-20907) Secondary constructor is marked as unused by IDE when called by typealias
- [`KT-22368`](https://youtrack.jetbrains.com/issue/KT-22368) "Convert to block body" intention incorrectly formats closing brace
- [`KT-23510`](https://youtrack.jetbrains.com/issue/KT-23510) "Remove parameter" quick fix keeps lambda argument when it's out of parentheses
- [`KT-27601`](https://youtrack.jetbrains.com/issue/KT-27601) False positive "Unused import directive" for extension function used in KDoc
- [`KT-28085`](https://youtrack.jetbrains.com/issue/KT-28085) "Convert receiver to parameter" introduces incorrect this@class in lambda
- [`KT-30028`](https://youtrack.jetbrains.com/issue/KT-30028) "Convert parameter to receiver" introduces wrong 'this' qualifier for extension lambda receiver
- [`KT-31601`](https://youtrack.jetbrains.com/issue/KT-31601) "Remove redundant let call" changes semantics by introducing multiple safe calls
- [`KT-31800`](https://youtrack.jetbrains.com/issue/KT-31800) False positive "never used" with function in private val object expression
- [`KT-31912`](https://youtrack.jetbrains.com/issue/KT-31912) QF “Convert to anonymous object” do nothing on SAM-interfaces
- [`KT-32561`](https://youtrack.jetbrains.com/issue/KT-32561) "Property can be declared in constructor" causes another warning
- [`KT-32809`](https://youtrack.jetbrains.com/issue/KT-32809) Convert parameter to receiver inserts wrong qualifiers for this (when nothing needs to be changed)
- [`KT-34371`](https://youtrack.jetbrains.com/issue/KT-34371) "Surround with lambda" quickfix is not available for suspend lambda parameters.
- [`KT-34640`](https://youtrack.jetbrains.com/issue/KT-34640) Replace 'if' with 'when' leads to copy comment line above when from another if
- [`KT-36225`](https://youtrack.jetbrains.com/issue/KT-36225) KNPE: CodeInliner.processTypeParameterUsages with `ReplaceWith` for inline reified generic function
- [`KT-36266`](https://youtrack.jetbrains.com/issue/KT-36266) NPE when invoking Lift return out of if/when after intention becomes inapplicable but still beeing shown
- [`KT-36296`](https://youtrack.jetbrains.com/issue/KT-36296) False negative "Redundant SAM-constructor" with multiple SAM arguments
- [`KT-36367`](https://youtrack.jetbrains.com/issue/KT-36367) False negative "Redundant SAM-constructor" for kotlin functions
- [`KT-36368`](https://youtrack.jetbrains.com/issue/KT-36368) False negative "Redundant SAM-constructor" for fun interfaces in kotlin
- [`KT-36395`](https://youtrack.jetbrains.com/issue/KT-36395) False positive "Redundant SAM-constructor" with two java interfaces extending one another
- [`KT-36411`](https://youtrack.jetbrains.com/issue/KT-36411) "Put parameters on separate lines" and "Put parameters on one line" actions do not respect trailing comma
- [`KT-36482`](https://youtrack.jetbrains.com/issue/KT-36482) "Add JvmOverloads annotation" intention is still suggested for annotation's parameters
- [`KT-36686`](https://youtrack.jetbrains.com/issue/KT-36686) Implement members quickfix puts the implementation *before* the data class if it already has a body
- [`KT-36685`](https://youtrack.jetbrains.com/issue/KT-36685) "Convert to a range check" transform hex range to int if it is compared with "Less" or "Greater"
- [`KT-36707`](https://youtrack.jetbrains.com/issue/KT-36707) False positive redundant companion object on calling companion object members
- [`KT-36735`](https://youtrack.jetbrains.com/issue/KT-36735) Inspection 'Replace 'toString' with string template' miss curly braces and generates wrong code for constructor calls
- [`KT-36834`](https://youtrack.jetbrains.com/issue/KT-36834) Convert use-site targets and usages with convert property to fun intention
- [`KT-37213`](https://youtrack.jetbrains.com/issue/KT-37213) "Move to top level" intention does not update imports for extension functions
- [`KT-37496`](https://youtrack.jetbrains.com/issue/KT-37496) False positive "Remove redundant backticks" for multiple underscores variable name
- [`KT-37502`](https://youtrack.jetbrains.com/issue/KT-37502) False positive "redundant lambda arrow" with inline generic function with reified type in object and anonymous parameter name
- [`KT-37508`](https://youtrack.jetbrains.com/issue/KT-37508) "Convert receiver to parameter" breaks code in anonymous objects (this@ < no name provided >)
- [`KT-37576`](https://youtrack.jetbrains.com/issue/KT-37576) Kotlin InspectionSuppressor not being called for the kotlin's inspections
- [`KT-37749`](https://youtrack.jetbrains.com/issue/KT-37749) "Convert to anonymous object" intention is suggested for Java SAM conversion, but not for Kotlin
- [`KT-37781`](https://youtrack.jetbrains.com/issue/KT-37781) "Add modifier" intention/quickfix works incorrectly with functional interfaces
- [`KT-37893`](https://youtrack.jetbrains.com/issue/KT-37893) i18n: Incorrect quickfix name "Lift return out of '"
### IDE. KDoc
- [`KT-37361`](https://youtrack.jetbrains.com/issue/KT-37361) Support for showing rendered doc comments in editor
### IDE. Libraries
- [`KT-36276`](https://youtrack.jetbrains.com/issue/KT-36276) IDE: references to declarations in JavaScript KLib dependency are unresolved
- [`KT-37562`](https://youtrack.jetbrains.com/issue/KT-37562) IDE: references to JavaScript KLib dependency are unresolved, when project and library are compiled with "both" mode
### IDE. Navigation
- [`KT-18472`](https://youtrack.jetbrains.com/issue/KT-18472) UI lockup on find usages
- [`KT-18619`](https://youtrack.jetbrains.com/issue/KT-18619) Find Usages of element used via import alias does not show actual usage location
- [`KT-34088`](https://youtrack.jetbrains.com/issue/KT-34088) Navigate | Implementations action doesn't show implementations of Java methods in Kotlin files if method has parameters referring to generic type
- [`KT-35006`](https://youtrack.jetbrains.com/issue/KT-35006) IDE: "Navigate to inline function call site" from stack trace for nested inline call navigates to outer inline call
- [`KT-36138`](https://youtrack.jetbrains.com/issue/KT-36138) 628 second freeze when doing Find Usages on data class property
- [`KT-36218`](https://youtrack.jetbrains.com/issue/KT-36218) Show Kotlin file members in navigation bar
- [`KT-37494`](https://youtrack.jetbrains.com/issue/KT-37494) AnnotatedElementsSearch unable to find annotated property accessor
### IDE. Project View
- [`KT-32886`](https://youtrack.jetbrains.com/issue/KT-32886) Project tool window: Show Visibility Icons does nothing for Kotlin classes
- [`KT-37632`](https://youtrack.jetbrains.com/issue/KT-37632) IDE error on project structure opening
### IDE. Refactorings
#### Performance Improvements
- [`KT-37801`](https://youtrack.jetbrains.com/issue/KT-37801) Renaming private property with common name is very slow
#### Fixes
- [`KT-22733`](https://youtrack.jetbrains.com/issue/KT-22733) Refactor / Inline Function: fun with type parameter: KNPE at CodeInliner.processTypeParameterUsages()
- [`KT-27389`](https://youtrack.jetbrains.com/issue/KT-27389) MPP: Refactoring "Move Class" does not change the package declaration
- [`KT-29870`](https://youtrack.jetbrains.com/issue/KT-29870) Inline variable doesn't handle 'when' subject val correctly
- [`KT-33045`](https://youtrack.jetbrains.com/issue/KT-33045) Cover Move Refactoring by statistics (FUS)
- [`KT-36071`](https://youtrack.jetbrains.com/issue/KT-36071) Refactoring: Move top declaration implementation refactoring
- [`KT-36072`](https://youtrack.jetbrains.com/issue/KT-36072) Empty files are removed on Refactor/Move action with turned off "Delete empty source files" option
- [`KT-36114`](https://youtrack.jetbrains.com/issue/KT-36114) java.lang.NoClassDefFoundError exception on Refactor/Move of kotlin function if it is referenced in java
- [`KT-36129`](https://youtrack.jetbrains.com/issue/KT-36129) java.lang.Throwable: Invalid file exception occurs on Refactor/Move of class from kotlin script
- [`KT-36382`](https://youtrack.jetbrains.com/issue/KT-36382) Move file refactoring breaks ktor application config
- [`KT-36504`](https://youtrack.jetbrains.com/issue/KT-36504) "Extract property" suggests potentially invalid name for new property
- [`KT-37637`](https://youtrack.jetbrains.com/issue/KT-37637) KotlinChangeSignatureUsageProcessor broke Change Signature in Python plugin
- [`KT-37797`](https://youtrack.jetbrains.com/issue/KT-37797) Useless "Value for new paramater" step in 'Update usages to reflect signature changes' for method with default parameter value
- [`KT-37822`](https://youtrack.jetbrains.com/issue/KT-37822) Improve message "Inline all references and remove the kind"
- [`KT-38348`](https://youtrack.jetbrains.com/issue/KT-38348) UL methods return signature without generic type parameters
- [`KT-38527`](https://youtrack.jetbrains.com/issue/KT-38527) Move nested class to upper level fails silently: MissingResourceException
### IDE. Script
- [`KT-37765`](https://youtrack.jetbrains.com/issue/KT-37765) NCDFE KJvmCompiledModuleInMemory on running `*.main.kts` script
### IDE. Tests Support
- [`KT-36716`](https://youtrack.jetbrains.com/issue/KT-36716) With `kotlin.gradle.testing.enabled=true`, gradle console output gets extra ijLog messages
- [`KT-36910`](https://youtrack.jetbrains.com/issue/KT-36910) There are no Run/Debug actions in context menu for non-JVM platform-specific test results
- [`KT-37037`](https://youtrack.jetbrains.com/issue/KT-37037) [JS, Debug] Node.JS test debug doesn't stop on breakpoints
### IDE. Wizards
#### New Features
- [`KT-36150`](https://youtrack.jetbrains.com/issue/KT-36150) New Project Wizard: provide a way to connect with "dependsOn" relation the added project modules
- [`KT-36179`](https://youtrack.jetbrains.com/issue/KT-36179) New Project Wizard: it's impossible to make a JVM target friendly to Java code in a multiplatform project
#### Fixes
- [`KT-35583`](https://youtrack.jetbrains.com/issue/KT-35583) New Project wizard: don't suggest build systems which cannot be used
- [`KT-35585`](https://youtrack.jetbrains.com/issue/KT-35585) New Project wizard: remember choices which have sense for many projects
- [`KT-35691`](https://youtrack.jetbrains.com/issue/KT-35691) New Project wizard: artifact and group values are effectively ignored
- [`KT-35693`](https://youtrack.jetbrains.com/issue/KT-35693) New Project wizard creates pom.xml / build.gradle referring to release Kotlin version only
- [`KT-36136`](https://youtrack.jetbrains.com/issue/KT-36136) New Project Wizard: generated projects are missing m2 Gradle repository
- [`KT-36137`](https://youtrack.jetbrains.com/issue/KT-36137) New Project Wizard: "multiplatform" shall be written as a single word, without the capital P in the middle
- [`KT-36155`](https://youtrack.jetbrains.com/issue/KT-36155) New Project Wizard: show warning "Multiplatform project cannot be generated" only for MPP projects
- [`KT-36162`](https://youtrack.jetbrains.com/issue/KT-36162) New Project Wizard: make the error messages in modules editor actionable
- [`KT-36163`](https://youtrack.jetbrains.com/issue/KT-36163) New Project Wizard: remove trailing spaces in Android SDK Path automatically
- [`KT-36166`](https://youtrack.jetbrains.com/issue/KT-36166) New Project Wizard: addition of Android target into a multiplatform project doesn't add a necessary minimal Android configuration
- [`KT-36169`](https://youtrack.jetbrains.com/issue/KT-36169) New Project Wizard: Android-related projects failed to build
- [`KT-36176`](https://youtrack.jetbrains.com/issue/KT-36176) New Project Wizard: module templates doesn't work for multiplatform projects
- [`KT-36177`](https://youtrack.jetbrains.com/issue/KT-36177) New Project Wizard: it's impossible to add more than one target of JVM kind to a multiplatform project
- [`KT-36180`](https://youtrack.jetbrains.com/issue/KT-36180) New Project Wizard: it's impossible to set target JVM version for a JVM module
- [`KT-36226`](https://youtrack.jetbrains.com/issue/KT-36226) New Project Wizard: add Mobile Android/iOS project template
- [`KT-36267`](https://youtrack.jetbrains.com/issue/KT-36267) New Project Wizard: flatten JVM targets list for multiplatform projects
- [`KT-36328`](https://youtrack.jetbrains.com/issue/KT-36328) New Project wizard fails for certain templates with AE: "Wrong line separators" at KotlinFormattingModelBuilder.createModel()
- [`KT-37599`](https://youtrack.jetbrains.com/issue/KT-37599) New Project Wizard: Open Kotlin Wizard via hyperlink
- [`KT-37667`](https://youtrack.jetbrains.com/issue/KT-37667) New project wizard: implement new UI design
- [`KT-37674`](https://youtrack.jetbrains.com/issue/KT-37674) Kotlin version in build files includes the IDEA version
- [`KT-38061`](https://youtrack.jetbrains.com/issue/KT-38061) New Project wizard 1.4: do not allow choosing build system if corresponding IJ plugin is disabled
- [`KT-38567`](https://youtrack.jetbrains.com/issue/KT-38567) New Project wizard 1.4+: Improve processing case when project with required path already exists
- [`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
### JS. Tools
- [`KT-36484`](https://youtrack.jetbrains.com/issue/KT-36484) KotlinJS, MPP: Compilation throws "TypeError: b is not a function" only in production mode
### JavaScript
- [`KT-31126`](https://youtrack.jetbrains.com/issue/KT-31126) Invalid JS constructor call (primary ordinary -> secondary external)
- [`KT-35966`](https://youtrack.jetbrains.com/issue/KT-35966) Make @JsExport annotation usable in common code
- [`KT-37128`](https://youtrack.jetbrains.com/issue/KT-37128) KJS: StackOverflowException when using reified recursive bound for type parameter
- [`KT-37163`](https://youtrack.jetbrains.com/issue/KT-37163) KJS: NullPointerException on using intersection type as a reified one
- [`KT-37418`](https://youtrack.jetbrains.com/issue/KT-37418) Support `AssociatedObjectKey` and `findAssociatedObject` in JS IR BE
### Libraries
#### New Features
- [`KT-8658`](https://youtrack.jetbrains.com/issue/KT-8658) Add property delegates which call get/set on the given KProperty instance, e.g. a property reference
- [`KT-12448`](https://youtrack.jetbrains.com/issue/KT-12448) Make `@Suppress` applicable for type parameters
- [`KT-22932`](https://youtrack.jetbrains.com/issue/KT-22932) String.format should support null locale
- [`KT-23514`](https://youtrack.jetbrains.com/issue/KT-23514) assertFailsWith should link unexpected exception as cause
- [`KT-23737`](https://youtrack.jetbrains.com/issue/KT-23737) JS & MPP: Support exception cause and addSuppressed
- [`KT-25651`](https://youtrack.jetbrains.com/issue/KT-25651) Add shuffle() to Array<T>, ByteArray, IntArray, etc to match MutableList
- [`KT-26494`](https://youtrack.jetbrains.com/issue/KT-26494) Create an interface with provideDelegate()
- [`KT-27729`](https://youtrack.jetbrains.com/issue/KT-27729) Inherit `ReadWriteProperty` from `ReadOnlyProperty`
- [`KT-28290`](https://youtrack.jetbrains.com/issue/KT-28290) Add the onEach extension function to the Array
- [`KT-29182`](https://youtrack.jetbrains.com/issue/KT-29182) SIZE_BYTES/BITS for Float and Double
- [`KT-30372`](https://youtrack.jetbrains.com/issue/KT-30372) Add associateWith to Array<T>
- [`KT-33906`](https://youtrack.jetbrains.com/issue/KT-33906) Add vararg overloads for maxOf/minOf functions
- [`KT-34161`](https://youtrack.jetbrains.com/issue/KT-34161) Array.contentEquals/contentHashCode/contentToString should allow null array receiver and argument
- [`KT-35851`](https://youtrack.jetbrains.com/issue/KT-35851) Add setOfNotNull function
- [`KT-36866`](https://youtrack.jetbrains.com/issue/KT-36866) reduceIndexedOrNull
- [`KT-36955`](https://youtrack.jetbrains.com/issue/KT-36955) stdlib: Reverse range and sortDescending range
- [`KT-37161`](https://youtrack.jetbrains.com/issue/KT-37161) Add #onEachIndexed similar to #forEachIndexed
- [`KT-37603`](https://youtrack.jetbrains.com/issue/KT-37603) Throwable.stackTraceToString: string with detailed information about exception
- [`KT-37751`](https://youtrack.jetbrains.com/issue/KT-37751) Implement shuffled() method Sequences
- [`KT-37804`](https://youtrack.jetbrains.com/issue/KT-37804) Add 'fail' in kotlin-test that allows to specify cause
- [`KT-37839`](https://youtrack.jetbrains.com/issue/KT-37839) StringBuilder.appendLine in stdlib-common
- [`KT-37910`](https://youtrack.jetbrains.com/issue/KT-37910) Support Media Source Extension (MSE) and Encrypted Media Extensions (EME) in Kotlin/Js
- [`KT-38044`](https://youtrack.jetbrains.com/issue/KT-38044) Common Throwable.printStackTrace
#### Performance Improvements
- [`KT-37416`](https://youtrack.jetbrains.com/issue/KT-37416) readLine() is very slow
#### Fixes
- [`KT-13887`](https://youtrack.jetbrains.com/issue/KT-13887) Double/Float companion values such as NaN should be constants
- [`KT-14119`](https://youtrack.jetbrains.com/issue/KT-14119) `String.toBoolean()` should be `String?.toBoolean()`
- [`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
### Reflection
- [`KT-29969`](https://youtrack.jetbrains.com/issue/KT-29969) Support optional vararg parameter in `KCallable.callBy`
- [`KT-37707`](https://youtrack.jetbrains.com/issue/KT-37707) "IllegalStateException: superInterface.classLoader must not be null" on class, which implements "AutoCloaseable" interface, "isAccessible" property changing
### Tools. CLI
- [`KT-37090`](https://youtrack.jetbrains.com/issue/KT-37090) file does not exist: `C:\Users\NK\DOWNLO~1\kotlin-compiler-1.3.61\kotlinc\bin\..\lib\kotlin-compiler.jar" from standalone compiler on Windows`
### Tools. Gradle
- [`KT-35447`](https://youtrack.jetbrains.com/issue/KT-35447) Warnings should be piped to stderr when using allWarningsAsErrors = true
- [`KT-35942`](https://youtrack.jetbrains.com/issue/KT-35942) User test Gradle source set code cannot reach out internal members from the production code
- [`KT-36019`](https://youtrack.jetbrains.com/issue/KT-36019) Implement Gradle DSL for explicit API mode
### Tools. Gradle. JS
#### New Features
- [`KT-32017`](https://youtrack.jetbrains.com/issue/KT-32017) Kotlin/JS in MPP: support changing the generated JS file name in Gradle DSL
- [`KT-32721`](https://youtrack.jetbrains.com/issue/KT-32721) [Gradle, JS] CSS Support for browser
- [`KT-36843`](https://youtrack.jetbrains.com/issue/KT-36843) [Gradle, JS, IR] Configure JS Compiler Type through DSL
- [`KT-37207`](https://youtrack.jetbrains.com/issue/KT-37207) Allow to use npm dependency from a local directory
- [`KT-38056`](https://youtrack.jetbrains.com/issue/KT-38056) [Gradle, JS] Group tasks by browser and node
#### Fixes
- [`KT-32466`](https://youtrack.jetbrains.com/issue/KT-32466) kotlinNpmResolve fails in the case of composite build
- [`KT-34468`](https://youtrack.jetbrains.com/issue/KT-34468) Consider custom versions while parsing yarn.lock
- [`KT-36489`](https://youtrack.jetbrains.com/issue/KT-36489) [Gradle, JS, IR]: Correct naming for both compilers
- [`KT-36784`](https://youtrack.jetbrains.com/issue/KT-36784) Kotlin. JS. MPP Cannot find project :js when using Gradle composite builds
- [`KT-36864`](https://youtrack.jetbrains.com/issue/KT-36864) KJS. Composite build require JS plugin in root project
- [`KT-37240`](https://youtrack.jetbrains.com/issue/KT-37240) KJS. Nondeterministic execution order for webpack scripts (from folder 'webpack.config.d')
- [`KT-37582`](https://youtrack.jetbrains.com/issue/KT-37582) Kotlin/JS: KotlinWebpack non-nullable properties are shown as nullable in Gradle configuration
- [`KT-37587`](https://youtrack.jetbrains.com/issue/KT-37587) KJS. Karma ignore dynamically created webpack patches
- [`KT-37635`](https://youtrack.jetbrains.com/issue/KT-37635) [Gradle, JS] Webpack devtool provide enum for only 2 variants
- [`KT-37636`](https://youtrack.jetbrains.com/issue/KT-37636) [Gradle, JS] Extract package.json from klib
- [`KT-37762`](https://youtrack.jetbrains.com/issue/KT-37762) [Gradle, JS] Actualize Node and Yarn versions in 1.4
- [`KT-37988`](https://youtrack.jetbrains.com/issue/KT-37988) [Gradle, JS] Bump NPM versions on 1.4-M2
- [`KT-38051`](https://youtrack.jetbrains.com/issue/KT-38051) [Gradle, JS] browserDistribution doesn't provide outputs
- [`KT-38519`](https://youtrack.jetbrains.com/issue/KT-38519) JS Compiler per project without additional import
### Tools. Gradle. Multiplatform
- [`KT-36674`](https://youtrack.jetbrains.com/issue/KT-36674) `allMetadataJar` task fails if there is an empty intermediate source set in a multiplatform project with native targets
- [`KT-38746`](https://youtrack.jetbrains.com/issue/KT-38746) In HMPP, compilation of a shared-native source set could be mistakenly disabled
- [`KT-39094`](https://youtrack.jetbrains.com/issue/KT-39094) Provide a way to pass custom JVM args to commonizer from Gradle
### Tools. Gradle. Native
- [`KT-25887`](https://youtrack.jetbrains.com/issue/KT-25887) Kotlin Native gradle build fail with `endorsed is not supported. Endorsed standards and standalone APIs` on jdk > 8 & CLion
- [`KT-36721`](https://youtrack.jetbrains.com/issue/KT-36721) Deduce a fully qualified unique_name in klib manifest from something like group name
- [`KT-37730`](https://youtrack.jetbrains.com/issue/KT-37730) Native part of multiplatform build fails with "unresolved reference" errors if there is a local and external module with the same name
- [`KT-38174`](https://youtrack.jetbrains.com/issue/KT-38174) Kotlin/Native: Disable platform libraries generation at the user side by default
### Tools. J2K
#### Fixes
- [`KT-34965`](https://youtrack.jetbrains.com/issue/KT-34965) Convert function reference copied from function call
- [`KT-35593`](https://youtrack.jetbrains.com/issue/KT-35593) New J2K: method's names don't change between functions declared in Number.java and Number.kt
- [`KT-35897`](https://youtrack.jetbrains.com/issue/KT-35897) J2K converts private enum constructors to internal constructors and produces NON_PRIVATE_CONSTRUCTOR_IN_ENUM error
- [`KT-36088`](https://youtrack.jetbrains.com/issue/KT-36088) J2K: StackOverflowError when trying to convert Java class with recursive type bound
- [`KT-36149`](https://youtrack.jetbrains.com/issue/KT-36149) J2K: PsiInvalidElementAccessException: Element class com.intellij.psi.impl.source.tree.CompositeElement of type DOT_QUALIFIED_EXPRESSION
- [`KT-36152`](https://youtrack.jetbrains.com/issue/KT-36152) J2K: RuntimeException: Couldn't get containingKtFile for ktElement
- [`KT-36159`](https://youtrack.jetbrains.com/issue/KT-36159) J2K: ClassCastException if constructor contains a super() call and class extends from Kotlin class
- [`KT-36190`](https://youtrack.jetbrains.com/issue/KT-36190) J2K: Wrong property name generation when getter for non-boolean value starts with 'is'
- [`KT-36891`](https://youtrack.jetbrains.com/issue/KT-36891) j2k: Fail with java.lang.NoClassDefFoundError when converting array
- [`KT-37052`](https://youtrack.jetbrains.com/issue/KT-37052) new J2K: Java private function is converted to `private open` top-level function
- [`KT-37620`](https://youtrack.jetbrains.com/issue/KT-37620) new J2K: IndexOutOfBoundsException (DefaultArgumentsConversion.applyToElement) with overloaded function with vararg parameter
- [`KT-37919`](https://youtrack.jetbrains.com/issue/KT-37919) new J2K: Redundant line feeds when converting function
### Tools. JPS
- [`KT-37159`](https://youtrack.jetbrains.com/issue/KT-37159) A Typo (forgotten space) in build output in Circular dependencies warning description
### Tools. Scripts
- [`KT-30086`](https://youtrack.jetbrains.com/issue/KT-30086) ThreadDeath when running kotlin scripts using jsr223
- [`KT-37558`](https://youtrack.jetbrains.com/issue/KT-37558) Scripts: implicit receivers don't work correctly when using CompiledScriptJarsCache
- [`KT-37823`](https://youtrack.jetbrains.com/issue/KT-37823) Consecutive invocations of main.kts throw a KotlinReflectionNotSupportedError
## 1.4-M1
### Compiler

View File

@@ -28,7 +28,6 @@ buildscript {
bootstrapCompilerClasspath(kotlin("compiler-embeddable", bootstrapKotlinVersion))
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.17")
classpath("com.gradle.publish:plugin-publish-plugin:0.11.0")
classpath(kotlin("gradle-plugin", bootstrapKotlinVersion))
classpath("org.jetbrains.dokka:dokka-gradle-plugin:0.9.17")
}
@@ -325,14 +324,10 @@ val coreLibProjects = listOfNotNull(
val gradlePluginProjects = listOf(
":kotlin-gradle-plugin",
":kotlin-gradle-plugin:plugin-marker",
":kotlin-gradle-plugin-api",
// ":kotlin-gradle-plugin-integration-tests", // TODO: build fails
":kotlin-allopen",
":kotlin-allopen:plugin-marker",
":kotlin-annotation-processing-gradle",
":kotlin-noarg",
":kotlin-noarg:plugin-marker",
":kotlin-sam-with-receiver"
)
@@ -362,7 +357,14 @@ val ignoreTestFailures by extra(project.kotlinBuildProperties.ignoreTestFailures
allprojects {
configurations.maybeCreate("embedded")
configurations.maybeCreate("embedded").apply {
isCanBeConsumed = false
isCanBeResolved = true
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR))
}
}
jvmTarget = defaultJvmTarget
javaHome = defaultJavaHome
@@ -1045,3 +1047,15 @@ val Jar.outputFile: File
val Project.sourceSetsOrNull: SourceSetContainer?
get() = convention.findPlugin(JavaPluginConvention::class.java)?.sourceSets
val disableVerificationTasks = System.getProperty("disable.verification.tasks") == "true"
if (disableVerificationTasks) {
gradle.taskGraph.whenReady {
allTasks.forEach {
if (it is VerificationTask) {
logger.info("DISABLED: '$it'")
it.enabled = false
}
}
}
}

View File

@@ -97,6 +97,7 @@ repositories {
dependencies {
implementation(kotlin("stdlib", embeddedKotlinVersion))
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.17")
implementation("com.gradle.publish:plugin-publish-plugin:0.11.0")
implementation("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")
implementation("net.rubygrapefruit:native-platform-windows-amd64:${property("versions.native-platform")}")

View File

@@ -6,16 +6,28 @@ import org.gradle.api.Task
import org.gradle.api.artifacts.ConfigurablePublishArtifact
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.ConfigurationContainer
import org.gradle.api.artifacts.PublishArtifact
import org.gradle.api.artifacts.component.ProjectComponentIdentifier
import org.gradle.api.attributes.Bundling
import org.gradle.api.attributes.Category
import org.gradle.api.attributes.LibraryElements
import org.gradle.api.attributes.Usage
import org.gradle.api.component.AdhocComponentWithVariants
import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.plugins.BasePluginConvention
import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.plugins.JavaPlugin.*
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.publish.tasks.GenerateModuleMetadata
import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.Upload
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 plugins.KotlinBuildPublishingPlugin
private const val MAGIC_DO_NOT_CHANGE_TEST_JAR_TASK_NAME = "testJar"
@@ -28,7 +40,7 @@ fun Project.testsJar(body: Jar.() -> Unit = {}): Jar {
pluginManager.withPlugin("java") {
from(testSourceSet.output)
}
classifier = "tests"
archiveClassifier.set("tests")
body()
project.addArtifact(testsJarCfg, this, this)
}
@@ -58,20 +70,26 @@ fun Project.noDefaultJar() {
}
}
fun Project.runtimeJarArtifactBy(task: Task, artifactRef: Any, body: ConfigurablePublishArtifact.() -> Unit = {}) {
fun <T : Task> Project.runtimeJarArtifactBy(
task: TaskProvider<T>,
artifactRef: Any,
body: ConfigurablePublishArtifact.() -> Unit = {}
) {
addArtifact("archives", task, artifactRef, body)
addArtifact("runtimeJar", task, artifactRef, body)
configurations.findByName("runtime")?.let {
addArtifact(it, task, artifactRef, body)
addArtifact(it.name, task, artifactRef, body)
}
}
fun Project.runtimeJar(body: Jar.() -> Unit = {}): TaskProvider<Jar> = runtimeJar(getOrCreateTask("jar", body), { })
fun Project.runtimeJar(body: Jar.() -> Unit = {}): TaskProvider<Jar> = runtimeJar(getOrCreateTask("jar", body)) { }
fun <T : Jar> Project.runtimeJar(task: TaskProvider<T>, body: T.() -> Unit = {}): TaskProvider<T> {
tasks.named<Jar>("jar").configure {
removeArtifacts(configurations.getOrCreate("archives"), this)
}
task.configure {
configurations.findByName("embedded")?.let { embedded ->
dependsOn(embedded)
@@ -80,15 +98,37 @@ fun <T : Jar> Project.runtimeJar(task: TaskProvider<T>, body: T.() -> Unit = {})
}
}
setupPublicJar(project.the<BasePluginConvention>().archivesBaseName)
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
body()
project.runtimeJarArtifactBy(this, this)
}
project.runtimeJarArtifactBy(task, task)
val runtimeJar = configurations.maybeCreate("runtimeJar").apply {
isCanBeConsumed = true
isCanBeResolved = false
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.LIBRARY))
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.EXTERNAL))
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR))
}
}
configurePublishedComponent {
withVariantsFromConfiguration(configurations[RUNTIME_ELEMENTS_CONFIGURATION_NAME]) { skip() }
addVariantsFromConfiguration(runtimeJar) { }
}
return task
}
fun Project.sourcesJar(body: Jar.() -> Unit = {}): TaskProvider<Jar> {
val task = tasks.register<Jar>("sourcesJar") {
configure<JavaPluginExtension> {
withSourcesJar()
}
val sourcesJar = getOrCreateTask<Jar>("sourcesJar") {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveClassifier.set("sources")
@@ -112,13 +152,21 @@ fun Project.sourcesJar(body: Jar.() -> Unit = {}): TaskProvider<Jar> {
body()
}
addArtifact("archives", task)
addArtifact("sources", task)
addArtifact("archives", sourcesJar)
addArtifact("sources", sourcesJar)
return task
configurePublishedComponent {
addVariantsFromConfiguration(configurations[SOURCES_ELEMENTS_CONFIGURATION_NAME]) { }
}
return sourcesJar
}
fun Project.javadocJar(body: Jar.() -> Unit = {}): TaskProvider<Jar> {
configure<JavaPluginExtension> {
withJavadocJar()
}
val javadocTask = getOrCreateTask<Jar>("javadocJar") {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveClassifier.set("javadoc")
@@ -130,9 +178,40 @@ fun Project.javadocJar(body: Jar.() -> Unit = {}): TaskProvider<Jar> {
}
addArtifact("archives", javadocTask)
configurePublishedComponent {
addVariantsFromConfiguration(configurations[JAVADOC_ELEMENTS_CONFIGURATION_NAME]) { }
}
return javadocTask
}
fun Project.modularJar(body: Jar.() -> Unit): TaskProvider<Jar> {
val modularJar = configurations.maybeCreate("modularJar").apply {
isCanBeConsumed = true
isCanBeResolved = false
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named("modular-jar"))
}
}
val modularJarTask = getOrCreateTask<Jar>("modularJar") {
archiveClassifier.set("modular")
body()
}
addArtifact("modularJar", modularJarTask)
addArtifact("archives", modularJarTask)
configurePublishedComponent {
addVariantsFromConfiguration(modularJar) { mapToMavenScope("runtime") }
}
return modularJarTask
}
fun Project.standardPublicJars() {
runtimeJar()
@@ -140,7 +219,22 @@ fun Project.standardPublicJars() {
javadocJar()
}
fun Project.publish(body: Upload.() -> Unit = {}): Upload {
fun Project.publish(moduleMetadata: Boolean = false, configure: MavenPublication.() -> Unit = { }) {
apply<KotlinBuildPublishingPlugin>()
if (!moduleMetadata) {
tasks.withType<GenerateModuleMetadata> {
enabled = false
}
}
val publication = extensions.findByType<PublishingExtension>()
?.publications
?.findByName(KotlinBuildPublishingPlugin.PUBLICATION_NAME) as MavenPublication
publication.configure()
}
fun Project.publishWithLegacyMavenPlugin(body: Upload.() -> Unit = {}): Upload {
apply<plugins.PublishedKotlinModule>()
if (artifactsRemovedDiagnosticFlag) {
@@ -236,8 +330,8 @@ fun ConfigurationContainer.getOrCreate(name: String): Configuration = findByName
fun Jar.setupPublicJar(baseName: String, classifier: String = "") {
val buildNumber = project.rootProject.extra["buildNumber"] as String
this.baseName = baseName
this.classifier = classifier
this.archiveBaseName.set(baseName)
this.archiveClassifier.set(classifier)
manifest.attributes.apply {
put("Implementation-Vendor", "JetBrains")
put("Implementation-Title", baseName)
@@ -256,9 +350,26 @@ fun Project.addArtifact(configuration: Configuration, task: Task, artifactRef: A
fun Project.addArtifact(configurationName: String, task: Task, artifactRef: Any, body: ConfigurablePublishArtifact.() -> Unit = {}) =
addArtifact(configurations.getOrCreate(configurationName), task, artifactRef, body)
fun <T : Task> Project.addArtifact(configurationName: String, task: TaskProvider<T>, body: ConfigurablePublishArtifact.() -> Unit = {}) {
fun <T : Task> Project.addArtifact(
configurationName: String,
task: TaskProvider<T>,
body: ConfigurablePublishArtifact.() -> Unit = {}
): PublishArtifact {
configurations.maybeCreate(configurationName)
artifacts.add(configurationName, task, body)
return artifacts.add(configurationName, task, body)
}
fun <T : Task> Project.addArtifact(
configurationName: String,
task: TaskProvider<T>,
artifactRef: Any,
body: ConfigurablePublishArtifact.() -> Unit = {}
): PublishArtifact {
configurations.maybeCreate(configurationName)
return artifacts.add(configurationName, artifactRef) {
builtBy(task)
body()
}
}
fun Project.cleanArtifacts() {
@@ -268,3 +379,6 @@ fun Project.cleanArtifacts() {
}
}
}
fun Project.configurePublishedComponent(configure: AdhocComponentWithVariants.() -> Unit) =
(components.findByName(KotlinBuildPublishingPlugin.ADHOC_COMPONENT_NAME) as AdhocComponentWithVariants?)?.apply(configure)

View File

@@ -0,0 +1,68 @@
/*
* 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 com.gradle.publish.PluginBundleExtension
import com.gradle.publish.PluginConfig
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.tasks.bundling.Jar
import org.gradle.kotlin.dsl.*
import plugins.KotlinBuildPublishingPlugin
internal const val PLUGIN_MARKER_SUFFIX = ".gradle.plugin"
fun Project.publishPluginMarkers(withEmptyJars: Boolean = true) {
val pluginDevelopment = extensions.getByType<PluginBundleExtension>()
val publishingExtension = extensions.getByType<PublishingExtension>()
val mainPublication = publishingExtension.publications[KotlinBuildPublishingPlugin.PUBLICATION_NAME] as MavenPublication
pluginDevelopment.plugins.forEach { declaration ->
val markerPublication = createMavenMarkerPublication(declaration, mainPublication, publishingExtension.publications)
if (withEmptyJars) {
addEmptyJarArtifacts(markerPublication)
}
}
}
fun Project.addEmptyJarArtifacts(publication: MavenPublication) {
val emptyJar = getOrCreateTask<Jar>("emptyJar") {
archiveBaseName.set("empty")
}
publication.artifact(emptyJar.get()) { }
publication.artifact(emptyJar.get()) { classifier = "sources" }
publication.artifact(emptyJar.get()) { classifier = "javadoc" }
}
// Based on code from `java-gradle-plugin`
// https://github.com/gradle/gradle/blob/v6.4.0/subprojects/plugin-development/src/main/java/org/gradle/plugin/devel/plugins/MavenPluginPublishPlugin.java#L84
private fun createMavenMarkerPublication(
declaration: PluginConfig,
coordinates: MavenPublication,
publications: PublicationContainer
): MavenPublication {
return publications.create<MavenPublication>(declaration.name.toString() + "PluginMarkerMaven") {
val pluginId: String = declaration.id
artifactId = pluginId + PLUGIN_MARKER_SUFFIX
groupId = pluginId
pom.withXml {
val root = asElement()
val document = root.ownerDocument
val dependencies = root.appendChild(document.createElement("dependencies"))
val dependency = dependencies.appendChild(document.createElement("dependency"))
val groupId = dependency.appendChild(document.createElement("groupId"))
groupId.textContent = coordinates.groupId
val artifactId = dependency.appendChild(document.createElement("artifactId"))
artifactId.textContent = coordinates.artifactId
val version = dependency.appendChild(document.createElement("version"))
version.textContent = coordinates.version
}
pom.name.set(declaration.displayName)
pom.description.set(declaration.description)
}
}

View File

@@ -0,0 +1,155 @@
/*
* 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 plugins
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.attributes.Usage
import org.gradle.api.component.AdhocComponentWithVariants
import org.gradle.api.component.SoftwareComponentFactory
import org.gradle.api.plugins.JavaBasePlugin
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.kotlin.dsl.*
import org.gradle.plugins.signing.SigningExtension
import org.gradle.plugins.signing.SigningPlugin
import java.util.*
import javax.inject.Inject
class KotlinBuildPublishingPlugin @Inject constructor(
private val componentFactory: SoftwareComponentFactory
) : Plugin<Project> {
override fun apply(target: Project): Unit = with(target) {
apply<MavenPublishPlugin>()
apply<SigningPlugin>()
val publishedRuntime = configurations.maybeCreate(RUNTIME_CONFIGURATION).apply {
isCanBeConsumed = false
isCanBeResolved = false
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
}
}
val publishedCompile = configurations.maybeCreate(COMPILE_CONFIGURATION).apply {
isCanBeConsumed = false
isCanBeResolved = false
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_API))
}
}
val kotlinLibraryComponent = componentFactory.adhoc(ADHOC_COMPONENT_NAME) as AdhocComponentWithVariants
components.add(kotlinLibraryComponent)
kotlinLibraryComponent.addVariantsFromConfiguration(publishedCompile) { mapToMavenScope("compile") }
kotlinLibraryComponent.addVariantsFromConfiguration(publishedRuntime) { mapToMavenScope("runtime") }
pluginManager.withPlugin("java-base") {
val runtimeElements by configurations
val apiElements by configurations
publishedRuntime.extendsFrom(runtimeElements)
publishedCompile.extendsFrom(apiElements)
kotlinLibraryComponent.addVariantsFromConfiguration(runtimeElements) {
mapToMavenScope("runtime")
if (configurationVariant.artifacts.any { JavaBasePlugin.UNPUBLISHABLE_VARIANT_ARTIFACTS.contains(it.type) }) {
skip()
}
}
}
configure<PublishingExtension> {
publications {
create<MavenPublication>(PUBLICATION_NAME) {
from(kotlinLibraryComponent)
pom {
packaging = "jar"
name.set(humanReadableName(project))
description.set(project.description ?: humanReadableName(project))
url.set("https://kotlinlang.org/")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
scm {
url.set("https://github.com/JetBrains/kotlin")
connection.set("scm:git:https://github.com/JetBrains/kotlin.git")
developerConnection.set("scm:git:https://github.com/JetBrains/kotlin.git")
}
developers {
developer {
name.set("Kotlin Team")
organization.set("JetBrains")
organizationUrl.set("https://www.jetbrains.com")
}
}
}
}
}
repositories {
maven {
name = REPOSITORY_NAME
url = file("${project.rootDir}/build/repo").toURI()
}
}
}
configure<SigningExtension> {
setRequired(provider {
project.findProperty("signingRequired")?.toString()?.toBoolean()
?: project.property("isSonatypeRelease") as Boolean
})
sign(extensions.getByType<PublishingExtension>().publications[PUBLICATION_NAME])
}
tasks.register("install") {
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
}
}
}
}
}
}
companion object {
const val PUBLICATION_NAME = "Main"
const val REPOSITORY_NAME = "Maven"
const val ADHOC_COMPONENT_NAME = "kotlinLibrary"
const val COMPILE_CONFIGURATION = "publishedCompile"
const val RUNTIME_CONFIGURATION = "publishedRuntime"
@UseExperimental(ExperimentalStdlibApi::class)
fun humanReadableName(project: Project) =
project.name.split("-").joinToString(separator = " ") { it.capitalize(Locale.ROOT) }
}
}

View File

@@ -31,12 +31,18 @@ open class PublishedKotlinModule : Plugin<Project> {
plugins.apply("maven")
val publishedRuntime by configurations.creating {
configurations.maybeCreate("publishedRuntime").apply {
the<MavenPluginConvention>()
.conf2ScopeMappings
.addMapping(0, this, Conf2ScopeMappingContainer.RUNTIME)
}
configurations.maybeCreate("publishedCompile").apply {
the<MavenPluginConvention>()
.conf2ScopeMappings
.addMapping(0, this, Conf2ScopeMappingContainer.COMPILE)
}
if (!project.hasProperty("prebuiltJar")) {
plugins.apply("signing")

View File

@@ -23,3 +23,15 @@ fun DependencyHandler.publishedRuntime(
): ExternalModuleDependency =
addDependencyTo(this, "publishedRuntime", dependencyNotation, dependencyConfiguration)
val NamedDomainObjectContainer<Configuration>.publishedCompile: NamedDomainObjectProvider<Configuration> get() = named("publishedCompile")
fun DependencyHandler.publishedCompile(dependencyNotation: Any): Dependency? =
add("publishedCompile", dependencyNotation)
fun DependencyHandler.publishedCompile(
dependencyNotation: String,
dependencyConfiguration: Action<ExternalModuleDependency>
): ExternalModuleDependency =
addDependencyTo(this, "publishedCompile", dependencyNotation, dependencyConfiguration)

View File

@@ -52,7 +52,6 @@ import org.jetbrains.kotlin.descriptors.impl.TypeAliasConstructorDescriptor;
import org.jetbrains.kotlin.diagnostics.Errors;
import org.jetbrains.kotlin.lexer.KtTokens;
import org.jetbrains.kotlin.load.java.JvmAbi;
import org.jetbrains.kotlin.resolve.sam.SamConstructorDescriptor;
import org.jetbrains.kotlin.load.kotlin.MethodSignatureMappingKt;
import org.jetbrains.kotlin.load.kotlin.TypeSignatureMappingKt;
import org.jetbrains.kotlin.name.Name;
@@ -77,6 +76,7 @@ import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature;
import org.jetbrains.kotlin.resolve.sam.SamConstructorDescriptor;
import org.jetbrains.kotlin.resolve.scopes.receivers.*;
import org.jetbrains.kotlin.synthetic.SyntheticJavaPropertyDescriptor;
import org.jetbrains.kotlin.types.*;
@@ -1585,7 +1585,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
assert topOfStack == tryWithFinallyBlockStackElement : "Top element of stack doesn't equals processing finally block";
KtTryExpression jetTryExpression = tryWithFinallyBlockStackElement.expression;
Label finallyStart = new Label();
Label finallyStart = linkedLabel();
v.mark(finallyStart);
tryWithFinallyBlockStackElement.addGapLabel(finallyStart);
addGapLabelsForNestedTryCatchWithoutFinally(state, nestedTryBlocksWithoutFinally, finallyStart);

View File

@@ -60,6 +60,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.commons.Method
import org.jetbrains.org.objectweb.asm.tree.LabelNode
import java.util.*
fun generateIsCheck(
@@ -666,3 +667,22 @@ private fun generateLambdaForRunSuspend(
lambdaBuilder.done()
return lambdaBuilder.thisName
}
internal fun LabelNode.linkWithLabel(): LabelNode {
// Remember labelNode in label and vise versa.
// Before ASM 8 there was JB patch in MethodNode that makes such linking in constructor of LabelNode.
//
// protected LabelNode getLabelNode(final Label label) {
// if (!(label.info instanceof LabelNode)) {
// //label.info = new LabelNode(label); //[JB: needed for Coverage agent]
// label.info = new LabelNode(); //ASM 8
// }
// return (LabelNode) label.info;
// }
if (label.info == null) {
label.info = this
}
return this
}
fun linkedLabel(): Label = LabelNode().linkWithLabel().label

View File

@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.codegen.coroutines
import com.intellij.util.ArrayUtil
import org.jetbrains.kotlin.backend.common.CodegenUtil
import org.jetbrains.kotlin.builtins.isSuspendFunctionTypeOrSubtype
import org.jetbrains.kotlin.cfg.index
import org.jetbrains.kotlin.codegen.*
import org.jetbrains.kotlin.codegen.binding.CalculatedClosure
import org.jetbrains.kotlin.codegen.binding.CodegenBinding
@@ -22,6 +23,7 @@ import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.config.isReleaseCoroutines
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor
import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
@@ -229,6 +231,7 @@ class CoroutineCodegenForLambda private constructor(
override fun generateClosureBody() {
for (parameter in allFunctionParameters()) {
if (parameter.isUnused()) continue
val fieldInfo = parameter.getFieldInfoForCoroutineLambdaParameter()
v.newField(
OtherOrigin(parameter),
@@ -241,6 +244,10 @@ class CoroutineCodegenForLambda private constructor(
generateResumeImpl()
}
private fun ParameterDescriptor.isUnused(): Boolean =
originalSuspendFunctionDescriptor is AnonymousFunctionDescriptor &&
bindingContext[BindingContext.SUSPEND_LAMBDA_PARAMETER_USED, originalSuspendFunctionDescriptor to index()] != true
private val generateErasedCreate: Boolean = allFunctionParameters().size <= 1
private val doNotGenerateInvokeBridge: Boolean = !originalSuspendFunctionDescriptor.isLocalSuspendFunctionNotSuspendLambda()
@@ -398,39 +405,41 @@ class CoroutineCodegenForLambda private constructor(
var index = 1
for (parameter in allFunctionParameters()) {
val fieldInfoForCoroutineLambdaParameter = parameter.getFieldInfoForCoroutineLambdaParameter()
if (isBigArity) {
load(cloneIndex, fieldInfoForCoroutineLambdaParameter.ownerType)
load(1, AsmTypes.OBJECT_TYPE)
iconst(index - 1)
aload(AsmTypes.OBJECT_TYPE)
StackValue.coerce(
AsmTypes.OBJECT_TYPE, builtIns.nullableAnyType,
fieldInfoForCoroutineLambdaParameter.fieldType, fieldInfoForCoroutineLambdaParameter.fieldKotlinType,
this
)
putfield(
fieldInfoForCoroutineLambdaParameter.ownerInternalName,
fieldInfoForCoroutineLambdaParameter.fieldName,
fieldInfoForCoroutineLambdaParameter.fieldType.descriptor
)
} else {
if (generateErasedCreate) {
load(index, AsmTypes.OBJECT_TYPE)
if (!parameter.isUnused()) {
if (isBigArity) {
load(cloneIndex, fieldInfoForCoroutineLambdaParameter.ownerType)
load(1, AsmTypes.OBJECT_TYPE)
iconst(index - 1)
aload(AsmTypes.OBJECT_TYPE)
StackValue.coerce(
AsmTypes.OBJECT_TYPE, builtIns.nullableAnyType,
fieldInfoForCoroutineLambdaParameter.fieldType, fieldInfoForCoroutineLambdaParameter.fieldKotlinType,
this
)
putfield(
fieldInfoForCoroutineLambdaParameter.ownerInternalName,
fieldInfoForCoroutineLambdaParameter.fieldName,
fieldInfoForCoroutineLambdaParameter.fieldType.descriptor
)
} else {
load(index, fieldInfoForCoroutineLambdaParameter.fieldType)
if (generateErasedCreate) {
load(index, AsmTypes.OBJECT_TYPE)
StackValue.coerce(
AsmTypes.OBJECT_TYPE, builtIns.nullableAnyType,
fieldInfoForCoroutineLambdaParameter.fieldType, fieldInfoForCoroutineLambdaParameter.fieldKotlinType,
this
)
} else {
load(index, fieldInfoForCoroutineLambdaParameter.fieldType)
}
AsmUtil.genAssignInstanceFieldFromParam(
fieldInfoForCoroutineLambdaParameter,
index,
this,
cloneIndex,
generateErasedCreate
)
}
AsmUtil.genAssignInstanceFieldFromParam(
fieldInfoForCoroutineLambdaParameter,
index,
this,
cloneIndex,
generateErasedCreate
)
}
index += if (isBigArity || generateErasedCreate) 1 else fieldInfoForCoroutineLambdaParameter.fieldType.size
}
@@ -442,6 +451,7 @@ 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)
@@ -463,7 +473,11 @@ class CoroutineCodegenForLambda private constructor(
v.visitLocalVariable(name, mappedType.descriptor, null, label, endLabel, newIndex)
}
initializeVariablesForDestructuredLambdaParameters(this, originalSuspendFunctionDescriptor.valueParameters, endLabel)
initializeVariablesForDestructuredLambdaParameters(
this,
originalSuspendFunctionDescriptor.valueParameters.filter { !it.isUnused() },
endLabel
)
}
private fun allFunctionParameters(): List<ParameterDescriptor> =

View File

@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.codegen.TransformationMethodVisitor
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
@@ -593,7 +594,7 @@ class CoroutineTransformerMethodVisitor(
private fun spillVariables(suspensionPoints: List<SuspensionPoint>, methodNode: MethodNode): List<List<SpilledVariableDescriptor>> {
val instructions = methodNode.instructions
val frames = performSpilledVariableFieldTypesAnalysis(methodNode, containingClassInternalName)
val frames = performRefinedTypeAnalysis(methodNode, containingClassInternalName)
fun AbstractInsnNode.index() = instructions.indexOf(this)
// We postpone these actions because they change instruction indices that we use when obtaining frames
@@ -641,11 +642,11 @@ class CoroutineTransformerMethodVisitor(
.map { Pair(it, frame.getLocal(it)) }
.filter { (index, value) ->
(index == 0 && needDispatchReceiver && isForNamedFunction) ||
(value.type != null && livenessFrame.isAlive(index))
(value != StrictBasicValue.UNINITIALIZED_VALUE && livenessFrame.isAlive(index))
}
for ((index, basicValue) in variablesToSpill) {
if (basicValue.type == NULL_TYPE) {
if (basicValue === StrictBasicValue.NULL_VALUE) {
postponedActions.add {
with(instructions) {
insert(suspension.tryCatchBlockEndLabelAfterSuspensionCall, withInstructionAdapter {
@@ -657,7 +658,7 @@ class CoroutineTransformerMethodVisitor(
continue
}
val type = basicValue.type!!
val type = basicValue.type
val normalizedType = type.normalize()
val indexBySort = varsCountByType[normalizedType]?.plus(1) ?: 0
@@ -741,7 +742,7 @@ class CoroutineTransformerMethodVisitor(
suspendMarkerVarIndex: Int,
suspendPointLineNumber: LineNumberNode?
): LabelNode {
val continuationLabel = LabelNode()
val continuationLabel = LabelNode().linkWithLabel()
val continuationLabelAfterLoadedResult = LabelNode()
val suspendElementLineNumber = lineNumber
var nextLineNumberNode = nextDefinitelyHitLineNumber(suspension)

View File

@@ -18,6 +18,7 @@ import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.tree.*
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
private class PossibleSpilledValue(val source: AbstractInsnNode, type: Type?) : BasicValue(type) {
val usages = mutableSetOf<AbstractInsnNode>()

View File

@@ -1,309 +0,0 @@
/*
* 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.inline.insnOpcodeText
import org.jetbrains.kotlin.codegen.optimization.common.MethodAnalyzer
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.org.objectweb.asm.Handle
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.analysis.Frame
import org.jetbrains.org.objectweb.asm.tree.analysis.Interpreter
import org.jetbrains.org.objectweb.asm.tree.analysis.Value
// 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, update the type of the value.
// StrictBasicValue with mutable type
internal open class SpilledVariableFieldTypeValue(open var type: Type?, val insn: AbstractInsnNode?) : Value {
override fun getSize(): Int = type?.size ?: 1
override fun equals(other: Any?): Boolean = other is SpilledVariableFieldTypeValue && type == other.type && insn == other.insn
override fun hashCode(): Int = (type?.hashCode() ?: 0) xor insn.hashCode()
override fun toString() = if (type == null) "." else "$type"
}
private class MergedSpilledVariableFieldTypeValue(
val values: Set<SpilledVariableFieldTypeValue>
) : SpilledVariableFieldTypeValue(null, null) {
override var type: Type?
get() = values.first().type
set(newType) {
for (value in values) {
value.type = newType
}
}
override fun equals(other: Any?): Boolean = other is MergedSpilledVariableFieldTypeValue && other.values == values
override fun hashCode(): Int = values.hashCode()
override fun toString(): String = "M$values"
}
private operator fun SpilledVariableFieldTypeValue?.plus(other: SpilledVariableFieldTypeValue?): SpilledVariableFieldTypeValue? = when {
this == null -> other
other == null -> this
this == other -> this
this is MergedSpilledVariableFieldTypeValue -> {
if (other is MergedSpilledVariableFieldTypeValue) MergedSpilledVariableFieldTypeValue(values + other.values)
else MergedSpilledVariableFieldTypeValue(values + other)
}
other is MergedSpilledVariableFieldTypeValue -> MergedSpilledVariableFieldTypeValue(other.values + this)
else -> MergedSpilledVariableFieldTypeValue(setOf(this, other))
}
internal val NULL_TYPE = Type.getObjectType("null")
// Same as BasicInterpreter, but updates types based on usages
private class SpilledVariableFieldTypesInterpreter(
private val methodNode: MethodNode
) : Interpreter<SpilledVariableFieldTypeValue>(API_VERSION) {
override fun newValue(type: Type?): SpilledVariableFieldTypeValue? =
if (type == Type.VOID_TYPE) null else SpilledVariableFieldTypeValue(type, null)
// INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC, INVOKEINTERFACE,
// MULTIANEWARRAY and INVOKEDYNAMIC
override fun naryOperation(
insn: AbstractInsnNode,
values: MutableList<out SpilledVariableFieldTypeValue?>
): SpilledVariableFieldTypeValue? {
fun updateTypes(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.isIntType()) {
value.type = argType
} else if (
(value.type == AsmTypes.OBJECT_TYPE && argType != AsmTypes.OBJECT_TYPE) ||
value.type == NULL_TYPE || value.type == null
) {
value.type = argType
}
}
}
return SpilledVariableFieldTypeValue(
when (insn.opcode) {
MULTIANEWARRAY -> {
Type.getType((insn as MultiANewArrayInsnNode).desc)
}
INVOKEDYNAMIC -> {
updateTypes(Type.getArgumentTypes((insn as InvokeDynamicInsnNode).desc), false)
Type.getReturnType(insn.desc)
}
INVOKESTATIC -> {
updateTypes(Type.getArgumentTypes((insn as MethodInsnNode).desc), false)
Type.getReturnType(insn.desc)
}
INVOKEVIRTUAL, INVOKEINTERFACE, INVOKESPECIAL -> {
updateTypes(Type.getArgumentTypes((insn as MethodInsnNode).desc), true)
Type.getReturnType(insn.desc)
}
else -> {
unreachable(insn)
}
}, insn
)
}
private fun Type.isIntType(): Boolean = when (sort) {
Type.BOOLEAN, Type.BYTE, Type.CHAR, Type.SHORT, Type.INT -> true
else -> false
}
private fun unreachable(insn: AbstractInsnNode): Nothing = error("Unreachable instruction ${insn.insnOpcodeText}")
// IASTORE, LASTORE, FASTORE, DASTORE, AASTORE, BASTORE, CASTORE, SASTORE
override fun ternaryOperation(
insn: AbstractInsnNode,
arrayref: SpilledVariableFieldTypeValue?,
index: SpilledVariableFieldTypeValue?,
value: SpilledVariableFieldTypeValue?
): SpilledVariableFieldTypeValue? {
when (insn.opcode) {
IASTORE, LASTORE, FASTORE, DASTORE, AASTORE -> {
// nothing to do
}
BASTORE -> {
value?.type = if (arrayref?.type?.descriptor == "[Z") Type.BOOLEAN_TYPE else Type.BYTE_TYPE
}
CASTORE -> {
value?.type = Type.CHAR_TYPE
}
SASTORE -> {
value?.type = Type.SHORT_TYPE
}
else -> unreachable(insn)
}
return null
}
override fun merge(v: SpilledVariableFieldTypeValue?, w: SpilledVariableFieldTypeValue?): SpilledVariableFieldTypeValue? = when {
v?.type?.isIntType() == true && w?.type?.isIntType() == true -> v + w
v != null && v.type == null -> w
w != null && w.type == null -> v
v?.type == w?.type -> v
v?.type?.sort == Type.OBJECT && w?.type?.sort == Type.OBJECT -> {
when {
v.type == AsmTypes.OBJECT_TYPE -> v
w.type == AsmTypes.OBJECT_TYPE -> w
else -> SpilledVariableFieldTypeValue(AsmTypes.OBJECT_TYPE, v.insn)
}
}
else -> SpilledVariableFieldTypeValue(null, v?.insn ?: w?.insn)
}
// IRETURN, LRETURN, FRETURN, DRETURN, ARETURN
override fun returnOperation(insn: AbstractInsnNode, value: SpilledVariableFieldTypeValue?, expected: SpilledVariableFieldTypeValue?) {
if (insn.opcode == IRETURN) {
value?.type = expected?.type
}
}
// INEG, LNEG, FNEG, DNEG, IINC, I2L, I2F, I2D, L2I, L2F, L2D, F2I, F2L,
// F2D, D2I, D2L, D2F, I2B, I2C, I2S, IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE,
// TABLESWITCH, LOOKUPSWITCH, IRETURN, LRETURN, FRETURN, DRETURN, ARETURN,
// PUTSTATIC, GETFIELD, NEWARRAY, ANEWARRAY, ARRAYLENGTH, ATHROW, CHECKCAST,
// INSTANCEOF, MONITORENTER, MONITOREXIT, IFNULL, IFNONNULL
override fun unaryOperation(insn: AbstractInsnNode, value: SpilledVariableFieldTypeValue?): SpilledVariableFieldTypeValue? =
when (insn.opcode) {
INEG, LNEG, FNEG, DNEG, IINC -> SpilledVariableFieldTypeValue(value?.type, insn)
I2L, F2L, D2L -> SpilledVariableFieldTypeValue(Type.LONG_TYPE, insn)
I2F, L2F, D2F -> SpilledVariableFieldTypeValue(Type.FLOAT_TYPE, insn)
L2D, I2D, F2D -> SpilledVariableFieldTypeValue(Type.DOUBLE_TYPE, insn)
L2I, F2I, D2I, ARRAYLENGTH -> SpilledVariableFieldTypeValue(Type.INT_TYPE, insn)
I2B -> SpilledVariableFieldTypeValue(Type.BYTE_TYPE, insn)
I2C -> SpilledVariableFieldTypeValue(Type.CHAR_TYPE, insn)
I2S -> SpilledVariableFieldTypeValue(Type.SHORT_TYPE, insn)
IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE, TABLESWITCH, LOOKUPSWITCH, IRETURN, LRETURN, FRETURN, DRETURN, ARETURN,
ATHROW, MONITORENTER, MONITOREXIT, IFNULL, IFNONNULL -> null
PUTSTATIC -> {
val expectedType = Type.getType((insn as FieldInsnNode).desc)
if (expectedType.isIntType()) {
value?.type = expectedType
}
null
}
GETFIELD -> SpilledVariableFieldTypeValue(Type.getType((insn as FieldInsnNode).desc), insn)
NEWARRAY -> when ((insn as IntInsnNode).operand) {
T_BOOLEAN -> SpilledVariableFieldTypeValue(Type.getType("[Z"), insn)
T_CHAR -> SpilledVariableFieldTypeValue(Type.getType("[C"), insn)
T_BYTE -> SpilledVariableFieldTypeValue(Type.getType("[B"), insn)
T_SHORT -> SpilledVariableFieldTypeValue(Type.getType("[S"), insn)
T_INT -> SpilledVariableFieldTypeValue(Type.getType("[I"), insn)
T_FLOAT -> SpilledVariableFieldTypeValue(Type.getType("[F"), insn)
T_DOUBLE -> SpilledVariableFieldTypeValue(Type.getType("[D"), insn)
T_LONG -> SpilledVariableFieldTypeValue(Type.getType("[J"), insn)
else -> unreachable(insn)
}
ANEWARRAY -> SpilledVariableFieldTypeValue(Type.getType("[${Type.getObjectType((insn as TypeInsnNode).desc)}"), insn)
CHECKCAST -> SpilledVariableFieldTypeValue(Type.getObjectType((insn as TypeInsnNode).desc), insn)
INSTANCEOF -> SpilledVariableFieldTypeValue(Type.BOOLEAN_TYPE, insn)
else -> unreachable(insn)
}
// IALOAD, LALOAD, FALOAD, DALOAD, AALOAD, BALOAD, CALOAD, SALOAD, IADD,
// LADD, FADD, DADD, ISUB, LSUB, FSUB, DSUB, IMUL, LMUL, FMUL, DMUL, IDIV,
// LDIV, FDIV, DDIV, IREM, LREM, FREM, DREM, ISHL, LSHL, ISHR, LSHR, IUSHR,
// LUSHR, IAND, LAND, IOR, LOR, IXOR, LXOR, LCMP, FCMPL, FCMPG, DCMPL,
// DCMPG, IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE,
// IF_ACMPEQ, IF_ACMPNE, PUTFIELD
override fun binaryOperation(
insn: AbstractInsnNode,
v: SpilledVariableFieldTypeValue?,
w: SpilledVariableFieldTypeValue?
): SpilledVariableFieldTypeValue? =
when (insn.opcode) {
IALOAD, IADD, ISUB, IMUL, IDIV, IREM, ISHL, ISHR, IUSHR, IAND, IOR, IXOR, LCMP, FCMPL, FCMPG, DCMPL,
DCMPG -> SpilledVariableFieldTypeValue(Type.INT_TYPE, insn)
LALOAD, LADD, LSUB, LMUL, LDIV, LREM, LSHL, LSHR, LUSHR, LAND, LOR, LXOR -> SpilledVariableFieldTypeValue(Type.LONG_TYPE, insn)
FALOAD, FADD, FSUB, FMUL, FDIV, FREM -> SpilledVariableFieldTypeValue(Type.FLOAT_TYPE, insn)
DALOAD, DADD, DSUB, DMUL, DDIV, DREM -> SpilledVariableFieldTypeValue(Type.DOUBLE_TYPE, insn)
AALOAD -> SpilledVariableFieldTypeValue(AsmTypes.OBJECT_TYPE, insn)
BALOAD -> SpilledVariableFieldTypeValue(if (v?.type?.descriptor == "[Z") Type.BOOLEAN_TYPE else Type.BYTE_TYPE, insn)
CALOAD -> SpilledVariableFieldTypeValue(Type.CHAR_TYPE, insn)
SALOAD -> SpilledVariableFieldTypeValue(Type.SHORT_TYPE, insn)
IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ACMPEQ, IF_ACMPNE -> null
PUTFIELD -> {
val expectedType = Type.getType((insn as FieldInsnNode).desc)
if (expectedType.isIntType()) {
w?.type = expectedType
}
null
}
else -> unreachable(insn)
}
// ILOAD, LLOAD, FLOAD, DLOAD, ALOAD, ISTORE, LSTORE, FSTORE, DSTORE,
// ASTORE, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, SWAP
override fun copyOperation(insn: AbstractInsnNode, value: SpilledVariableFieldTypeValue?): SpilledVariableFieldTypeValue? =
when (insn.opcode) {
// If same ICONST is stored into several slots, thay can have different types
// For example,
// val b: Byte = 1
// val i: Int = b.toInt()
// In this case, `b` and `i` have the same source, but different types.
// The example also shows, that the types should be `I`.
ISTORE -> SpilledVariableFieldTypeValue(Type.INT_TYPE, insn)
// Sometimes we cannot get the type from the usage only
// For example,
// val c = '1'
// if (c == '2) ...
// In this case, update the type using information from LVT
ILOAD -> {
methodNode.localVariables.find { local ->
local.index == (insn as VarInsnNode).`var` &&
methodNode.instructions.indexOf(local.start) < methodNode.instructions.indexOf(insn) &&
methodNode.instructions.indexOf(insn) < methodNode.instructions.indexOf(local.end)
}?.let { local ->
value?.type = Type.getType(local.desc)
}
value
}
else -> value
}
// ACONST_NULL, ICONST_M1, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4,
// ICONST_5, LCONST_0, LCONST_1, FCONST_0, FCONST_1, FCONST_2, DCONST_0,
// DCONST_1, BIPUSH, SIPUSH, LDC, JSR, GETSTATIC, NEW
override fun newOperation(insn: AbstractInsnNode): SpilledVariableFieldTypeValue? = when (insn.opcode) {
ACONST_NULL -> SpilledVariableFieldTypeValue(NULL_TYPE, insn)
ICONST_M1, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5 -> SpilledVariableFieldTypeValue(Type.INT_TYPE, insn)
LCONST_0, LCONST_1 -> SpilledVariableFieldTypeValue(Type.LONG_TYPE, insn)
FCONST_0, FCONST_1, FCONST_2 -> SpilledVariableFieldTypeValue(Type.FLOAT_TYPE, insn)
DCONST_0, DCONST_1 -> SpilledVariableFieldTypeValue(Type.DOUBLE_TYPE, insn)
BIPUSH -> SpilledVariableFieldTypeValue(Type.BYTE_TYPE, insn)
SIPUSH -> SpilledVariableFieldTypeValue(Type.SHORT_TYPE, insn)
LDC -> when (val cst = (insn as LdcInsnNode).cst) {
is Int -> SpilledVariableFieldTypeValue(Type.INT_TYPE, insn)
is Long -> SpilledVariableFieldTypeValue(Type.LONG_TYPE, insn)
is Float -> SpilledVariableFieldTypeValue(Type.FLOAT_TYPE, insn)
is Double -> SpilledVariableFieldTypeValue(Type.DOUBLE_TYPE, insn)
is String -> SpilledVariableFieldTypeValue(AsmTypes.JAVA_STRING_TYPE, insn)
is Type -> SpilledVariableFieldTypeValue(AsmTypes.JAVA_CLASS_TYPE, insn)
else -> SpilledVariableFieldTypeValue(AsmTypes.OBJECT_TYPE, insn)
}
JSR -> SpilledVariableFieldTypeValue(Type.VOID_TYPE, insn)
GETSTATIC -> SpilledVariableFieldTypeValue(Type.getType((insn as FieldInsnNode).desc), insn)
NEW -> SpilledVariableFieldTypeValue(Type.getObjectType((insn as TypeInsnNode).desc), insn)
else -> unreachable(insn)
}
}
internal fun performSpilledVariableFieldTypesAnalysis(
methodNode: MethodNode,
thisName: String
): Array<out Frame<SpilledVariableFieldTypeValue>?> =
MethodAnalyzer(thisName, methodNode, SpilledVariableFieldTypesInterpreter(methodNode)).analyze()

View File

@@ -0,0 +1,221 @@
/*
* 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.optimization.common.*
import org.jetbrains.kotlin.codegen.optimization.fixStack.peek
import org.jetbrains.kotlin.codegen.optimization.fixStack.top
import org.jetbrains.kotlin.codegen.optimization.transformer.MethodTransformer
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.analysis.BasicValue
import org.jetbrains.org.objectweb.asm.tree.analysis.Frame
import org.jetbrains.org.objectweb.asm.tree.analysis.SourceInterpreter
import org.jetbrains.org.objectweb.asm.tree.analysis.SourceValue
import java.util.*
// 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)
internal fun performRefinedTypeAnalysis(methodNode: MethodNode, thisName: String): Array<out Frame<out BasicValue>?> {
val insnList = methodNode.instructions
val basicFrames = MethodTransformer.analyze(thisName, methodNode, OptimizationBasicInterpreter())
val sourceValueFrames = MethodTransformer.analyze(thisName, methodNode, MySourceInterpreter())
val expectedTypeAndSourcesByInsnIndex: Array<Pair<Type, List<SourceValue>>?> = arrayOfNulls(insnList.size())
fun AbstractInsnNode.index() = insnList.indexOf(this)
fun saveExpectedType(value: SourceValue?, expectedType: Type) {
if (value == null) return
if (expectedType.sort !in REFINED_INT_SORTS) return
for (insn in value.insns) {
// If source is something like ICONST_0, ignore it
if (!insn.isIntLoad()) continue
val index = insnList.indexOf(insn)
checkUpdatedExpectedType(expectedTypeAndSourcesByInsnIndex[index]?.first, expectedType)
expectedTypeAndSourcesByInsnIndex[index] =
Pair(expectedType,
expectedTypeAndSourcesByInsnIndex[index]?.second.orEmpty() + value)
}
}
fun saveExpectedTypeForArrayStore(insn: AbstractInsnNode, sourceValueFrame: Frame<SourceValue>) {
val arrayStoreType =
when (insn.opcode) {
Opcodes.BASTORE -> Type.BYTE_TYPE
Opcodes.CASTORE -> Type.CHAR_TYPE
Opcodes.SASTORE -> Type.SHORT_TYPE
else -> return
}
val insnIndex = insnList.indexOf(insn)
val arrayArg = basicFrames[insnIndex].peek(2)
// may be different from 'arrayStoreType' in case of boolean arrays (BASTORE opcode is also used for them)
val expectedType =
if (arrayArg?.type?.sort == Type.ARRAY)
arrayArg.type.elementType
else
arrayStoreType
saveExpectedType(sourceValueFrame.top(), expectedType)
}
fun saveExpectedTypeForFieldOrMethod(insn: AbstractInsnNode, sourceValueFrame: Frame<SourceValue>) {
when (insn.opcode) {
Opcodes.PUTFIELD, Opcodes.PUTSTATIC ->
saveExpectedType(sourceValueFrame.top(), Type.getType((insn as FieldInsnNode).desc))
Opcodes.INVOKESTATIC, Opcodes.INVOKEVIRTUAL, Opcodes.INVOKEINTERFACE, Opcodes.INVOKESPECIAL -> {
val argumentTypes = Type.getArgumentTypes((insn as MethodInsnNode).desc)
argumentTypes.withIndex().forEach {
val (argIndex, type) = it
saveExpectedType(sourceValueFrame.peek(argumentTypes.size - argIndex - 1), type)
}
}
}
}
fun saveExpectedTypeForVarStore(insn: AbstractInsnNode, sourceValueFrame: Frame<SourceValue>) {
if (insn.isIntStore()) {
val varIndex = (insn as VarInsnNode).`var`
// Considering next insn is important because variable initializer is emitted just before
// the beginning of variable
val nextInsn = InsnSequence(insn.next, insnList.last).firstOrNull(AbstractInsnNode::isMeaningful)
val variableNode =
methodNode.findContainingVariableFromTable(insn, varIndex)
?: methodNode.findContainingVariableFromTable(nextInsn ?: return, varIndex)
?: return
saveExpectedType(sourceValueFrame.top(), Type.getType(variableNode.desc))
}
}
for ((insnIndex, insn) in insnList.toArray().withIndex()) {
assert(insn.opcode != Opcodes.IRETURN) {
"Coroutine body must not contain IRETURN instructions because 'doResume' is always void"
}
val sourceValueFrame = sourceValueFrames[insnIndex] ?: continue
saveExpectedTypeForArrayStore(insn, sourceValueFrame)
saveExpectedTypeForFieldOrMethod(insn, sourceValueFrame)
saveExpectedTypeForVarStore(insn, sourceValueFrame)
}
val refinedVarFrames = analyze(methodNode, object : BackwardAnalysisInterpreter<VarExpectedTypeFrame> {
override fun newFrame(maxLocals: Int): VarExpectedTypeFrame = VarExpectedTypeFrame(maxLocals)
override fun def(frame: VarExpectedTypeFrame, insn: AbstractInsnNode) {
if (insn.isIntStore()) {
frame.expectedTypeByVarIndex[(insn as VarInsnNode).`var`] = null
}
}
override fun use(frame: VarExpectedTypeFrame, insn: AbstractInsnNode) {
val (expectedType, sources) = expectedTypeAndSourcesByInsnIndex[insn.index()] ?: return
sources.flatMap(SourceValue::insns).forEach { insnNode ->
if (insnNode.isIntLoad()) {
frame.updateExpectedType((insnNode as VarInsnNode).`var`, expectedType)
}
}
}
})
return Array(basicFrames.size) {
insnIndex ->
val current = Frame(basicFrames[insnIndex] ?: return@Array null)
refinedVarFrames[insnIndex].expectedTypeByVarIndex.withIndex().filter { it.value != null }.forEach {
assert(current.getLocal(it.index)?.type?.sort in ALL_INT_SORTS) {
"int type expected, but ${current.getLocal(it.index)?.type} was found in basic frames"
}
current.setLocal(it.index, StrictBasicValue(it.value))
}
current
}
}
private fun AbstractInsnNode.isIntLoad() = opcode == Opcodes.ILOAD
private fun AbstractInsnNode.isIntStore() = opcode == Opcodes.ISTORE
private fun checkUpdatedExpectedType(was: Type?, new: Type) {
assert(was == null || was == new) {
"Conflicting expected types: $was/$new"
}
}
private class MySourceInterpreter : SourceInterpreter(Opcodes.API_VERSION) {
override fun copyOperation(insn: AbstractInsnNode, value: SourceValue) =
when {
insn.isStoreOperation() || insn.isLoadOperation() -> SourceValue(value.size, insn)
// For DUP* instructions return the same value (effectively ignore DUP's)
else -> value
}
}
private val REFINED_INT_SORTS = setOf(Type.BOOLEAN, Type.CHAR, Type.BYTE, Type.SHORT)
private val ALL_INT_SORTS = REFINED_INT_SORTS + Type.INT
private fun MethodNode.findContainingVariableFromTable(insn: AbstractInsnNode, varIndex: Int): LocalVariableNode? {
val insnIndex = instructions.indexOf(insn)
return localVariables.firstOrNull {
it.index == varIndex && it.rangeContainsInsn(insnIndex, instructions)
}
}
private fun LocalVariableNode.rangeContainsInsn(insnIndex: Int, insnList: InsnList) =
insnList.indexOf(start) < insnIndex && insnIndex < insnList.indexOf(end)
private class VarExpectedTypeFrame(maxLocals: Int) : VarFrame<VarExpectedTypeFrame> {
val expectedTypeByVarIndex = arrayOfNulls<Type>(maxLocals)
override fun mergeFrom(other: VarExpectedTypeFrame) {
assert(expectedTypeByVarIndex.size == other.expectedTypeByVarIndex.size) {
"Other VarExpectedTypeFrame has different size: ${expectedTypeByVarIndex.size} / ${other.expectedTypeByVarIndex.size}"
}
for ((varIndex, type) in other.expectedTypeByVarIndex.withIndex()) {
updateExpectedType(varIndex, type ?: continue)
}
}
fun updateExpectedType(varIndex: Int, new: Type) {
val was = expectedTypeByVarIndex[varIndex]
// Widening to int is always allowed
if (new == Type.INT_TYPE) return
checkUpdatedExpectedType(was, new)
expectedTypeByVarIndex[varIndex] = new
}
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other == null || other::class.java != this::class.java) return false
other as VarExpectedTypeFrame
if (!Arrays.equals(expectedTypeByVarIndex, other.expectedTypeByVarIndex)) return false
return true
}
override fun hashCode(): Int {
return Arrays.hashCode(expectedTypeByVarIndex)
}
}

View File

@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.codegen.inline
import org.jetbrains.kotlin.codegen.*
import org.jetbrains.kotlin.codegen.linkWithLabel
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
@@ -15,6 +16,7 @@ import org.jetbrains.kotlin.resolve.inline.InlineUtil
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
import org.jetbrains.org.objectweb.asm.Label
import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.tree.LabelNode
import org.jetbrains.org.objectweb.asm.tree.MethodNode
class InlineCodegenForDefaultBody(
@@ -27,7 +29,7 @@ class InlineCodegenForDefaultBody(
) : CallGenerator {
private val sourceMapper: SourceMapper = codegen.parentCodegen.orCreateSourceMapper
private val methodStartLabel = Label()
private val methodStartLabel = linkedLabel()
init {
assert(InlineUtil.isInline(function)) {

View File

@@ -33,6 +33,7 @@ import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.*;
import static org.jetbrains.kotlin.codegen.CodegenUtilKt.linkedLabel;
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.*;
import static org.jetbrains.kotlin.codegen.inline.MethodInlinerUtilKt.getNextMeaningful;
@@ -198,7 +199,7 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
//Creating temp node for finally block copy with some additional instruction
MethodNode finallyBlockCopy = createEmptyMethodNode();
Label newFinallyStart = new Label();
Label insertedBlockEnd = new Label();
Label insertedBlockEnd = linkedLabel();
boolean generateAloadAstore = nonLocalReturnType != Type.VOID_TYPE && !finallyInfo.isEmpty();
if (generateAloadAstore) {

View File

@@ -102,7 +102,7 @@ class MethodInliner(
}
//substitute returns with "goto end" instruction to keep non local returns in lambdas
val end = Label()
val end = linkedLabel()
val isTransformingAnonymousObject = nodeRemapper is RegeneratedLambdaFieldRemapper
transformedNode = doInline(transformedNode)
if (!isTransformingAnonymousObject) {

View File

@@ -30,7 +30,7 @@ class LabelNormalizationMethodTransformer : MethodTransformer() {
private class TransformerForMethod(val methodNode: MethodNode) {
val instructions = methodNode.instructions
val newLabelNodes = SmartIdentityTable<Label, LabelNode>()
val newLabelNodes = SmartIdentityTable<LabelNode, LabelNode>()
fun transform() {
if (rewriteLabelInstructions()) {
@@ -48,11 +48,11 @@ class LabelNormalizationMethodTransformer : MethodTransformer() {
if (thisNode is LabelNode) {
val prevNode = thisNode.previous
if (prevNode is LabelNode) {
newLabelNodes[thisNode.label] = prevNode
newLabelNodes[thisNode] = prevNode
removedAnyLabels = true
thisNode = instructions.removeNodeGetNext(thisNode)
} else {
newLabelNodes[thisNode.label] = thisNode
newLabelNodes[thisNode] = thisNode
thisNode = thisNode.next
}
} else {
@@ -145,12 +145,12 @@ class LabelNormalizationMethodTransformer : MethodTransformer() {
}
private fun getNew(oldLabelNode: LabelNode): LabelNode {
return newLabelNodes[oldLabelNode.label]
return newLabelNodes[oldLabelNode]
?: throw IllegalStateException("Label wasn't found during iterating through instructions")
}
private fun getNewOrOld(oldLabelNode: LabelNode): LabelNode =
newLabelNodes[oldLabelNode.label] ?: oldLabelNode
newLabelNodes[oldLabelNode] ?: oldLabelNode
}
}

View File

@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.codegen.optimization.nullCheck
import org.jetbrains.kotlin.codegen.coroutines.withInstructionAdapter
import org.jetbrains.kotlin.codegen.inline.ReifiedTypeInliner
import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicMethods
import org.jetbrains.kotlin.codegen.linkWithLabel
import org.jetbrains.kotlin.codegen.optimization.common.StrictBasicValue
import org.jetbrains.kotlin.codegen.optimization.common.debugText
import org.jetbrains.kotlin.codegen.optimization.common.isInsn
@@ -269,7 +270,7 @@ class RedundantNullCheckMethodTransformer(private val generationState: Generatio
// <...> -- v is null here
val jumpsIfNull = insn.opcode == Opcodes.IFNULL
val originalLabel = insn.label
val originalLabel = insn.label.linkWithLabel()
originalLabels[insn] = originalLabel
insn.label = synthetic(LabelNode(Label()))
@@ -342,7 +343,7 @@ class RedundantNullCheckMethodTransformer(private val generationState: Generatio
val originalLabel: LabelNode?
val insertAfterNotNull: AbstractInsnNode
if (jumpsIfInstance) {
originalLabel = next.label
originalLabel = next.label.linkWithLabel()
originalLabels[next] = next.label
val newLabel = synthetic(LabelNode(Label()))
methodNode.instructions.add(newLabel)

View File

@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.codegen
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.SourceElement
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
import org.jetbrains.kotlin.load.kotlin.FileBasedKotlinClass
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinarySourceElement
@@ -99,8 +100,10 @@ abstract class TypeAnnotationCollector<T>(val context: TypeSystemCommonBackendCo
abstract fun KotlinTypeMarker.extractAnnotations(): List<T>
fun isCompiledToJvm8OrHigher(descriptor: ClassDescriptor?): Boolean =
(descriptor as? DeserializedClassDescriptor)?.let { classDescriptor ->
((classDescriptor.source as? KotlinJvmBinarySourceElement)?.binaryClass as? FileBasedKotlinClass)?.classVersion ?: 0 >= Opcodes.V1_8
} ?: true
(descriptor as? DeserializedClassDescriptor)?.let { classDescriptor -> isCompiledToJvm8OrHigher(classDescriptor.source) }
?: true
fun isCompiledToJvm8OrHigher(source: SourceElement): Boolean =
(source !is KotlinJvmBinarySourceElement ||
(source.binaryClass as? FileBasedKotlinClass)?.classVersion ?: 0 >= Opcodes.V1_8)
}

View File

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

View File

@@ -77,44 +77,52 @@ object PluginCliParser {
configuration: CompilerConfiguration,
classLoader: URLClassLoader
) {
val optionValuesByPlugin = pluginOptions?.map(::parsePluginOption)?.groupBy {
if (it == null) throw CliOptionProcessingException("Wrong plugin option format: $it, should be ${CommonCompilerArguments.PLUGIN_OPTION_FORMAT}")
it.pluginId
} ?: mapOf()
// TODO issue a warning on using deprecated command line processors when all official plugin migrate to the newer convention
val commandLineProcessors = ServiceLoaderLite.loadImplementations(CommandLineProcessor::class.java, classLoader)
for (processor in commandLineProcessors) {
val declaredOptions = processor.pluginOptions.associateBy { it.optionName }
val optionsToValues = MultiMap<AbstractCliOption, CliOptionValue>()
processCompilerPluginsOptions(configuration, pluginOptions, commandLineProcessors)
}
}
for (optionValue in optionValuesByPlugin[processor.pluginId].orEmpty()) {
val option = declaredOptions[optionValue!!.optionName]
?: throw CliOptionProcessingException("Unsupported plugin option: $optionValue")
optionsToValues.putValue(option, optionValue)
fun processCompilerPluginsOptions(
configuration: CompilerConfiguration,
pluginOptions: Iterable<String>?,
commandLineProcessors: List<CommandLineProcessor>
) {
val optionValuesByPlugin = pluginOptions?.map(::parsePluginOption)?.groupBy {
if (it == null) throw CliOptionProcessingException("Wrong plugin option format: $it, should be ${CommonCompilerArguments.PLUGIN_OPTION_FORMAT}")
it.pluginId
} ?: mapOf()
for (processor in commandLineProcessors) {
val declaredOptions = processor.pluginOptions.associateBy { it.optionName }
val optionsToValues = MultiMap<AbstractCliOption, CliOptionValue>()
for (optionValue in optionValuesByPlugin[processor.pluginId].orEmpty()) {
val option = declaredOptions[optionValue!!.optionName]
?: throw CliOptionProcessingException("Unsupported plugin option: $optionValue")
optionsToValues.putValue(option, optionValue)
}
for (option in processor.pluginOptions) {
val values = optionsToValues[option]
if (option.required && values.isEmpty()) {
throw PluginCliOptionProcessingException(
processor.pluginId,
processor.pluginOptions,
"Required plugin option not present: ${processor.pluginId}:${option.optionName}"
)
}
if (!option.allowMultipleOccurrences && values.size > 1) {
throw PluginCliOptionProcessingException(
processor.pluginId,
processor.pluginOptions,
"Multiple values are not allowed for plugin option ${processor.pluginId}:${option.optionName}"
)
}
for (option in processor.pluginOptions) {
val values = optionsToValues[option]
if (option.required && values.isEmpty()) {
throw PluginCliOptionProcessingException(
processor.pluginId,
processor.pluginOptions,
"Required plugin option not present: ${processor.pluginId}:${option.optionName}"
)
}
if (!option.allowMultipleOccurrences && values.size > 1) {
throw PluginCliOptionProcessingException(
processor.pluginId,
processor.pluginOptions,
"Multiple values are not allowed for plugin option ${processor.pluginId}:${option.optionName}"
)
}
for (value in values) {
processor.processOption(option, value.value, configuration)
}
for (value in values) {
processor.processOption(option, value.value, configuration)
}
}
}

View File

@@ -1,5 +1,3 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
description = "Kotlin Daemon"
plugins {
@@ -21,10 +19,10 @@ dependencies {
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
compileOnly(intellijDep()) { includeJars("trove4j") }
runtime(project(":kotlin-reflect"))
runtimeOnly(project(":kotlin-reflect"))
embedded(project(":daemon-common")) { isTransitive = false }
compile(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) {
api(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) {
isTransitive = false
}
}

View File

@@ -32,8 +32,8 @@ dependencies {
nativePlatformVariants.forEach {
embedded(commonDep("net.rubygrapefruit", "native-platform", "-$it"))
}
runtime(project(":kotlin-reflect"))
compile(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) {
runtimeOnly(project(":kotlin-reflect"))
api(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) {
isTransitive = false
}
}

View File

@@ -16,7 +16,7 @@
package org.jetbrains.kotlin.daemon.client
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.cli.common.messages.OutputMessageUtil
@@ -66,7 +66,7 @@ fun MessageCollector.reportFromDaemon(outputsCollector: ((File, List<File>) -> U
else -> throw IllegalStateException("Unexpected compiler message report severity $severity")
}
if (message != null) {
report(compilerSeverity, message, attachment as? CompilerMessageLocation)
report(compilerSeverity, message, attachment as? CompilerMessageSourceLocation)
}
else {
reportUnexpected(category, severity, message, attachment)

View File

@@ -0,0 +1,19 @@
fun foo(x: Int) {}
interface A
interface B
interface C : A, B
fun bar(x: A) {}
fun bar(x: B) {}
fun test(c: C) {
// Argument mapping error
<!INAPPLICABLE_CANDIDATE!>foo<!>("")
// Ambiguity
<!AMBIGUITY!>bar<!>(c)
// Unresolved reference
<!UNRESOLVED_REFERENCE!>baz<!>()
}

View File

@@ -0,0 +1,18 @@
FILE: errorCandidates.kt
public final fun foo(x: R|kotlin/Int|): R|kotlin/Unit| {
}
public abstract interface A : R|kotlin/Any| {
}
public abstract interface B : R|kotlin/Any| {
}
public abstract interface C : R|A|, R|B| {
}
public final fun bar(x: R|A|): R|kotlin/Unit| {
}
public final fun bar(x: R|B|): R|kotlin/Unit| {
}
public final fun test(c: R|C|): R|kotlin/Unit| {
<Inapplicable(INAPPLICABLE): [/foo]>#(String())
<Ambiguity: bar, [/bar, /bar]>#(R|<local>/c|)
<Unresolved name: baz>#()
}

View File

@@ -272,12 +272,12 @@ digraph flowFromInplaceLambda_kt {
107 [label="Postponed enter to lambda"];
subgraph cluster_14 {
color=blue
126 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
128 [label="Access variable R|<local>/y|"];
129 [label="Function call: R|<local>/y|.<Unresolved name: inc>#()"];
130 [label="Access variable R|<local>/x|"];
131 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
127 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
124 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
126 [label="Access variable R|<local>/y|"];
127 [label="Function call: R|<local>/y|.<Unresolved name: inc>#()"];
128 [label="Access variable R|<local>/x|"];
129 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
125 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
108 [label="Postponed exit from lambda"];
109 [label="Function call: R|/myRun|<R|kotlin/Int|>(...)"];
@@ -287,38 +287,36 @@ digraph flowFromInplaceLambda_kt {
113 [label="Postponed enter to lambda"];
subgraph cluster_15 {
color=blue
132 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
134 [label="Access variable R|<local>/x|"];
135 [label="Function call: R|<local>/x|.<Unresolved name: inc>#()"];
136 [label="Access variable R|<local>/y|"];
137 [label="Function call: R|<local>/y|.R|kotlin/Int.inc|()"];
138 [label="Const: Int(1)"];
133 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
130 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
132 [label="Access variable R|<local>/x|"];
133 [label="Function call: R|<local>/x|.<Unresolved name: inc>#()"];
134 [label="Access variable R|<local>/y|"];
135 [label="Function call: R|<local>/y|.R|kotlin/Int.inc|()"];
136 [label="Const: Int(1)"];
131 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
114 [label="Postponed exit from lambda"];
115 [label="Function call: R|/myRun|<R|kotlin/Int|>(...)"];
116 [label="Function call: R|/select|<R|kotlin/Int|>(...)"];
117 [label="Variable declaration: lval a: R|kotlin/Int|"];
118 [label="Access variable R|<local>/x|"];
119 [label="Access variable R|<local>/x|"];
120 [label="Access variable R|<local>/x|"];
121 [label="Function call: <Inapplicable(INAPPLICABLE): [/takeInt]>#(...)"];
122 [label="Access variable R|<local>/y|"];
119 [label="Function call: <Inapplicable(INAPPLICABLE): [/takeInt]>#(...)"];
120 [label="Access variable R|<local>/y|"];
121 [label="Function call: R|/takeInt|(...)"];
122 [label="Access variable R|<local>/a|"];
123 [label="Function call: R|/takeInt|(...)"];
124 [label="Access variable R|<local>/a|"];
125 [label="Function call: R|/takeInt|(...)"];
106 [label="Exit function test_4" style="filled" fillcolor=red];
}
105 -> {107};
107 -> {108};
107 -> {126} [color=red];
107 -> {124} [color=red];
108 -> {109};
109 -> {110};
110 -> {111};
111 -> {112};
112 -> {113};
113 -> {114};
113 -> {132} [color=red];
113 -> {130} [color=red];
114 -> {115};
115 -> {116};
116 -> {117};
@@ -328,110 +326,108 @@ digraph flowFromInplaceLambda_kt {
120 -> {121};
121 -> {122};
122 -> {123};
123 -> {124};
124 -> {125};
125 -> {106};
126 -> {128};
123 -> {106};
124 -> {126};
126 -> {127};
127 -> {128};
128 -> {129};
129 -> {130};
130 -> {131};
131 -> {127};
132 -> {134};
129 -> {125};
130 -> {132};
132 -> {133};
133 -> {134};
134 -> {135};
135 -> {136};
136 -> {137};
137 -> {138};
138 -> {133};
136 -> {131};
subgraph cluster_16 {
color=red
139 [label="Enter function test_5" style="filled" fillcolor=red];
141 [label="Postponed enter to lambda"];
137 [label="Enter function test_5" style="filled" fillcolor=red];
139 [label="Postponed enter to lambda"];
subgraph cluster_17 {
color=blue
152 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
154 [label="Function call: R|/materialize|<R|kotlin/Int|>()"];
153 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
150 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
152 [label="Function call: R|/materialize|<R|kotlin/Int|>()"];
151 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
142 [label="Postponed exit from lambda"];
143 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
144 [label="Postponed enter to lambda"];
140 [label="Postponed exit from lambda"];
141 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
142 [label="Postponed enter to lambda"];
subgraph cluster_18 {
color=blue
155 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
157 [label="Function call: R|/materialize|<R|kotlin/Int|>()"];
156 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
153 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
155 [label="Function call: R|/materialize|<R|kotlin/Int|>()"];
154 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
145 [label="Postponed exit from lambda"];
146 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
148 [label="Call arguments union" style="filled" fillcolor=yellow];
147 [label="Function call: R|/select|<R|kotlin/Int|>(...)"];
149 [label="Variable declaration: lval x: R|kotlin/Int|"];
150 [label="Access variable R|<local>/x|"];
151 [label="Function call: R|/takeInt|(...)"];
140 [label="Exit function test_5" style="filled" fillcolor=red];
143 [label="Postponed exit from lambda"];
144 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
146 [label="Call arguments union" style="filled" fillcolor=yellow];
145 [label="Function call: R|/select|<R|kotlin/Int|>(...)"];
147 [label="Variable declaration: lval x: R|kotlin/Int|"];
148 [label="Access variable R|<local>/x|"];
149 [label="Function call: R|/takeInt|(...)"];
138 [label="Exit function test_5" style="filled" fillcolor=red];
}
139 -> {141};
141 -> {152};
141 -> {142} [color=red];
142 -> {143};
137 -> {139};
139 -> {150};
139 -> {140} [color=red];
140 -> {141};
141 -> {142};
142 -> {153};
142 -> {143} [color=red];
143 -> {144};
144 -> {155};
144 -> {145} [color=red];
145 -> {146};
146 -> {148};
147 -> {149};
148 -> {147};
149 -> {150};
150 -> {151};
151 -> {140};
152 -> {154};
153 -> {142} [color=green];
153 -> {148} [color=red];
154 -> {153};
155 -> {157};
156 -> {145} [color=green];
156 -> {148} [color=red];
157 -> {156};
144 -> {146};
145 -> {147};
146 -> {145};
147 -> {148};
148 -> {149};
149 -> {138};
150 -> {152};
151 -> {140} [color=green];
151 -> {146} [color=red];
152 -> {151};
153 -> {155};
154 -> {143} [color=green];
154 -> {146} [color=red];
155 -> {154};
subgraph cluster_19 {
color=red
158 [label="Enter function test_6" style="filled" fillcolor=red];
160 [label="Postponed enter to lambda"];
156 [label="Enter function test_6" style="filled" fillcolor=red];
158 [label="Postponed enter to lambda"];
subgraph cluster_20 {
color=blue
165 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
167 [label="Postponed enter to lambda"];
163 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
165 [label="Postponed enter to lambda"];
subgraph cluster_21 {
color=blue
170 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
172 [label="Function call: R|/materialize|<R|kotlin/String|>()"];
171 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
168 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
170 [label="Function call: R|/materialize|<R|kotlin/String|>()"];
169 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
168 [label="Postponed exit from lambda"];
169 [label="Function call: R|kotlin/run|<R|kotlin/String|>(...)"];
166 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
166 [label="Postponed exit from lambda"];
167 [label="Function call: R|kotlin/run|<R|kotlin/String|>(...)"];
164 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
161 [label="Postponed exit from lambda"];
162 [label="Function call: R|/myRun|<R|kotlin/String|>(...)"];
163 [label="Function call: R|/id|<R|kotlin/String|>(...)"];
164 [label="Variable declaration: lval x: R|kotlin/String|"];
159 [label="Exit function test_6" style="filled" fillcolor=red];
159 [label="Postponed exit from lambda"];
160 [label="Function call: R|/myRun|<R|kotlin/String|>(...)"];
161 [label="Function call: R|/id|<R|kotlin/String|>(...)"];
162 [label="Variable declaration: lval x: R|kotlin/String|"];
157 [label="Exit function test_6" style="filled" fillcolor=red];
}
158 -> {160};
156 -> {158};
158 -> {159};
158 -> {163} [color=red];
159 -> {160};
160 -> {161};
160 -> {165} [color=red];
161 -> {162};
162 -> {163};
163 -> {164};
164 -> {159};
165 -> {167};
167 -> {170};
167 -> {168} [color=red];
168 -> {169};
169 -> {166};
170 -> {172};
171 -> {168} [color=green];
172 -> {171};
162 -> {157};
163 -> {165};
165 -> {168};
165 -> {166} [color=red];
166 -> {167};
167 -> {164};
168 -> {170};
169 -> {166} [color=green];
170 -> {169};
}

View File

@@ -44,7 +44,7 @@ digraph localClassesWithImplicit_kt {
}
20 [label="Exit local class test"];
21 [label="Exit anonymous object"];
22 [label="Variable declaration: lval x: R|anonymous|"];
22 [label="Variable declaration: lval x: R|<anonymous>|"];
6 [label="Exit function test" style="filled" fillcolor=red];
}
5 -> {7};
@@ -284,7 +284,7 @@ digraph localClassesWithImplicit_kt {
99 [label="Enter block"];
100 [label="Access variable R|<local>/b|"];
101 [label="Access variable R|kotlin/String.length|"];
102 [label="Function call: this@R|/anonymous|.R|/anonymous.bar|()"];
102 [label="Function call: this@R|/<anonymous>|.R|/<anonymous>.bar|()"];
103 [label="Exit block"];
}
104 [label="Exit when branch result"];
@@ -299,7 +299,7 @@ digraph localClassesWithImplicit_kt {
^ when () {
(R|<local>/b| is R|kotlin/String|) -> {
R|<local>/b|.R|kotlin/String.length|
this@R|/anonymous|.R|/anonymous.bar|()
this@R|/<anonymous>|.R|/<anonymous>.bar|()
}
else -> {
Int(1)
@@ -356,7 +356,7 @@ digraph localClassesWithImplicit_kt {
122 [label="Access variable R|kotlin/String.length|"];
123 [label="Access variable R|<local>/b|"];
124 [label="Access variable <Unresolved name: length>#"];
125 [label="Function call: this@R|/anonymous|.R|/anonymous.baz|()"];
125 [label="Function call: this@R|/<anonymous>|.R|/<anonymous>.baz|()"];
120 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
115 [label="Postponed exit from lambda"];
@@ -364,7 +364,7 @@ digraph localClassesWithImplicit_kt {
117 [label="Jump: ^bar R|/myRun|<R|kotlin/Int|>(<L> = myRun@fun <anonymous>(): R|kotlin/Int| <kind=UNKNOWN> {
R|<local>/a|.R|kotlin/String.length|
R|<local>/b|.<Unresolved name: length>#
^ this@R|/anonymous|.R|/anonymous.baz|()
^ this@R|/<anonymous>|.R|/<anonymous>.baz|()
}
)"];
118 [label="Stub" style="filled" fillcolor=gray];

View File

@@ -46,8 +46,8 @@ FILE: localClassesWithImplicit.kt
}
lval x: R|anonymous| = object : R|kotlin/Any| {
private[local] constructor(): R|anonymous| {
lval x: R|<anonymous>| = object : R|kotlin/Any| {
private[local] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
@@ -57,7 +57,7 @@ FILE: localClassesWithImplicit.kt
^ when () {
(R|<local>/b| is R|kotlin/String|) -> {
R|<local>/b|.R|kotlin/String.length|
this@R|/anonymous|.R|/anonymous.bar|()
this@R|/<anonymous>|.R|/<anonymous>.bar|()
}
else -> {
Int(1)
@@ -72,7 +72,7 @@ FILE: localClassesWithImplicit.kt
^bar R|/myRun|<R|kotlin/Int|>(<L> = myRun@fun <anonymous>(): R|kotlin/Int| <kind=UNKNOWN> {
R|<local>/a|.R|kotlin/String.length|
R|<local>/b|.<Unresolved name: length>#
^ this@R|/anonymous|.R|/anonymous.baz|()
^ this@R|/<anonymous>|.R|/<anonymous>.baz|()
}
)
}

View File

@@ -22,7 +22,7 @@ FILE: enum.kt
public get(): R|Some|
public final static enum entry FIRST: R|SomeEnum| = object : R|SomeEnum| {
private[local] constructor(): R|anonymous| {
private[local] constructor(): R|<anonymous>| {
super<R|SomeEnum|>(Q|O1|)
}
@@ -33,7 +33,7 @@ FILE: enum.kt
}
public final static enum entry SECOND: R|SomeEnum| = object : R|SomeEnum| {
private[local] constructor(): R|anonymous| {
private[local] constructor(): R|<anonymous>| {
super<R|SomeEnum|>(Q|O2|)
}
@@ -71,7 +71,7 @@ FILE: enum.kt
}
public final static enum entry E1: R|EnumClass| = object : R|EnumClass| {
private[local] constructor(): R|anonymous| {
private[local] constructor(): R|<anonymous>| {
super<R|EnumClass|>()
}
@@ -85,14 +85,14 @@ FILE: enum.kt
}
public final static enum entry E2: R|EnumClass| = object : R|EnumClass| {
private[local] constructor(): R|anonymous| {
private[local] constructor(): R|<anonymous>| {
super<R|EnumClass|>()
}
}
public final static enum entry E3: R|EnumClass| = object : R|EnumClass| {
private[local] constructor(): R|anonymous| {
private[local] constructor(): R|<anonymous>| {
super<R|EnumClass|>()
}

View File

@@ -14,7 +14,7 @@ FILE: CallBasedInExpressionGenerator.kt
private get(): R|kotlin/Boolean|
public final override fun generate(argument: R|ERROR CLASS: Symbol not found, for `StackValue`|): R|ERROR CLASS: Symbol not found, for `BranchedValue`| {
^generate R?C|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.gen|(R|<local>/argument|).<Inapplicable(WRONG_RECEIVER): [kotlin/let]>#(<L> = let@fun <anonymous>(): R|ERROR CLASS: Can't resolve when expression| {
^generate this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.gen|(R|<local>/argument|).<Inapplicable(WRONG_RECEIVER): [kotlin/let]>#(<L> = let@fun <anonymous>(): <ERROR TYPE REF: Can't resolve when expression> {
^ when () {
this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.isInverted| -> {
<Unresolved name: Invert>#(<Unresolved name: it>#)
@@ -30,17 +30,17 @@ FILE: CallBasedInExpressionGenerator.kt
private final fun gen(argument: R|ERROR CLASS: Symbol not found, for `StackValue`|): R|ERROR CLASS: Symbol not found, for `BranchedValue`| {
^gen object : R|ERROR CLASS: Symbol not found, for `BranchedValue`| {
private[local] constructor(): R|anonymous| {
private[local] constructor(): R|<anonymous>| {
super<R|ERROR CLASS: Symbol not found, for `BranchedValue`|>(R|<local>/argument|, Null(null), R|<local>/argument|.<Unresolved name: type>#, <Unresolved name: Opcodes>#.<Unresolved name: IFEQ>#)
}
public[local] final override fun putSelector(type: R|ERROR CLASS: Symbol not found, for `Type`|, kotlinType: R|ERROR CLASS: Symbol not found, for `KotlinType?`|, v: R|ERROR CLASS: Symbol not found, for `InstructionAdapter`|): R|kotlin/Unit| {
this@R|/anonymous|.R|/anonymous.invokeFunction|(R|<local>/v|)
this@R|/<anonymous>|.R|/<anonymous>.invokeFunction|(R|<local>/v|)
<Unresolved name: coerceTo>#(R|<local>/type|, R|<local>/kotlinType|, R|<local>/v|)
}
public[local] final override fun condJump(jumpLabel: R|ERROR CLASS: Symbol not found, for `Label`|, v: R|ERROR CLASS: Symbol not found, for `InstructionAdapter`|, jumpIfFalse: R|kotlin/Boolean|): R|kotlin/Unit| {
this@R|/anonymous|.R|/anonymous.invokeFunction|(R|<local>/v|)
this@R|/<anonymous>|.R|/<anonymous>.invokeFunction|(R|<local>/v|)
R|<local>/v|.<Unresolved name: visitJumpInsn>#(when () {
R|<local>/jumpIfFalse| -> {
<Unresolved name: Opcodes>#.<Unresolved name: IFEQ>#

View File

@@ -7,7 +7,7 @@ FILE: enumEntryUse.kt
public final static enum entry FIRST: R|TestEnum|
public final static enum entry SECOND: R|TestEnum|
public final static enum entry THIRD: R|TestEnum| = object : R|TestEnum| {
private[local] constructor(): R|anonymous| {
private[local] constructor(): R|<anonymous>| {
super<R|TestEnum|>()
}

View File

@@ -17,6 +17,6 @@ FILE: typeParameters2.kt
^foo R|<local>/t|
}
public final fun main(fooImpl: R|FooImpl|, fooBarImpl: R|FooBarImpl|): R|kotlin/Unit| {
lval a: <ERROR TYPE REF: Inapplicable(INAPPLICABLE): [/foo]> = <Inapplicable(INAPPLICABLE): [/foo]>#<R|FooImpl|>(R|<local>/fooBarImpl|)
lval a: <ERROR TYPE REF: Inapplicable(INAPPLICABLE): [/foo]> = <Inapplicable(INAPPLICABLE): [/foo]>#(R|<local>/fooBarImpl|)
lval b: R|Foo| = R|/foo|<R|Foo|>(R|<local>/fooImpl|)
}

View File

@@ -1,12 +1,12 @@
FILE: localImplicitBodies.kt
public final fun foo(): R|kotlin/Unit| {
lval x: R|anonymous| = object : R|kotlin/Any| {
private[local] constructor(): R|anonymous| {
lval x: R|<anonymous>| = object : R|kotlin/Any| {
private[local] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public[local] final fun sss(): R|kotlin/Int| {
^sss this@R|/anonymous|.R|/anonymous.abc|()
^sss this@R|/<anonymous>|.R|/<anonymous>.abc|()
}
public[local] final fun abc(): R|kotlin/Int| {
@@ -15,5 +15,5 @@ FILE: localImplicitBodies.kt
}
lval g: R|kotlin/Int| = R|<local>/x|.R|/anonymous.sss|()
lval g: R|kotlin/Int| = R|<local>/x|.R|/<anonymous>.sss|()
}

View File

@@ -3,12 +3,12 @@ FILE: localInnerClass.kt
}
public final fun bar(): R|kotlin/Unit| {
object : R|Foo| {
private[local] constructor(): R|anonymous| {
private[local] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public[local] final fun foo(): R|Foo| {
^foo this@R|/anonymous|.R|/<anonymous>.Derived.Derived|(Int(42))
^foo this@R|/<anonymous>|.R|/<anonymous>.Derived.Derived|(Int(42))
}
local final inner class Derived : R|Foo| {

View File

@@ -20,8 +20,8 @@ FILE: localObjects.kt
}
public final fun test(): R|kotlin/Unit| {
Q|A|.R|/A.x|
lval b: R|anonymous| = object : R|Foo| {
private[local] constructor(): R|anonymous| {
lval b: R|<anonymous>| = object : R|Foo| {
private[local] constructor(): R|<anonymous>| {
super<R|Foo|>()
}

View File

@@ -22,8 +22,8 @@ FILE: localScopes.kt
lval base: R|BaseLocal| = R|/BaseLocal.BaseLocal|()
R|<local>/base|.R|/BaseLocal.baz|()
R|<local>/base|.R|/Bar.foo|()
lval anonymous: R|anonymous| = object : R|Bar| {
private[local] constructor(): R|anonymous| {
lval anonymous: R|<anonymous>| = object : R|Bar| {
private[local] constructor(): R|<anonymous>| {
super<R|Bar|>()
}
@@ -32,7 +32,7 @@ FILE: localScopes.kt
}
R|<local>/anonymous|.R|/anonymous.baz|()
R|<local>/anonymous|.R|/<anonymous>.baz|()
R|<local>/anonymous|.R|/Bar.foo|()
local final class DerivedLocal : R|BaseLocal| {
public[local] constructor(): R|DerivedLocal| {

View File

@@ -1,7 +1,7 @@
FILE: foo.kt
public final fun foo(): R|kotlin/Boolean| {
object : R|Node<kotlin/Boolean>| {
private[local] constructor(): R|anonymous| {
private[local] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
@@ -10,11 +10,11 @@ FILE: foo.kt
private set(value: R|kotlin/Boolean|): R|kotlin/Unit|
public[local] final fun bar(): R|kotlin/Boolean| {
^bar this@R|/anonymous|.R|/anonymous.result|.R|kotlin/Boolean.not|()
^bar this@R|/<anonymous>|.R|/<anonymous>.result|.R|kotlin/Boolean.not|()
}
public[local] final override fun result(): R|kotlin/Boolean| {
^result this@R|/anonymous|.R|/anonymous.result|
^result this@R|/<anonymous>|.R|/<anonymous>.result|
}
}

View File

@@ -31,8 +31,8 @@ FILE: O.kt
public[private] final fun test(): R|kotlin/Unit| {
lval x: R|kotlin/Int| = this@R|/O.Derived|.R|/O.Derived.bar|
lval o: R|anonymous| = object : R|Wrapper| {
private[local] constructor(): R|anonymous| {
lval o: R|<anonymous>| = object : R|Wrapper| {
private[local] constructor(): R|<anonymous>| {
super<R|Wrapper|>(this@R|/O.Derived.Some|.R|/O.Derived.Some.z|)
}
@@ -40,8 +40,8 @@ FILE: O.kt
lval y: R|ft<kotlin/String, kotlin/String?>!| = this@R|/O.Derived|.R|/Base.foo|()
}
public[local] final val oo: R|anonymous| = object : R|kotlin/Any| {
private[local] constructor(): R|anonymous| {
public[local] final val oo: R|<anonymous>| = object : R|kotlin/Any| {
private[local] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
@@ -50,7 +50,7 @@ FILE: O.kt
}
public get(): R|anonymous|
public get(): R|<anonymous>|
}
@@ -60,8 +60,8 @@ FILE: O.kt
public[private] final fun test(): R|kotlin/Unit| {
lval x: R|kotlin/Int| = this@R|/O.Derived|.R|/O.Derived.bar|
lval o: R|anonymous| = object : R|kotlin/Any| {
private[local] constructor(): R|anonymous| {
lval o: R|<anonymous>| = object : R|kotlin/Any| {
private[local] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
@@ -86,7 +86,7 @@ FILE: O.kt
private final fun gen(): R|kotlin/Any| {
^gen object : R|Wrapper| {
private[local] constructor(): R|anonymous| {
private[local] constructor(): R|<anonymous>| {
super<R|Wrapper|>(Boolean(true))
}

View File

@@ -4,8 +4,8 @@ FILE: privateObjectLiteral.kt
super<R|kotlin/Any|>()
}
private final val x: R|anonymous| = object : R|kotlin/Any| {
private[local] constructor(): R|anonymous| {
private final val x: R|<anonymous>| = object : R|kotlin/Any| {
private[local] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
@@ -15,13 +15,13 @@ FILE: privateObjectLiteral.kt
}
private get(): R|anonymous|
private get(): R|<anonymous>|
public final val y: R|kotlin/Int| = this@R|/C|.R|/C.x|.R|/anonymous.foo|()
public final val y: R|kotlin/Int| = this@R|/C|.R|/C.x|.R|/<anonymous>.foo|()
public get(): R|kotlin/Int|
internal final val z: R|anonymous| = object : R|kotlin/Any| {
private[local] constructor(): R|anonymous| {
internal final val z: R|<anonymous>| = object : R|kotlin/Any| {
private[local] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
@@ -31,9 +31,9 @@ FILE: privateObjectLiteral.kt
}
internal get(): R|anonymous|
internal get(): R|<anonymous>|
public final val w: R|kotlin/Int| = this@R|/C|.R|/C.z|.R|/anonymous.foo|()
public final val w: R|kotlin/Int| = this@R|/C|.R|/C.z|.R|/<anonymous>.foo|()
public get(): R|kotlin/Int|
}

View File

@@ -26,7 +26,7 @@ FILE: enums.kt
internal get(): R|kotlin/Double|
public final static enum entry MERCURY: R|Planet| = object : R|Planet| {
private[local] constructor(): R|anonymous| {
private[local] constructor(): R|<anonymous>| {
super<R|Planet|>(Double(1.0), Double(2.0))
}
@@ -37,7 +37,7 @@ FILE: enums.kt
}
public final static enum entry VENERA: R|Planet| = object : R|Planet| {
private[local] constructor(): R|anonymous| {
private[local] constructor(): R|<anonymous>| {
super<R|Planet|>(Double(3.0), Double(4.0))
}
@@ -48,7 +48,7 @@ FILE: enums.kt
}
public final static enum entry EARTH: R|Planet| = object : R|Planet| {
private[local] constructor(): R|anonymous| {
private[local] constructor(): R|<anonymous>| {
super<R|Planet|>(Double(5.0), Double(6.0))
}

View File

@@ -29,7 +29,7 @@ FILE: lambdaArgInScopeFunction.kt
}
) }
R|<local>/lambda|.R|tests/_checkType/checkType|<R|() -> KotlinClass|>(<L> = checkType@fun R|tests/_checkType/Inv<kotlin/Function0<KotlinClass>?>|.<anonymous>(): R|kotlin/Unit| {
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#<R|(kotlin/Unit) -> KotlinClass?|>()
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#()
}
)
}
@@ -50,7 +50,7 @@ FILE: lambdaArgInScopeFunction.kt
}
)
R|<local>/lambda|.R|tests/_checkType/checkType|<R|() -> KotlinClass|>(<L> = checkType@fun R|tests/_checkType/Inv<kotlin/Function0<KotlinClass>>|.<anonymous>(): R|kotlin/Unit| {
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#<R|(kotlin/Unit) -> KotlinClass?|>()
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#()
}
)
}

View File

@@ -29,11 +29,11 @@ FILE: KotlinClass.kt
}
)
R|<local>/invalidType|.R|tests/_checkType/checkType|<R|(JavaClass) -> kotlin/Boolean|>(<L> = checkType@fun R|tests/_checkType/Inv<kotlin/Function1<JavaClass, kotlin/Boolean>>|.<anonymous>(): R|kotlin/Unit| {
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#<R|(kotlin/Nothing) -> kotlin/Boolean|>()
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#()
}
)
R|/Case1.Case1|(R|<local>/javaClass|).R|/Case1.x|.R|tests/_checkType/checkType|<R|(KotlinClass) -> kotlin/Boolean|>(<L> = checkType@fun R|tests/_checkType/Inv<kotlin/Function1<KotlinClass, kotlin/Boolean>>|.<anonymous>(): R|kotlin/Unit| {
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#<R|(kotlin/Nothing) -> kotlin/Boolean|>()
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#()
}
)
}
@@ -122,11 +122,11 @@ FILE: KotlinClass.kt
}
)
R|<local>/invalidType|.R|tests/_checkType/checkType|<R|(KotlinClass) -> kotlin/Boolean|>(<L> = checkType@fun R|tests/_checkType/Inv<kotlin/Function1<KotlinClass, kotlin/Boolean>>|.<anonymous>(): R|kotlin/Unit| {
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#<R|(kotlin/Nothing) -> kotlin/Boolean|>()
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#()
}
)
R|/Case2.Case2|(R|<local>/kotlinClass|).R|/Case2.x|.R|tests/_checkType/checkType|<R|(KotlinClass) -> kotlin/Boolean|>(<L> = checkType@fun R|tests/_checkType/Inv<kotlin/Function1<KotlinClass, kotlin/Boolean>>|.<anonymous>(): R|kotlin/Unit| {
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#<R|(kotlin/Nothing) -> kotlin/Boolean|>()
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#()
}
)
}

View File

@@ -1,35 +1,35 @@
FILE: implicitInAnonymous.kt
private final val x: R|anonymous| = object : R|kotlin/Any| {
private[local] constructor(): R|anonymous| {
private final val x: R|<anonymous>| = object : R|kotlin/Any| {
private[local] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public[local] final fun foo(x: R|kotlin/Int|): R|kotlin/Boolean| {
^foo this@R|/anonymous|.R|/anonymous.bar|(R|<local>/x|)
^foo this@R|/<anonymous>|.R|/<anonymous>.bar|(R|<local>/x|)
}
public[local] final fun bar(y: R|kotlin/Int|): R|kotlin/Boolean| {
^bar CMP(>, this@R|/anonymous|.R|kotlin/Any.hashCode|().R|kotlin/Int.plus|(R|<local>/y|).R|kotlin/Int.compareTo|(Int(0)))
^bar CMP(>, this@R|/<anonymous>|.R|kotlin/Any.hashCode|().R|kotlin/Int.plus|(R|<local>/y|).R|kotlin/Int.compareTo|(Int(0)))
}
public[local] final val w: R|kotlin/Boolean|
public get(): R|kotlin/Boolean| {
^ this@R|/anonymous|.R|/anonymous.z|
^ this@R|/<anonymous>|.R|/<anonymous>.z|
}
public[local] final val z: R|kotlin/Boolean|
public get(): R|kotlin/Boolean| {
^ ==(this@R|/anonymous|.R|kotlin/Any.hashCode|(), Int(0))
^ ==(this@R|/<anonymous>|.R|kotlin/Any.hashCode|(), Int(0))
}
}
private get(): R|anonymous|
private get(): R|<anonymous>|
public final fun useBoolean(b: R|kotlin/Boolean|): R|kotlin/Unit| {
}
public final fun main(): R|kotlin/Unit| {
R|/useBoolean|(R|/x|.R|/anonymous.foo|(Int(1)))
R|/useBoolean|(R|/x|.R|/anonymous.bar|(Int(2)))
R|/useBoolean|(R|/x|.R|/anonymous.w|)
R|/useBoolean|(R|/x|.R|/anonymous.z|)
R|/useBoolean|(R|/x|.R|/<anonymous>.foo|(Int(1)))
R|/useBoolean|(R|/x|.R|/<anonymous>.bar|(Int(2)))
R|/useBoolean|(R|/x|.R|/<anonymous>.w|)
R|/useBoolean|(R|/x|.R|/<anonymous>.z|)
}

View File

@@ -12,7 +12,7 @@ FILE: typesFromSuperClasses.kt
}
public final fun main(): R|kotlin/Unit| {
object : R|Outer| {
private[local] constructor(): R|anonymous| {
private[local] constructor(): R|<anonymous>| {
super<R|Outer|>()
}

View File

@@ -8,8 +8,8 @@ FILE: localObject.kt
}
public final fun tesLambda(x: R|kotlin/Int|): R|kotlin/Int| {
^tesLambda R|/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| {
lval obj: R|anonymous| = object : R|Foo| {
private[local] constructor(): R|anonymous| {
lval obj: R|<anonymous>| = object : R|Foo| {
private[local] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
@@ -34,8 +34,8 @@ FILE: localObject.kt
public final var x: R|kotlin/Int| = Int(1)
public get(): R|kotlin/Int|
public set(value: R|kotlin/Int|): R|kotlin/Unit| {
lval obj: R|anonymous| = object : R|Foo| {
private[local] constructor(): R|anonymous| {
lval obj: R|<anonymous>| = object : R|Foo| {
private[local] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
@@ -50,8 +50,8 @@ FILE: localObject.kt
public final val y: R|kotlin/Int|
public get(): R|kotlin/Int| {
lval obj: R|anonymous| = object : R|Foo| {
private[local] constructor(): R|anonymous| {
lval obj: R|<anonymous>| = object : R|Foo| {
private[local] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
@@ -65,8 +65,8 @@ FILE: localObject.kt
}
public final val z: R|kotlin/Int| = this@R|/TestProperty|.R|kotlin/run|<R|TestProperty|, R|kotlin/Int|>(<L> = run@fun R|TestProperty|.<anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
lval obj: R|anonymous| = object : R|Foo| {
private[local] constructor(): R|anonymous| {
lval obj: R|<anonymous>| = object : R|Foo| {
private[local] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}

View File

@@ -1,12 +1,12 @@
FILE: objectInnerClass.kt
public final val case1: R|anonymous| = object : R|A| {
private[local] constructor(): R|anonymous| {
public final val case1: R|<anonymous>| = object : R|A| {
private[local] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
local final inner class Child : R|<anonymous>.Base| {
public[local] constructor(property: R|B|): R|<anonymous>.Child| {
this@R|/anonymous|.super<R|<anonymous>.Base|>(R|<local>/property|)
this@R|/<anonymous>|.super<R|<anonymous>.Base|>(R|<local>/property|)
}
public[local] final fun R|<anonymous>.Base|.zoo(): R|kotlin/Unit| {
@@ -17,17 +17,17 @@ FILE: objectInnerClass.kt
this@R|/<anonymous>.Child|.R|/<anonymous>.Base.baseFun|()
lval x: R|B| = this@R|/<anonymous>.Child|.R|/<anonymous>.Base.property|
(this@R|/<anonymous>.Child|, this@R|/<anonymous>.Child|).R|/<anonymous>.Child.zoo|()
(this@R|/anonymous|, this@R|/<anonymous>.Child|).R|/anonymous.hoo|()
(this@R|/<anonymous>|, this@R|/<anonymous>.Child|).R|/<anonymous>.hoo|()
}
}
public[local] final fun R|<anonymous>.Child|.voo(): R|kotlin/Unit| {
lval x: R|B| = this@R|/anonymous.voo|.R|/<anonymous>.Base.property|
lval x: R|B| = this@R|/<anonymous>.voo|.R|/<anonymous>.Base.property|
}
public[local] final fun R|<anonymous>.Base|.hoo(): R|kotlin/Unit| {
lval x: R|B| = this@R|/anonymous.hoo|.R|/<anonymous>.Base.property|
lval x: R|B| = this@R|/<anonymous>.hoo|.R|/<anonymous>.Base.property|
}
local open inner class Base : R|kotlin/Any| {
@@ -44,48 +44,48 @@ FILE: objectInnerClass.kt
}
public[local] final fun caseForBase(): R|kotlin/Unit| {
lval base: R|<anonymous>.Base| = this@R|/anonymous|.R|/<anonymous>.Base.Base|(R|/B.B|())
lval base: R|<anonymous>.Base| = this@R|/<anonymous>|.R|/<anonymous>.Base.Base|(R|/B.B|())
R|<local>/base|.R|/<anonymous>.Base.baseFun|()
R|<local>/base|.R|/<anonymous>.Base.property|
(this@R|/anonymous|, R|<local>/base|).R|/anonymous.hoo|()
(this@R|/<anonymous>|, R|<local>/base|).R|/<anonymous>.hoo|()
}
public[local] final fun caseForChild(): R|kotlin/Unit| {
lval child: R|<anonymous>.Child| = this@R|/anonymous|.R|/<anonymous>.Child.Child|(R|/B.B|())
lval child: R|<anonymous>.Child| = this@R|/<anonymous>|.R|/<anonymous>.Child.Child|(R|/B.B|())
R|<local>/child|.R|/<anonymous>.Base.baseFun|()
R|<local>/child|.R|/<anonymous>.Base.property|
R|<local>/child|.R|/<anonymous>.Child.foo|()
(this@R|/anonymous|, R|<local>/child|).R|/anonymous.hoo|()
(this@R|/anonymous|, R|<local>/child|).R|/anonymous.voo|()
(this@R|/<anonymous>|, R|<local>/child|).R|/<anonymous>.hoo|()
(this@R|/<anonymous>|, R|<local>/child|).R|/<anonymous>.voo|()
}
}
public get(): R|anonymous|
public get(): R|<anonymous>|
public final class Case2 : R|kotlin/Any| {
public constructor(): R|Case2| {
super<R|kotlin/Any|>()
}
public final val x: R|anonymous| = object : R|Case2.Base| {
private[local] constructor(): R|anonymous| {
public final val x: R|<anonymous>| = object : R|Case2.Base| {
private[local] constructor(): R|<anonymous>| {
this@R|/Case2|.super<R|Case2.Base|>(R|/B.B|())
}
public[local] final fun R|Case2.Base|.zoo(): R|kotlin/Unit| {
lval x: R|B| = this@R|/anonymous.zoo|.R|/Case2.Base.property|
lval x: R|B| = this@R|/<anonymous>.zoo|.R|/Case2.Base.property|
}
public[local] final fun foo(): R|kotlin/Unit| {
this@R|/anonymous|.R|/Case2.Base.baseFun|()
lval x: R|B| = this@R|/anonymous|.R|/Case2.Base.property|
(this@R|/anonymous|, this@R|/anonymous|).R|/anonymous.zoo|()
(this@R|/Case2|, this@R|/anonymous|).R|/Case2.hoo|()
this@R|/<anonymous>|.R|/Case2.Base.baseFun|()
lval x: R|B| = this@R|/<anonymous>|.R|/Case2.Base.property|
(this@R|/<anonymous>|, this@R|/<anonymous>|).R|/<anonymous>.zoo|()
(this@R|/Case2|, this@R|/<anonymous>|).R|/Case2.hoo|()
}
}
public get(): R|anonymous|
public get(): R|<anonymous>|
public final fun R|Case2.Base|.hoo(): R|kotlin/Unit| {
lval x: R|B| = this@R|/Case2.hoo|.R|/Case2.Base.property|
@@ -112,7 +112,7 @@ FILE: objectInnerClass.kt
}
public final fun caseForChild(): R|kotlin/Unit| {
lval child: R|anonymous| = this@R|/Case2|.R|/Case2.x|
lval child: R|<anonymous>| = this@R|/Case2|.R|/Case2.x|
R|<local>/child|.R|/Case2.Base.baseFun|()
R|<local>/child|.R|/Case2.Base.property|
(this@R|/Case2|, R|<local>/child|).R|/Case2.hoo|()
@@ -124,14 +124,14 @@ FILE: objectInnerClass.kt
super<R|kotlin/Any|>()
}
public final val x: R|anonymous| = object : R|A| {
private[local] constructor(): R|anonymous| {
public final val x: R|<anonymous>| = object : R|A| {
private[local] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
local final inner class Child : R|Case3.<anonymous>.Base| {
public[local] constructor(property: R|B|): R|Case3.<anonymous>.Child| {
this@R|/anonymous|.super<R|Case3.<anonymous>.Base|>(R|<local>/property|)
this@R|/<anonymous>|.super<R|Case3.<anonymous>.Base|>(R|<local>/property|)
}
public[local] final fun R|Case3.<anonymous>.Base|.zoo(): R|kotlin/Unit| {
@@ -142,17 +142,17 @@ FILE: objectInnerClass.kt
this@R|/Case3.<anonymous>.Child|.R|/Case3.<anonymous>.Base.baseFun|()
lval x: R|B| = this@R|/Case3.<anonymous>.Child|.R|/Case3.<anonymous>.Base.property|
(this@R|/Case3.<anonymous>.Child|, this@R|/Case3.<anonymous>.Child|).R|/Case3.<anonymous>.Child.zoo|()
(this@R|/anonymous|, this@R|/Case3.<anonymous>.Child|).R|/anonymous.hoo|()
(this@R|/<anonymous>|, this@R|/Case3.<anonymous>.Child|).R|/<anonymous>.hoo|()
}
}
public[local] final fun R|Case3.<anonymous>.Child|.voo(): R|kotlin/Unit| {
lval x: R|B| = this@R|/anonymous.voo|.R|/Case3.<anonymous>.Base.property|
lval x: R|B| = this@R|/<anonymous>.voo|.R|/Case3.<anonymous>.Base.property|
}
public[local] final fun R|Case3.<anonymous>.Base|.hoo(): R|kotlin/Unit| {
lval x: R|B| = this@R|/anonymous.hoo|.R|/Case3.<anonymous>.Base.property|
lval x: R|B| = this@R|/<anonymous>.hoo|.R|/Case3.<anonymous>.Base.property|
}
local open inner class Base : R|kotlin/Any| {
@@ -169,24 +169,24 @@ FILE: objectInnerClass.kt
}
public[local] final fun caseForBase(): R|kotlin/Unit| {
lval base: R|Case3.<anonymous>.Base| = this@R|/anonymous|.R|/Case3.<anonymous>.Base.Base|(R|/B.B|())
lval base: R|Case3.<anonymous>.Base| = this@R|/<anonymous>|.R|/Case3.<anonymous>.Base.Base|(R|/B.B|())
R|<local>/base|.R|/Case3.<anonymous>.Base.baseFun|()
R|<local>/base|.R|/Case3.<anonymous>.Base.property|
(this@R|/anonymous|, R|<local>/base|).R|/anonymous.hoo|()
(this@R|/<anonymous>|, R|<local>/base|).R|/<anonymous>.hoo|()
}
public[local] final fun caseForChild(): R|kotlin/Unit| {
lval child: R|Case3.<anonymous>.Child| = this@R|/anonymous|.R|/Case3.<anonymous>.Child.Child|(R|/B.B|())
lval child: R|Case3.<anonymous>.Child| = this@R|/<anonymous>|.R|/Case3.<anonymous>.Child.Child|(R|/B.B|())
R|<local>/child|.R|/Case3.<anonymous>.Base.baseFun|()
R|<local>/child|.R|/Case3.<anonymous>.Base.property|
R|<local>/child|.R|/Case3.<anonymous>.Child.foo|()
(this@R|/anonymous|, R|<local>/child|).R|/anonymous.hoo|()
(this@R|/anonymous|, R|<local>/child|).R|/anonymous.voo|()
(this@R|/<anonymous>|, R|<local>/child|).R|/<anonymous>.hoo|()
(this@R|/<anonymous>|, R|<local>/child|).R|/<anonymous>.voo|()
}
}
public get(): R|anonymous|
public get(): R|<anonymous>|
}
public abstract interface A : R|kotlin/Any| {

View File

@@ -13,8 +13,8 @@ FILE: objectDerivedFromInnerClass.kt
}
public final fun test(): R|kotlin/Unit| {
lval x: R|anonymous| = object : R|Outer.Inner| {
private[local] constructor(): R|anonymous| {
lval x: R|<anonymous>| = object : R|Outer.Inner| {
private[local] constructor(): R|<anonymous>| {
super<R|Outer.Inner|>()
}

View File

@@ -38,12 +38,12 @@ FILE: kotlinSam.kt
}
)
R|/foo1|(R|<local>/f|)
<Inapplicable(INAPPLICABLE): [/foo2]>#(<L> = foo2@fun <anonymous>(x: R|ERROR CLASS: No type for parameter|): R|kotlin/Boolean| {
<Inapplicable(INAPPLICABLE): [/foo2]>#(<L> = foo2@fun <anonymous>(x: R|kotlin/Nothing|): R|kotlin/Boolean| {
^ CMP(>, R|<local>/x|.<Unresolved name: compareTo>#(Int(1)))
}
)
<Inapplicable(INAPPLICABLE): [/foo2]>#(R|<local>/f|)
<Inapplicable(INAPPLICABLE): [/foo3]>#(<L> = foo3@fun <anonymous>(x: R|ERROR CLASS: No type for parameter|): R|kotlin/Boolean| {
<Inapplicable(INAPPLICABLE): [/foo3]>#(<L> = foo3@fun <anonymous>(x: R|kotlin/Nothing|): R|kotlin/Boolean| {
^ CMP(>, R|<local>/x|.<Unresolved name: compareTo>#(Int(1)))
}
)

View File

@@ -2,7 +2,7 @@ FILE: main.kt
public final fun foo(m: R|MyRunnable|): R|kotlin/Unit| {
}
public final fun main(): R|kotlin/Unit| {
Q|JavaUsage|.<Inapplicable(INAPPLICABLE): [/JavaUsage.foo]>#(<L> = foo@fun <anonymous>(x: R|ERROR CLASS: No type for parameter|): R|kotlin/Boolean| {
Q|JavaUsage|.<Inapplicable(INAPPLICABLE): [/JavaUsage.foo]>#(<L> = foo@fun <anonymous>(x: R|kotlin/Nothing|): R|kotlin/Boolean| {
^ CMP(>, R|<local>/x|.<Unresolved name: compareTo>#(Int(1)))
}
)

View File

@@ -35,7 +35,7 @@ FILE: sealedClass.kt
}
public final object Second : R|WithPrivateConstructor| {
private constructor(): R|Second| {
super<R|WithPrivateConstructor|>(IntegerLiteral(0))
super<R|WithPrivateConstructor|>(Int(0))
}
}

View File

@@ -0,0 +1,17 @@
interface A {
val b: B
}
interface B
interface C : B {
fun q(): Boolean
}
fun A.foo(): String = ""
fun main(a: A?) {
val lb = a?.b
if (lb !is C) return
a.foo().length
}

View File

@@ -0,0 +1,25 @@
FILE: boundSafeCallAndIsCheck.kt
public abstract interface A : R|kotlin/Any| {
public abstract val b: R|B|
public get(): R|B|
}
public abstract interface B : R|kotlin/Any| {
}
public abstract interface C : R|B| {
public abstract fun q(): R|kotlin/Boolean|
}
public final fun R|A|.foo(): R|kotlin/String| {
^foo String()
}
public final fun main(a: R|A?|): R|kotlin/Unit| {
lval lb: R|B?| = R|<local>/a|?.{ $subj$.R|/A.b| }
when () {
(R|<local>/lb| !is R|C|) -> {
^main Unit
}
}
R|<local>/a|.R|/foo|().R|kotlin/String.length|
}

View File

@@ -0,0 +1,14 @@
sealed class A<out T> {
class B<out T1>(val x: T1) : A<T1>()
class C<out T2>(val y: T2) : A<T2>()
}
typealias TA = A<CharSequence>
fun bar(): TA = TODO()
fun foo() {
when (val a = bar()) {
is A.B -> a.x.length
}
}

View File

@@ -0,0 +1,39 @@
FILE: bareWithSubjectTypeAlias.kt
public sealed class A<out T> : R|kotlin/Any| {
private constructor<out T>(): R|A<T>| {
super<R|kotlin/Any|>()
}
public final class B<out T1> : R|A<T1>| {
public constructor<out T1>(x: R|T1|): R|A.B<T1>| {
super<R|A<T1>|>()
}
public final val x: R|T1| = R|<local>/x|
public get(): R|T1|
}
public final class C<out T2> : R|A<T2>| {
public constructor<out T2>(y: R|T2|): R|A.C<T2>| {
super<R|A<T2>|>()
}
public final val y: R|T2| = R|<local>/y|
public get(): R|T2|
}
}
public final typealias TA = R|A<kotlin/CharSequence>|
public final fun bar(): R|TA| {
^bar R|kotlin/TODO|()
}
public final fun foo(): R|kotlin/Unit| {
when (lval a: R|TA| = R|/bar|()) {
($subj$ is R|A.B<kotlin/CharSequence>|) -> {
R|<local>/a|.R|FakeOverride</A.B.x: R|kotlin/CharSequence|>|.R|kotlin/CharSequence.length|
}
}
}

View File

@@ -51,7 +51,7 @@ FILE: singletonConstructors.kt
}
public final static enum entry X: R|E| = object : R|E| {
private[local] constructor(): R|anonymous| {
private[local] constructor(): R|<anonymous>| {
super<R|E|>()
}

View File

@@ -12,5 +12,5 @@ FILE: implicitTypes.kt
^loop1 <Inapplicable(INAPPLICABLE): [/use]>#(::R|/loop2|)
}
public final fun loop2(): <ERROR TYPE REF: cycle> {
^loop2 R?C|/loop1|()
^loop2 R|/loop1|()
}

View File

@@ -4,8 +4,8 @@ FILE: anonymousInDelegate.kt
}
public final val x: R|kotlin/Int|by R|kotlin/lazy|<R|kotlin/Int|>(<L> = lazy@fun <anonymous>(): R|kotlin/Int| {
lval foo: R|anonymous| = object : R|Foo| {
private[local] constructor(): R|anonymous| {
lval foo: R|<anonymous>| = object : R|Foo| {
private[local] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
@@ -15,7 +15,7 @@ FILE: anonymousInDelegate.kt
}
^ R|<local>/foo|.R|/anonymous.bar|()
^ R|<local>/foo|.R|/<anonymous>.bar|()
}
)
public get(): R|kotlin/Int| {

View File

@@ -117,7 +117,7 @@ digraph delegateWithAnonymousObject_kt {
subgraph cluster_11 {
color=red
66 [label="Enter class IssuesListUserProfile" style="filled" fillcolor=red];
64 [label="Enter class IssuesListUserProfile" style="filled" fillcolor=red];
subgraph cluster_12 {
color=blue
48 [label="Enter function setter" style="filled" fillcolor=red];
@@ -144,36 +144,32 @@ digraph delegateWithAnonymousObject_kt {
57 [label="Postponed exit from lambda"];
58 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...)"];
59 [label="Access variable this@R|/IssuesListUserProfile|"];
60 [label="Access variable this@R|/IssuesListUserProfile|"];
61 [label="Access variable this@R|/IssuesListUserProfile|"];
62 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...).<Unresolved name: provideDelegate>#(...)"];
63 [label="Postponed enter to lambda"];
60 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...).<Unresolved name: provideDelegate>#(...)"];
61 [label="Postponed enter to lambda"];
subgraph cluster_15 {
color=blue
21 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
23 [label="Exit anonymous object"];
22 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
64 [label="Postponed exit from lambda"];
65 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...)"];
62 [label="Postponed exit from lambda"];
63 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...)"];
55 [label="Exit property" style="filled" fillcolor=red];
}
67 [label="Exit class IssuesListUserProfile" style="filled" fillcolor=red];
65 [label="Exit class IssuesListUserProfile" style="filled" fillcolor=red];
}
66 -> {54} [color=green];
64 -> {54} [color=green];
54 -> {56};
55 -> {67} [color=green];
55 -> {65} [color=green];
56 -> {57};
57 -> {58};
58 -> {59};
59 -> {60};
60 -> {61};
61 -> {62};
61 -> {21} [color=red];
62 -> {63};
63 -> {64};
63 -> {21} [color=red];
64 -> {65};
65 -> {55};
63 -> {55};
21 -> {23};
21 -> {24 27 32} [color=red];
23 -> {22};

View File

@@ -24,7 +24,7 @@ FILE: delegateWithAnonymousObject.kt
public final var issueListView: R|IssueListView|by this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(<L> = delegate@fun <anonymous>(): R|kotlin/properties/ReadWriteProperty<IssuesListUserProfile, IssueListView>| {
^ object : R|kotlin/properties/ReadWriteProperty<IssuesListUserProfile, IssueListView>| {
private[local] constructor(): R|anonymous| {
private[local] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}

View File

@@ -7,19 +7,19 @@ FILE: simpleDelegatedToMap.kt
public final val map: R|kotlin/collections/MutableMap<kotlin/String, kotlin/Any>| = R|<local>/map|
public get(): R|kotlin/collections/MutableMap<kotlin/String, kotlin/Any>|
public final var foo: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>by R|<local>/map|
public get(): <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]> {
public final var foo: R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]|by R|<local>/map|
public get(): R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]| {
^ this@R|/C|.D|/C.foo|.<Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#(this@R|/C|, ::R|/C.foo|)
}
public set(<set-?>: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>): R|kotlin/Unit| {
public set(<set-?>: R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]|): R|kotlin/Unit| {
this@R|/C|.D|/C.foo|.<Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#(this@R|/C|, ::R|/C.foo|, R|<local>/foo|)
}
}
public final var bar: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>by R|kotlin/collections/hashMapOf|<R|kotlin/String|, R|kotlin/Any|>()
public get(): <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]> {
public final var bar: R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]|by R|kotlin/collections/hashMapOf|<R|kotlin/String|, R|kotlin/Any|>()
public get(): R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]| {
^ D|/bar|.<Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#(Null(null), ::R|/bar|)
}
public set(<set-?>: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>): R|kotlin/Unit| {
public set(<set-?>: R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]|): R|kotlin/Unit| {
D|/bar|.<Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#(Null(null), ::R|/bar|, R|<local>/bar|)
}

View File

@@ -1,8 +1,8 @@
FILE: problems.kt
public final val sb: R|java/lang/StringBuilder| = R|java/lang/StringBuilder.StringBuilder|()
public get(): R|java/lang/StringBuilder|
public final val o: R|anonymous| = object : R|kotlin/Any| {
private[local] constructor(): R|anonymous| {
public final val o: R|<anonymous>| = object : R|kotlin/Any| {
private[local] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
@@ -10,12 +10,12 @@ FILE: problems.kt
public get(): R|kotlin/String|
public[local] final fun test(): R|kotlin/Unit| {
this@R|/anonymous|.R|/anonymous.name|
this@R|/<anonymous>|.R|/<anonymous>.name|
}
}
public get(): R|anonymous|
public get(): R|<anonymous>|
public final fun test(): R|kotlin/Unit| {
local final class Local : R|kotlin/Any| {
public[local] constructor(): R|Local| {

View File

@@ -614,6 +614,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/debugInfoCall.kt");
}
@TestMetadata("errorCandidates.kt")
public void testErrorCandidates() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/errorCandidates.kt");
}
@TestMetadata("extensionInvokeAfterSafeCall.kt")
public void testExtensionInvokeAfterSafeCall() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/extensionInvokeAfterSafeCall.kt");
@@ -2152,6 +2157,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/assignSafeCall.kt");
}
@TestMetadata("boundSafeCallAndIsCheck.kt")
public void testBoundSafeCallAndIsCheck() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/boundSafeCallAndIsCheck.kt");
}
@TestMetadata("safeCallAndEqualityToBool.kt")
public void testSafeCallAndEqualityToBool() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.kt");
@@ -2241,6 +2251,24 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
}
}
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/types")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Types extends AbstractFirDiagnosticsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInTypes() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/types"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("bareWithSubjectTypeAlias.kt")
public void testBareWithSubjectTypeAlias() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/types/bareWithSubjectTypeAlias.kt");
}
}
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/visibility")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)

View File

@@ -614,6 +614,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/debugInfoCall.kt");
}
@TestMetadata("errorCandidates.kt")
public void testErrorCandidates() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/errorCandidates.kt");
}
@TestMetadata("extensionInvokeAfterSafeCall.kt")
public void testExtensionInvokeAfterSafeCall() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/extensionInvokeAfterSafeCall.kt");
@@ -2152,6 +2157,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/assignSafeCall.kt");
}
@TestMetadata("boundSafeCallAndIsCheck.kt")
public void testBoundSafeCallAndIsCheck() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/boundSafeCallAndIsCheck.kt");
}
@TestMetadata("safeCallAndEqualityToBool.kt")
public void testSafeCallAndEqualityToBool() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.kt");
@@ -2241,6 +2251,24 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
}
}
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/types")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Types extends AbstractFirDiagnosticsWithLightTreeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInTypes() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/types"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("bareWithSubjectTypeAlias.kt")
public void testBareWithSubjectTypeAlias() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/types/bareWithSubjectTypeAlias.kt");
}
}
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/visibility")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)

View File

@@ -10286,6 +10286,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/resolveWithUnknownLambdaParameterType.kt");
}
@TestMetadata("returningLambdaInSuspendContext.kt")
public void testReturningLambdaInSuspendContext() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/returningLambdaInSuspendContext.kt");
}
@TestMetadata("starApproximation.kt")
public void testStarApproximation() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/starApproximation.kt");

View File

@@ -11,9 +11,11 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.fir.backend.Fir2IrComponents
import org.jetbrains.kotlin.fir.resolve.firSymbolProvider
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
import org.jetbrains.org.objectweb.asm.Type
class FirJvmBackendClassResolver(val components: Fir2IrComponents) : JvmBackendClassResolver {
@ObsoleteDescriptorBasedAPI
override fun resolveToClassDescriptors(type: Type): List<ClassDescriptor> {
if (type.sort != Type.OBJECT) return emptyList()

View File

@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.fir.types.ConeKotlinErrorType
import org.jetbrains.kotlin.fir.types.ConeKotlinType
import org.jetbrains.kotlin.fir.types.FirTypeRef
import org.jetbrains.kotlin.fir.types.coneTypeUnsafe
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrField
import org.jetbrains.kotlin.ir.declarations.IrFunction
@@ -96,6 +97,7 @@ class FirJvmClassCodegen(
}
}
@OptIn(ObsoleteDescriptorBasedAPI::class)
override fun generateKotlinMetadataAnnotation() {
val localDelegatedProperties = (irClass.attributeOwnerId as? IrClass)?.let(context.localDelegatedProperties::get)

View File

@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.fir.serialization.FirElementSerializer
import org.jetbrains.kotlin.fir.serialization.FirSerializerExtension
import org.jetbrains.kotlin.fir.serialization.nonSourceAnnotations
import org.jetbrains.kotlin.fir.types.*
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.load.java.JvmAbi
import org.jetbrains.kotlin.load.kotlin.NON_EXISTENT_CLASS_NAME
@@ -75,6 +76,7 @@ class FirJvmSerializerExtension @JvmOverloads constructor(
return classBuilderMode != ClassBuilderMode.ABI || nestedClass.effectiveVisibility != FirEffectiveVisibilityImpl.Private
}
@OptIn(ObsoleteDescriptorBasedAPI::class)
override fun serializeClass(
klass: FirClass<*>,
proto: ProtoBuf.Class.Builder,

View File

@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.fir.scopes.impl.FirClassSubstitutionScope
import org.jetbrains.kotlin.fir.symbols.*
import org.jetbrains.kotlin.fir.symbols.impl.*
import org.jetbrains.kotlin.fir.types.*
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.impl.*
@@ -45,6 +46,7 @@ import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
@OptIn(ObsoleteDescriptorBasedAPI::class)
class Fir2IrDeclarationStorage(
private val components: Fir2IrComponents,
private val moduleDescriptor: FirModuleDescriptor,
@@ -600,7 +602,9 @@ class Fir2IrDeclarationStorage(
Name.special("<$prefix-${correspondingProperty.name}>"),
propertyAccessor?.visibility ?: correspondingProperty.visibility,
correspondingProperty.modality, accessorReturnType,
isInline = false, isExternal = false, isTailrec = false, isSuspend = false, isExpect = false,
isInline = propertyAccessor?.isInline == true,
isExternal = propertyAccessor?.isExternal == true,
isTailrec = false, isSuspend = false, isExpect = false,
isFakeOverride = origin == IrDeclarationOrigin.FAKE_OVERRIDE,
isOperator = false
).apply {
@@ -647,7 +651,6 @@ class Fir2IrDeclarationStorage(
name: Name,
isFinal: Boolean,
firInitializerExpression: FirExpression?,
thisReceiverOwner: IrClass?,
type: IrType? = null
): IrField {
val inferredType = type ?: firInitializerExpression!!.typeRef.toIrType()
@@ -657,14 +660,11 @@ class Fir2IrDeclarationStorage(
IrFieldImpl(
startOffset, endOffset, origin, symbol,
name, inferredType,
visibility, isFinal = isFinal, isExternal = false,
visibility, isFinal = isFinal,
isExternal = property.isExternal,
isStatic = property.isStatic || parent !is IrClass,
isFakeOverride = origin == IrDeclarationOrigin.FAKE_OVERRIDE
).also {
it.correspondingPropertySymbol = this@createBackingField.symbol
if (!isFakeOverride && thisReceiverOwner != null) {
it.populateOverriddenSymbols(thisReceiverOwner)
}
}.apply {
metadata = FirMetadataSource.Property(property)
convertAnnotationsFromLibrary(property)
@@ -710,8 +710,7 @@ class Fir2IrDeclarationStorage(
isConst = property.isConst,
isLateinit = property.isLateInit,
isDelegated = property.delegate != null,
// TODO
isExternal = false,
isExternal = property.isExternal,
isExpect = property.isExpect,
isFakeOverride = origin == IrDeclarationOrigin.FAKE_OVERRIDE
).apply {
@@ -734,7 +733,7 @@ class Fir2IrDeclarationStorage(
backingField = createBackingField(
property, IrDeclarationOrigin.PROPERTY_BACKING_FIELD, descriptor,
property.fieldVisibility, property.name, property.isVal, initializer,
thisReceiverOwner, type
type
).also { field ->
if (initializer is FirConstExpression<*>) {
// TODO: Normally we shouldn't have error type here
@@ -745,8 +744,7 @@ class Fir2IrDeclarationStorage(
} else if (delegate != null) {
backingField = createBackingField(
property, IrDeclarationOrigin.PROPERTY_DELEGATE, descriptor,
property.fieldVisibility, Name.identifier("${property.name}\$delegate"), true, delegate,
thisReceiverOwner
property.fieldVisibility, Name.identifier("${property.name}\$delegate"), true, delegate
)
}
if (irParent != null) {
@@ -799,8 +797,7 @@ class Fir2IrDeclarationStorage(
field.name, type, field.visibility,
isFinal = field.modality == Modality.FINAL,
isExternal = false,
isStatic = field.isStatic,
isFakeOverride = false
isStatic = field.isStatic
).apply {
metadata = FirMetadataSource.Variable(field)
descriptor.bind(this)
@@ -1024,13 +1021,6 @@ class Fir2IrDeclarationStorage(
}
}
private fun IrField.populateOverriddenSymbols(thisReceiverOwner: IrClass) {
thisReceiverOwner.findMatchingOverriddenSymbolsFromSupertypes(components.irBuiltIns, this)
.filterIsInstance<IrFieldSymbol>().singleOrNull()?.let {
overriddenSymbols = listOf(it)
}
}
private fun IrMutableAnnotationContainer.convertAnnotationsFromLibrary(firAnnotationContainer: FirAnnotationContainer) {
if ((firAnnotationContainer as? FirDeclaration)?.isFromLibrary == true) {
annotationGenerator?.generate(this, firAnnotationContainer)

View File

@@ -581,11 +581,15 @@ class Fir2IrVisitor(
KtNodeTypes.POSTFIX_EXPRESSION -> IrStatementOrigin.EXCLEXCL
else -> null
}
// If the constant true branch has empty body, it won't be converted. Thus, the entire `when` expression is effectively _not_
// exhaustive anymore. In that case, coerce the return type of `when` expression to Unit as per the backend expectation.
val effectivelyNotExhaustive = !whenExpression.isExhaustive ||
whenExpression.branches.any { it.condition is FirElseIfTrueCondition && it.result.statements.isEmpty() }
return conversionScope.withWhenSubject(subjectVariable) {
whenExpression.convertWithOffsets { startOffset, endOffset ->
val irWhen = IrWhenImpl(
startOffset, endOffset,
whenExpression.typeRef.toIrType(),
if (effectivelyNotExhaustive) irBuiltIns.unitType else whenExpression.typeRef.toIrType(),
origin
).apply {
var unconditionalBranchFound = false

View File

@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.fir.types.impl.FirImplicitNullableAnyTypeRef
import org.jetbrains.kotlin.fir.types.impl.FirImplicitStringTypeRef
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
import org.jetbrains.kotlin.ir.builders.IrGeneratorContextBase
import org.jetbrains.kotlin.ir.declarations.*
@@ -50,6 +51,7 @@ import org.jetbrains.kotlin.name.Name
* fir own logic that traverses class hierarchies in fir elements. Also, this one creates and passes IR elements, instead of providing how
* to declare them, to [DataClassMembersGenerator].
*/
@OptIn(ObsoleteDescriptorBasedAPI::class)
class DataClassMembersGenerator(val components: Fir2IrComponents) {
fun generateInlineClassMembers(klass: FirClass<*>, irClass: IrClass): List<Name> =

View File

@@ -10,12 +10,11 @@ import org.jetbrains.kotlin.fir.FirEffectiveVisibilityImpl
import org.jetbrains.kotlin.fir.FirElement
import org.jetbrains.kotlin.fir.backend.Fir2IrSignatureComposer
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.symbols.CallableId
import org.jetbrains.kotlin.fir.render
import org.jetbrains.kotlin.fir.symbols.CallableId
import org.jetbrains.kotlin.fir.visitors.FirVisitorVoid
import org.jetbrains.kotlin.ir.util.IdSignature
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
class FirBasedSignatureComposer(private val mangler: FirMangler) : Fir2IrSignatureComposer {
inner class SignatureBuilder : FirVisitorVoid() {
@@ -70,15 +69,21 @@ class FirBasedSignatureComposer(private val mangler: FirMangler) : Fir2IrSignatu
return when {
declaration is FirRegularClass && declaration.visibility != Visibilities.LOCAL -> {
val classId = declaration.classId
IdSignature.PublicSignature(classId.packageFqName, classId.relativeClassName, builder.hashId, builder.mask)
IdSignature.PublicSignature(
classId.packageFqName.asString(), classId.relativeClassName.asString(), builder.hashId, builder.mask
)
}
declaration is FirTypeAlias -> {
val classId = declaration.symbol.classId
IdSignature.PublicSignature(classId.packageFqName, classId.relativeClassName, builder.hashId, builder.mask)
IdSignature.PublicSignature(
classId.packageFqName.asString(), classId.relativeClassName.asString(), builder.hashId, builder.mask
)
}
declaration is FirCallableMemberDeclaration<*> -> {
val callableId = declaration.symbol.callableId
IdSignature.PublicSignature(callableId.packageName, callableId.relativeCallableName, builder.hashId, builder.mask)
IdSignature.PublicSignature(
callableId.packageName.asString(), callableId.relativeCallableName.asString(), builder.hashId, builder.mask
)
}
else -> throw AssertionError("Unsupported FIR declaration in signature composer: ${declaration.render()}")
}
@@ -87,10 +92,10 @@ class FirBasedSignatureComposer(private val mangler: FirMangler) : Fir2IrSignatu
override fun composeAccessorSignature(property: FirProperty, isSetter: Boolean): IdSignature? {
val propertySignature = composeSignature(property) as? IdSignature.PublicSignature ?: return null
val accessorFqName = if (isSetter) {
propertySignature.declarationFqn.child(Name.special("<set-${property.name}>"))
propertySignature.declarationFqName + ".<set-${property.name.asString()}>"
} else {
propertySignature.declarationFqn.child(Name.special("<get-${property.name}>"))
propertySignature.declarationFqName + ".<get-${property.name.asString()}>"
}
return IdSignature.PublicSignature(propertySignature.packageFqn, accessorFqName, propertySignature.id, propertySignature.mask)
return IdSignature.PublicSignature(propertySignature.packageFqName, accessorFqName, propertySignature.id, propertySignature.mask)
}
}
}

View File

@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir.symbols
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.SourceElement
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.descriptors.*
import org.jetbrains.kotlin.ir.symbols.IrBindableSymbol
@@ -36,6 +37,7 @@ abstract class Fir2IrBindableSymbol<out D : DeclarationDescriptor, B : IrSymbolO
override val isBound: Boolean
get() = _owner != null
@ObsoleteDescriptorBasedAPI
override val descriptor: D by lazy {
when (val owner = owner) {
is IrEnumEntry -> WrappedEnumEntryDescriptor().apply { bind(owner) }

View File

@@ -7495,11 +7495,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines");
}
@TestMetadata("listThrowablePairInOneSlot.kt")
public void testListThrowablePairInOneSlot() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/listThrowablePairInOneSlot.kt");
}
@TestMetadata("loadFromBooleanArray.kt")
public void testLoadFromBooleanArray_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines");
@@ -8343,11 +8338,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/kt19475.kt", "kotlin.coroutines");
}
@TestMetadata("kt38925.kt")
public void testKt38925_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/kt38925.kt", "kotlin.coroutines");
}
@TestMetadata("nullSpilling.kt")
public void testNullSpilling_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/nullSpilling.kt", "kotlin.coroutines");
@@ -11219,6 +11209,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/funInterface/basicFunInterfaceConversion.kt");
}
@TestMetadata("basicFunInterfaceConversionClash.kt")
public void testBasicFunInterfaceConversionClash() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/basicFunInterfaceConversionClash.kt");
}
@TestMetadata("castFromAny.kt")
public void testCastFromAny() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/castFromAny.kt");
@@ -14135,6 +14130,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/innerNested/innerGenericClassFromJava.kt");
}
@TestMetadata("innerImplicitParameter.kt")
public void testInnerImplicitParameter() throws Exception {
runTest("compiler/testData/codegen/box/innerNested/innerImplicitParameter.kt");
}
@TestMetadata("innerJavaClass.kt")
public void testInnerJavaClass() throws Exception {
runTest("compiler/testData/codegen/box/innerNested/innerJavaClass.kt");
@@ -26077,6 +26077,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/mapping/types"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@TestMetadata("allSupertypes.kt")
public void testAllSupertypes() throws Exception {
runTest("compiler/testData/codegen/box/reflection/mapping/types/allSupertypes.kt");
}
@TestMetadata("annotationConstructorParameters.kt")
public void testAnnotationConstructorParameters() throws Exception {
runTest("compiler/testData/codegen/box/reflection/mapping/types/annotationConstructorParameters.kt");
@@ -26092,6 +26097,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/reflection/mapping/types/constructors.kt");
}
@TestMetadata("createType.kt")
public void testCreateType() throws Exception {
runTest("compiler/testData/codegen/box/reflection/mapping/types/createType.kt");
}
@TestMetadata("genericArrayElementType.kt")
public void testGenericArrayElementType() throws Exception {
runTest("compiler/testData/codegen/box/reflection/mapping/types/genericArrayElementType.kt");

View File

@@ -1012,6 +1012,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
runTest("compiler/testData/ir/irText/expressions/javaSyntheticPropertyAccess.kt");
}
@TestMetadata("jvmFieldReferenceWithIntersectionTypes.kt")
public void testJvmFieldReferenceWithIntersectionTypes() throws Exception {
runTest("compiler/testData/ir/irText/expressions/jvmFieldReferenceWithIntersectionTypes.kt");
}
@TestMetadata("jvmInstanceFieldReference.kt")
public void testJvmInstanceFieldReference() throws Exception {
runTest("compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt");

View File

@@ -99,7 +99,7 @@ abstract class BaseFirBuilder<T>(val baseSession: FirSession, val context: Conte
CallableId(name, pathFqName)
}
context.className == FqName.ROOT -> CallableId(context.packageFqName, name)
context.className.shortName() === ANONYMOUS_OBJECT_NAME -> CallableId(ANONYMOUS_CLASS_ID, name)
context.className.shortName() == ANONYMOUS_OBJECT_NAME -> CallableId(ANONYMOUS_CLASS_ID, name)
else -> CallableId(context.packageFqName, context.className, name)
}

View File

@@ -726,7 +726,7 @@ class DeclarationsConverter(
source = anonymousInitializer.toFirSourceElement()
session = baseSession
origin = FirDeclarationOrigin.Source
body = if (stubMode) buildEmptyExpressionBlock() else firBlock
body = if (stubMode) buildEmptyExpressionBlock() else firBlock ?: buildEmptyExpressionBlock()
}
}
@@ -940,16 +940,8 @@ class DeclarationsConverter(
}
val propertyVisibility = modifiers.getVisibility()
status = FirDeclarationStatusImpl(propertyVisibility, modifiers.getModality()).apply {
isExpect = modifiers.hasExpect()
isActual = modifiers.hasActual()
isOverride = modifiers.hasOverride()
isConst = modifiers.isConst()
isLateInit = modifiers.hasLateinit()
}
val convertedAccessors = accessors.map { convertGetterOrSetter(it, returnType, propertyVisibility) }
val convertedAccessors = accessors.map { convertGetterOrSetter(it, returnType, propertyVisibility, modifiers) }
this.getter = convertedAccessors.find { it.isGetter }
?: FirDefaultPropertyGetter(null, session, FirDeclarationOrigin.Source, returnType, propertyVisibility)
this.setter =
@@ -958,6 +950,19 @@ class DeclarationsConverter(
?: FirDefaultPropertySetter(null, session, FirDeclarationOrigin.Source, returnType, propertyVisibility)
} else null
// Upward propagation of `inline` and `external` modifiers (from accessors to property)
// Note that, depending on `var` or `val`, checking setter's modifiers should be careful: for `val`, setter doesn't
// exist (null); for `var`, the retrieval of the specific modifier is supposed to be `true`
status = FirDeclarationStatusImpl(propertyVisibility, modifiers.getModality()).apply {
isExpect = modifiers.hasExpect()
isActual = modifiers.hasActual()
isOverride = modifiers.hasOverride()
isConst = modifiers.isConst()
isLateInit = modifiers.hasLateinit()
isInline = modifiers.hasInline() || (getter!!.isInline && setter?.isInline != false)
isExternal = modifiers.hasExternal() || (getter!!.isExternal && setter?.isExternal != false)
}
val receiver = delegateExpression?.let {
expressionConverter.getAsFirExpression<FirExpression>(it, "Should have delegate")
}
@@ -1031,7 +1036,8 @@ class DeclarationsConverter(
private fun convertGetterOrSetter(
getterOrSetter: LighterASTNode,
propertyTypeRef: FirTypeRef,
propertyVisibility: Visibility
propertyVisibility: Visibility,
propertyModifiers: Modifier
): FirPropertyAccessor {
var modifiers = Modifier()
var isGetter = true
@@ -1060,6 +1066,12 @@ class DeclarationsConverter(
if (accessorVisibility == Visibilities.UNKNOWN) {
accessorVisibility = propertyVisibility
}
val status =
// Downward propagation of `inline` and `external` modifiers (from property to its accessors)
FirDeclarationStatusImpl(accessorVisibility, Modality.FINAL).apply {
isInline = propertyModifiers.hasInline() || modifiers.hasInline()
isExternal = propertyModifiers.hasExternal() || modifiers.hasExternal()
}
val sourceElement = getterOrSetter.toFirSourceElement()
if (block == null && expression == null) {
return FirDefaultPropertyAccessor
@@ -1073,6 +1085,7 @@ class DeclarationsConverter(
)
.also {
it.annotations += modifiers.annotations
it.status = status
}
}
val target = FirFunctionTarget(labelName = null, isLambda = false)
@@ -1083,7 +1096,7 @@ class DeclarationsConverter(
returnTypeRef = returnType ?: if (isGetter) propertyTypeRef else implicitUnitType
symbol = FirPropertyAccessorSymbol()
this.isGetter = isGetter
status = FirDeclarationStatusImpl(accessorVisibility, Modality.FINAL)
this.status = status
context.firFunctionTargets += target
annotations += modifiers.annotations

View File

@@ -261,6 +261,14 @@ class RawFirBuilder(
): FirPropertyAccessor {
val accessorVisibility =
if (this?.visibility != null && this.visibility != Visibilities.UNKNOWN) this.visibility else property.visibility
// Downward propagation of `inline` and `external` modifiers (from property to its accessors)
val status =
FirDeclarationStatusImpl(accessorVisibility, Modality.FINAL).apply {
isInline = property.hasModifier(INLINE_KEYWORD) ||
this@toFirPropertyAccessor?.hasModifier(INLINE_KEYWORD) == true
isExternal = property.hasModifier(EXTERNAL_KEYWORD) ||
this@toFirPropertyAccessor?.hasModifier(EXTERNAL_KEYWORD) == true
}
if (this == null || !hasBody()) {
val propertySource = property.toFirSourceElement()
return FirDefaultPropertyAccessor
@@ -276,6 +284,7 @@ class RawFirBuilder(
if (this != null) {
it.extractAnnotationsFrom(this)
}
it.status = status
}
}
val source = this.toFirSourceElement()
@@ -290,7 +299,7 @@ class RawFirBuilder(
returnTypeReference.toFirOrUnitType()
}
this.isGetter = isGetter
status = FirDeclarationStatusImpl(accessorVisibility, Modality.FINAL)
this.status = status
extractAnnotationsTo(this)
this@RawFirBuilder.context.firFunctionTargets += accessorTarget
extractValueParametersTo(this, propertyTypeRef)
@@ -1078,19 +1087,25 @@ class RawFirBuilder(
expression = { delegateExpression }.toFirExpression("Should have delegate")
}
} else null
getter = this@toFirProperty.getter.toFirPropertyAccessor(this@toFirProperty, propertyType, isGetter = true)
setter = if (isVar) {
this@toFirProperty.setter.toFirPropertyAccessor(this@toFirProperty, propertyType, isGetter = false)
} else null
// Upward propagation of `inline` and `external` modifiers (from accessors to property)
// Note that, depending on `var` or `val`, checking setter's modifiers should be careful: for `val`, setter doesn't
// exist (null); for `var`, the retrieval of the specific modifier is supposed to be `true`
status = FirDeclarationStatusImpl(visibility, modality).apply {
isExpect = hasExpectModifier()
isActual = hasActualModifier()
isOverride = hasModifier(OVERRIDE_KEYWORD)
isConst = hasModifier(CONST_KEYWORD)
isLateInit = hasModifier(LATEINIT_KEYWORD)
isInline = hasModifier(INLINE_KEYWORD) || (getter!!.isInline && setter?.isInline != false)
isExternal = hasModifier(EXTERNAL_KEYWORD) || (getter!!.isExternal && setter?.isExternal != false)
}
getter = this@toFirProperty.getter.toFirPropertyAccessor(this@toFirProperty, propertyType, isGetter = true)
setter = if (isVar) {
this@toFirProperty.setter.toFirPropertyAccessor(this@toFirProperty, propertyType, isGetter = false)
} else null
val receiver = delegateExpression?.toFirExpression("Should have delegate")
generateAccessorsByDelegate(
delegateBuilder,
@@ -1350,6 +1365,7 @@ class RawFirBuilder(
else -> null
}
val hasSubject = subjectExpression != null
@OptIn(FirContractViolation::class)
val ref = FirExpressionRef<FirWhenExpression>()
return buildWhenExpression {

View File

@@ -30,14 +30,14 @@ FILE: annotation.kt
}
public final static enum entry FIRST: R|My| = @base() object : R|My| {
private constructor(): R|anonymous| {
private constructor(): R|<anonymous>| {
super<R|My|>()
}
}
public final static enum entry SECOND: R|My| = @base() object : R|My| {
private constructor(): R|anonymous| {
private constructor(): R|<anonymous>| {
super<R|My|>()
}

View File

@@ -14,12 +14,12 @@ FILE: constructorInObject.kt
}
public final static enum entry X: R|B| = object : R|B| {
private constructor(): R|anonymous| {
private constructor(): R|<anonymous>| {
super<R|B|>()
}
public? constructor(): R|anonymous| {
this<R|anonymous|>()
public? constructor(): R|<anonymous>| {
this<R|<anonymous>|>()
}
}
@@ -45,7 +45,7 @@ FILE: constructorInObject.kt
}
public? final? val anonObject: <implicit> = object : R|kotlin/Any| {
public? constructor(): R|anonymous| {
public? constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}

View File

@@ -1,7 +1,7 @@
FILE: constructorOfAnonymousObject.kt
private final? fun resolveAccessorCall(suspendPropertyDescriptor: PropertyDescriptor, context: TranslationContext): ResolvedCall<PropertyDescriptor> {
^resolveAccessorCall object : ResolvedCall<PropertyDescriptor> {
private constructor(): R|anonymous| {
private constructor(): R|<anonymous>| {
super<<implicit>>()
}

View File

@@ -1,7 +1,7 @@
FILE: emptyAnonymousObject.kt
public? final? fun test(): R|kotlin/Unit| {
lval x: <implicit> = object : R|kotlin/Any| {
private constructor(): R|anonymous| {
private constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}

View File

@@ -26,7 +26,7 @@ FILE: enums.kt
internal get(): Double
public final static enum entry MERCURY: R|Planet| = object : R|Planet| {
private constructor(): R|anonymous| {
private constructor(): R|<anonymous>| {
super<R|Planet|>(Double(1.0), Double(2.0))
}
@@ -37,7 +37,7 @@ FILE: enums.kt
}
public final static enum entry VENERA: R|Planet| = object : R|Planet| {
private constructor(): R|anonymous| {
private constructor(): R|<anonymous>| {
super<R|Planet|>(Double(3.0), Double(4.0))
}
@@ -48,7 +48,7 @@ FILE: enums.kt
}
public final static enum entry EARTH: R|Planet| = object : R|Planet| {
private constructor(): R|anonymous| {
private constructor(): R|<anonymous>| {
super<R|Planet|>(Double(5.0), Double(6.0))
}
@@ -89,49 +89,49 @@ FILE: enums.kt
public? get(): String
public final static enum entry FIX_STACK_BEFORE_JUMP: R|PseudoInsn| = object : R|PseudoInsn| {
private constructor(): R|anonymous| {
private constructor(): R|<anonymous>| {
super<R|PseudoInsn|>()
}
}
public final static enum entry FAKE_ALWAYS_TRUE_IFEQ: R|PseudoInsn| = object : R|PseudoInsn| {
private constructor(): R|anonymous| {
private constructor(): R|<anonymous>| {
super<R|PseudoInsn|>(String(()I))
}
}
public final static enum entry FAKE_ALWAYS_FALSE_IFEQ: R|PseudoInsn| = object : R|PseudoInsn| {
private constructor(): R|anonymous| {
private constructor(): R|<anonymous>| {
super<R|PseudoInsn|>(String(()I))
}
}
public final static enum entry SAVE_STACK_BEFORE_TRY: R|PseudoInsn| = object : R|PseudoInsn| {
private constructor(): R|anonymous| {
private constructor(): R|<anonymous>| {
super<R|PseudoInsn|>()
}
}
public final static enum entry RESTORE_STACK_IN_TRY_CATCH: R|PseudoInsn| = object : R|PseudoInsn| {
private constructor(): R|anonymous| {
private constructor(): R|<anonymous>| {
super<R|PseudoInsn|>()
}
}
public final static enum entry STORE_NOT_NULL: R|PseudoInsn| = object : R|PseudoInsn| {
private constructor(): R|anonymous| {
private constructor(): R|<anonymous>| {
super<R|PseudoInsn|>()
}
}
public final static enum entry AS_NOT_NULL: R|PseudoInsn| = object : R|PseudoInsn| {
private constructor(): R|anonymous| {
private constructor(): R|<anonymous>| {
super<R|PseudoInsn|>(String((Ljava/lang/Object;)Ljava/lang/Object;))
}

View File

@@ -22,7 +22,7 @@ FILE: enums2.kt
public? get(): Some
public final static enum entry FIRST: R|SomeEnum| = object : R|SomeEnum| {
private constructor(): R|anonymous| {
private constructor(): R|<anonymous>| {
super<R|SomeEnum|>(O1#)
}
@@ -33,7 +33,7 @@ FILE: enums2.kt
}
public final static enum entry SECOND: R|SomeEnum| = object : R|SomeEnum| {
private constructor(): R|anonymous| {
private constructor(): R|<anonymous>| {
super<R|SomeEnum|>(O2#)
}

View File

@@ -20,7 +20,7 @@ FILE: locals.kt
}
lval code: <implicit> = object : Any {
private constructor(): R|anonymous| {
private constructor(): R|<anonymous>| {
super<Any>()
}

View File

@@ -20,7 +20,6 @@ import org.jetbrains.kotlin.fir.references.FirErrorNamedReference
import org.jetbrains.kotlin.fir.render
import org.jetbrains.kotlin.fir.visitors.FirVisitorVoid
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.getStartOffsetIn
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
import org.jetbrains.kotlin.psi.psiUtil.parents
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners
@@ -52,7 +51,8 @@ class RawFirBuilderTotalKotlinTestCase : AbstractRawFirBuilderTestCase() {
println("BASE PATH: $testDataPath")
for (file in root.walkTopDown()) {
if (file.isDirectory) continue
if (file.path.contains("testData") || file.path.contains("resources")) continue
val path = file.path
if ("testData" in path || "resources" in path || "api/js" in path.replace('\\', '/')) continue
if (file.extension != "kt") continue
try {
val ktFile = createKtFile(file.toRelativeString(root))
@@ -175,7 +175,8 @@ class RawFirBuilderTotalKotlinTestCase : AbstractRawFirBuilderTestCase() {
val root = File(testDataPath)
for (file in root.walkTopDown()) {
if (file.isDirectory) continue
if (file.path.contains("testData") || file.path.contains("resources")) continue
val path = file.path
if ("testData" in path || "resources" in path || "api/js" in path.replace('\\', '/')) continue
if (file.extension != "kt") continue
val ktFile = createKtFile(file.toRelativeString(root))
val firFile = ktFile.toFirFile(stubMode = false)
@@ -201,7 +202,8 @@ class RawFirBuilderTotalKotlinTestCase : AbstractRawFirBuilderTestCase() {
var counter = 0
for (file in root.walkTopDown()) {
if (file.isDirectory) continue
if (file.path.contains("testData") || file.path.contains("resources")) continue
val path = file.path
if ("testData" in path || "resources" in path || "api/js" in path.replace('\\', '/')) continue
if (file.extension != "kt") continue
val ktFile = createKtFile(file.toRelativeString(root))
val firFile: FirFile = ktFile.toFirFile(stubMode = false)

View File

@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir
import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration
import org.jetbrains.kotlin.fir.declarations.isInner
import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic
import org.jetbrains.kotlin.fir.expressions.*
import org.jetbrains.kotlin.fir.expressions.builder.buildExpressionStub
import org.jetbrains.kotlin.fir.expressions.builder.buildResolvedReifiedParameterReference
@@ -73,13 +74,14 @@ class FirCallResolver(
val nameReference = createResolvedNamedReference(
functionCall.calleeReference,
name,
result.info,
result.candidates,
result.applicability,
functionCall.explicitReceiver,
)
val resultExpression = functionCall.transformCalleeReference(StoreNameReference, nameReference)
val candidate = resultExpression.candidate()
val candidate = (nameReference as? FirNamedReferenceWithCandidate)?.candidate
// We need desugaring
val resultFunctionCall = if (candidate != null && candidate.callInfo != result.info) {
@@ -162,6 +164,7 @@ class FirCallResolver(
val nameReference = createResolvedNamedReference(
callee,
callee.name,
result.info,
reducedCandidates,
result.applicability,
qualifiedAccess.explicitReceiver,
@@ -284,11 +287,11 @@ class FirCallResolver(
constructorClassSymbol,
)
return callResolver.selectDelegatingConstructorCall(delegatedConstructorCall, name, result)
return callResolver.selectDelegatingConstructorCall(delegatedConstructorCall, name, result, callInfo)
}
private fun selectDelegatingConstructorCall(
call: FirDelegatedConstructorCall, name: Name, result: CandidateCollector,
call: FirDelegatedConstructorCall, name: Name, result: CandidateCollector, callInfo: CallInfo
): FirDelegatedConstructorCall {
val bestCandidates = result.bestCandidates()
val reducedCandidates = if (result.currentApplicability < CandidateApplicability.SYNTHETIC_RESOLVED) {
@@ -300,6 +303,7 @@ class FirCallResolver(
val nameReference = createResolvedNamedReference(
call.calleeReference,
name,
callInfo,
reducedCandidates,
result.currentApplicability,
)
@@ -348,29 +352,31 @@ class FirCallResolver(
private fun createResolvedNamedReference(
reference: FirReference,
name: Name,
callInfo: CallInfo,
candidates: Collection<Candidate>,
applicability: CandidateApplicability,
explicitReceiver: FirExpression? = null,
): FirNamedReference {
val source = reference.source
return when {
candidates.isEmpty() -> buildErrorNamedReference {
this.source = source
diagnostic = ConeUnresolvedNameError(name)
}
candidates.isEmpty() -> buildErrorReference(
callInfo,
ConeUnresolvedNameError(name),
source,
name
)
applicability < CandidateApplicability.SYNTHETIC_RESOLVED -> {
buildErrorNamedReference {
this.source = source
diagnostic = ConeInapplicableCandidateError(
applicability,
candidates.map {
ConeInapplicableCandidateError.CandidateInfo(
it.symbol,
if (it.systemInitialized) it.system.diagnostics else emptyList(),
)
},
)
}
val diagnostic = ConeInapplicableCandidateError(
applicability,
candidates.map {
ConeInapplicableCandidateError.CandidateInfo(
it.symbol,
if (it.systemInitialized) it.system.diagnostics else emptyList(),
)
}
)
buildErrorReference(callInfo, diagnostic, source, name)
}
candidates.size == 1 -> {
val candidate = candidates.single()
@@ -396,10 +402,23 @@ class FirCallResolver(
}
FirNamedReferenceWithCandidate(source, name, candidate)
}
else -> buildErrorNamedReference {
this.source = source
diagnostic = ConeAmbiguityError(name, candidates.map { it.symbol })
}
else -> buildErrorReference(
callInfo,
ConeAmbiguityError(name, candidates.map { it.symbol }),
source,
name
)
}
}
private fun buildErrorReference(
callInfo: CallInfo,
diagnostic: ConeDiagnostic,
source: FirSourceElement?,
name: Name
): FirErrorReferenceWithCandidate {
val candidate = CandidateFactory(components, callInfo).createErrorCandidate(diagnostic)
resolutionStageRunner.processCandidate(candidate, stopOnFirstError = false)
return FirErrorReferenceWithCandidate(source, name, candidate, diagnostic)
}
}

View File

@@ -8,13 +8,15 @@ package org.jetbrains.kotlin.fir.resolve
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.functions.FunctionClassDescriptor
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.fir.*
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.FirSourceElement
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.diagnostics.ConeStubDiagnostic
import org.jetbrains.kotlin.fir.expressions.*
import org.jetbrains.kotlin.fir.expressions.builder.FirResolvedReifiedParameterReferenceBuilder
import org.jetbrains.kotlin.fir.expressions.builder.buildExpressionWithSmartcast
import org.jetbrains.kotlin.fir.expressions.builder.buildResolvedQualifier
import org.jetbrains.kotlin.fir.inferenceContext
import org.jetbrains.kotlin.fir.references.FirErrorNamedReference
import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference
import org.jetbrains.kotlin.fir.references.FirSuperReference
@@ -28,6 +30,7 @@ import org.jetbrains.kotlin.fir.resolve.providers.bindSymbolToLookupTag
import org.jetbrains.kotlin.fir.resolve.providers.getSymbolByTypeRef
import org.jetbrains.kotlin.fir.resolve.substitution.AbstractConeSubstitutor
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.resultType
import org.jetbrains.kotlin.fir.resolvedTypeFromPrototype
import org.jetbrains.kotlin.fir.scopes.impl.FirDeclaredMemberScopeProvider
import org.jetbrains.kotlin.fir.scopes.impl.withReplacedConeType
import org.jetbrains.kotlin.fir.symbols.*
@@ -87,6 +90,15 @@ fun ConeClassLikeType.fullyExpandedType(
return fullyExpandedTypeNoCache(useSiteSession, expandedConeType)
}
fun ConeKotlinType.fullyExpandedType(
useSiteSession: FirSession
): ConeKotlinType = when (this) {
is ConeFlexibleType ->
ConeFlexibleType(lowerBound.fullyExpandedType(useSiteSession), upperBound.fullyExpandedType(useSiteSession))
is ConeClassLikeType -> fullyExpandedType(useSiteSession)
else -> this
}
private fun ConeClassLikeType.fullyExpandedTypeNoCache(
useSiteSession: FirSession,
expandedConeType: (FirTypeAlias) -> ConeClassLikeType?,

View File

@@ -35,8 +35,8 @@ import org.jetbrains.kotlin.utils.addToStdlib.safeAs
fun Candidate.resolveArgumentExpression(
csBuilder: ConstraintSystemBuilder,
argument: FirExpression,
expectedType: ConeKotlinType,
expectedTypeRef: FirTypeRef,
expectedType: ConeKotlinType?,
expectedTypeRef: FirTypeRef?,
sink: CheckerSink,
isReceiver: Boolean,
isDispatch: Boolean
@@ -73,7 +73,7 @@ fun Candidate.resolveArgumentExpression(
checkApplicabilityForArgumentType(
csBuilder,
StandardClassIds.Unit.constructClassLikeType(emptyArray(), isNullable = false),
expectedType.type,
expectedType?.type,
SimpleConstraintSystemConstraintPosition,
isReceiver = false,
isDispatch = false,
@@ -122,8 +122,8 @@ fun Candidate.resolveArgumentExpression(
private fun Candidate.resolveBlockArgument(
csBuilder: ConstraintSystemBuilder,
block: FirBlock,
expectedType: ConeKotlinType,
expectedTypeRef: FirTypeRef,
expectedType: ConeKotlinType?,
expectedTypeRef: FirTypeRef?,
sink: CheckerSink,
isReceiver: Boolean,
isDispatch: Boolean
@@ -133,7 +133,7 @@ private fun Candidate.resolveBlockArgument(
checkApplicabilityForArgumentType(
csBuilder,
block.typeRef.coneTypeUnsafe(),
expectedType.type,
expectedType?.type,
SimpleConstraintSystemConstraintPosition,
isReceiver = false,
isDispatch = false,
@@ -157,7 +157,7 @@ private fun Candidate.resolveBlockArgument(
fun Candidate.resolveSubCallArgument(
csBuilder: ConstraintSystemBuilder,
argument: FirResolvable,
expectedType: ConeKotlinType,
expectedType: ConeKotlinType?,
sink: CheckerSink,
isReceiver: Boolean,
isDispatch: Boolean,
@@ -210,7 +210,7 @@ private fun Candidate.checkApplicabilityForIntegerOperatorCall(sink: CheckerSink
fun Candidate.resolvePlainArgumentType(
csBuilder: ConstraintSystemBuilder,
argumentType: ConeKotlinType,
expectedType: ConeKotlinType,
expectedType: ConeKotlinType?,
sink: CheckerSink,
isReceiver: Boolean,
isDispatch: Boolean,
@@ -257,12 +257,13 @@ private fun Candidate.captureTypeFromExpressionOrNull(argumentType: ConeKotlinTy
private fun checkApplicabilityForArgumentType(
csBuilder: ConstraintSystemBuilder,
argumentType: ConeKotlinType,
expectedType: ConeKotlinType,
expectedType: ConeKotlinType?,
position: SimpleConstraintSystemConstraintPosition,
isReceiver: Boolean,
isDispatch: Boolean,
sink: CheckerSink
) {
if (expectedType == null) return
if (isReceiver && isDispatch) {
if (!expectedType.isNullable && argumentType.isMarkedNullable) {
sink.reportApplicability(CandidateApplicability.WRONG_RECEIVER)
@@ -288,7 +289,7 @@ private fun checkApplicabilityForArgumentType(
internal fun Candidate.resolveArgument(
argument: FirExpression,
parameter: FirValueParameter,
parameter: FirValueParameter?,
isReceiver: Boolean,
isSafeCall: Boolean,
sink: CheckerSink
@@ -299,14 +300,15 @@ internal fun Candidate.resolveArgument(
this.system.getBuilder(),
argument,
expectedType,
parameter.returnTypeRef,
parameter?.returnTypeRef,
sink,
isReceiver,
false
)
}
private fun Candidate.prepareExpectedType(session: FirSession, argument: FirExpression, parameter: FirValueParameter): ConeKotlinType {
private fun Candidate.prepareExpectedType(session: FirSession, argument: FirExpression, parameter: FirValueParameter?): ConeKotlinType? {
if (parameter == null) return null
if (parameter.returnTypeRef is FirILTTypeRefPlaceHolder) return argument.resultType.coneTypeUnsafe()
val basicExpectedType = argument.getExpectedType(session, parameter/*, LanguageVersionSettings*/)
val expectedType = getExpectedTypeWithSAMConversion(session, argument, basicExpectedType) ?: basicExpectedType

View File

@@ -5,10 +5,19 @@
package org.jetbrains.kotlin.fir.resolve.calls
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
import org.jetbrains.kotlin.fir.declarations.builder.buildErrorFunction
import org.jetbrains.kotlin.fir.declarations.builder.buildErrorProperty
import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic
import org.jetbrains.kotlin.fir.expressions.*
import org.jetbrains.kotlin.fir.resolve.BodyResolveComponents
import org.jetbrains.kotlin.fir.returnExpressions
import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirErrorFunctionSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirErrorPropertySymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
import org.jetbrains.kotlin.resolve.calls.components.PostponedArgumentsAnalyzer
import org.jetbrains.kotlin.resolve.calls.inference.model.ConstraintStorage
import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind
@@ -55,6 +64,51 @@ class CandidateFactory private constructor(
} ?: callInfo
)
}
fun createErrorCandidate(diagnostic: ConeDiagnostic): Candidate {
val symbol: AbstractFirBasedSymbol<*> = when (callInfo.callKind) {
CallKind.VariableAccess -> createErrorPropertySymbol(diagnostic)
CallKind.Function,
CallKind.DelegatingConstructorCall,
CallKind.CallableReference -> createErrorFunctionSymbol(diagnostic)
CallKind.SyntheticSelect -> throw IllegalStateException()
CallKind.SyntheticIdForCallableReferencesResolution -> throw IllegalStateException()
}
return Candidate(
symbol,
dispatchReceiverValue = null,
implicitExtensionReceiverValue = null,
explicitReceiverKind = ExplicitReceiverKind.NO_EXPLICIT_RECEIVER,
bodyResolveComponents,
baseSystem,
callInfo
)
}
private fun createErrorFunctionSymbol(diagnostic: ConeDiagnostic): FirErrorFunctionSymbol {
return FirErrorFunctionSymbol().also {
buildErrorFunction {
session = this@CandidateFactory.bodyResolveComponents.session
resolvePhase = FirResolvePhase.BODY_RESOLVE
origin = FirDeclarationOrigin.Synthetic
this.diagnostic = diagnostic
symbol = it
}
}
}
private fun createErrorPropertySymbol(diagnostic: ConeDiagnostic): FirErrorPropertySymbol {
return FirErrorPropertySymbol(diagnostic).also {
buildErrorProperty {
session = this@CandidateFactory.bodyResolveComponents.session
resolvePhase = FirResolvePhase.BODY_RESOLVE
origin = FirDeclarationOrigin.Synthetic
name = FirErrorPropertySymbol.NAME
this.diagnostic = diagnostic
symbol = it
}
}
}
}
fun PostponedArgumentsAnalyzer.Context.addSubsystemFromExpression(statement: FirStatement) {

View File

@@ -32,7 +32,11 @@ suspend inline fun CheckerSink.yieldApplicability(new: CandidateApplicability) {
yieldIfNeed()
}
class CheckerSinkImpl(override val components: InferenceComponents, var continuation: Continuation<Unit>? = null) : CheckerSink() {
class CheckerSinkImpl(
override val components: InferenceComponents,
var continuation: Continuation<Unit>? = null,
val stopOnFirstError: Boolean = true
) : CheckerSink() {
var current = CandidateApplicability.RESOLVED
private set
@@ -47,6 +51,6 @@ class CheckerSinkImpl(override val components: InferenceComponents, var continua
}
override val needYielding: Boolean
get() = current < CandidateApplicability.SYNTHETIC_RESOLVED
get() = stopOnFirstError && current < CandidateApplicability.SYNTHETIC_RESOLVED
}

View File

@@ -7,16 +7,28 @@ package org.jetbrains.kotlin.fir.resolve.calls
import org.jetbrains.kotlin.fir.FirImplementationDetail
import org.jetbrains.kotlin.fir.FirSourceElement
import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic
import org.jetbrains.kotlin.fir.references.impl.FirSimpleNamedReference
import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol
import org.jetbrains.kotlin.name.Name
@OptIn(FirImplementationDetail::class)
class FirNamedReferenceWithCandidate(
open class FirNamedReferenceWithCandidate(
source: FirSourceElement?,
name: Name,
val candidate: Candidate
) : FirSimpleNamedReference(source, name, candidate.symbol) {
override val candidateSymbol: AbstractFirBasedSymbol<*>
get() = candidate.symbol
open val isError: Boolean get() = false
}
class FirErrorReferenceWithCandidate(
source: FirSourceElement?,
name: Name,
candidate: Candidate,
val diagnostic: ConeDiagnostic
) : FirNamedReferenceWithCandidate(source, name, candidate) {
override val isError: Boolean get() = true
}

View File

@@ -13,8 +13,8 @@ import kotlin.coroutines.intrinsics.createCoroutineUnintercepted
import kotlin.coroutines.resume
class ResolutionStageRunner(val components: InferenceComponents) {
fun processCandidate(candidate: Candidate): CandidateApplicability {
val sink = CheckerSinkImpl(components)
fun processCandidate(candidate: Candidate, stopOnFirstError: Boolean = true): CandidateApplicability {
val sink = CheckerSinkImpl(components, stopOnFirstError = stopOnFirstError)
var finished = false
sink.continuation = suspend {
for (stage in candidate.callInfo.callKind.resolutionSequence) {

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